File extension for OCR

I have been trying to make an OCR, so my app can read text and put the output in a list or label. When I try to do it, it tells me that it is unable to recognize the file type and the file extension. How do I solve that? Btw I made the OCR with the help of Barcode Scanner - Round About Way using OCR
I did not really understand what the stored object was and what it does either.

Can you post a link to your project?

here are the blocks I used:)
i did the same thing as Barcode Scanner - Round About Way using OCR
maybe the mistake is in the stored variable, i didn’t really understand that part

soo, were you able to find anything wrong with my blocks? I don’t think I can send the link for my project, because it contains the web API key and other information that I shouldn’t disclose.

Can you post the error message you’re getting?

Also, when you use a block with a green “error” block result, you should check the value of that block. When you preview your project, what are the values of the two green “error” blocks?

I changed the last part of my blocks and this is the error message that I’m getting.

image

I haven’t used that API but I’m guessing it might need the photo block, not the url. You may need to check the documentation for that.

Have you tested this with a mobile device?

@codeswept might have a better idea since they have worked on an OCR app

And just an aside since I changed the size of the image you posted to make it a bit smaller, you can do that with any image you paste/upload in the forums by adding a comma followed by a percentage after the resolution. For example, I added “,40%” to yours:

image

See this for more info.

2 Likes

Yes, I have tested this on a mobile device. I got the error message after testing it on a mobile device. I have also messaged @codeswept and I am patiently waiting for an answer :slight_smile:

1 Like

In your block Web API URL you are adding the green block URL to the end of your URL.

Try adding the green block photo instead. It should work with the photo not the URL of the photo.

1 Like

I have tried replacing the “url” block with the “photo” block from the “photo from camera” part, but it still does not seem to be working. I am getting the same error.

1 Like

Select a photo file from the gallery with different extension to use it as the input for the API. It could be the API is not recognising all image extensions.

Okay, I will try doing that! But how do I let it know that I want the words that it scanned to be outputted in a list or label?

I tried this Example API and it is working fine and I got the following response

{"ParsedResults":[{"TextOverlay":{"Lines":[],"HasOverlay":false,"Message":"Text overlay is not provided as it is not requested"},"TextOrientation":"0","FileParseExitCode":1,"ParsedText":"GAVE AWAY MY BOOK\r\nFREE ON\r\nREACHED TOP OF AMAZON\r\nBESTSELLER\r\n","ErrorMessage":"","ErrorDetails":""}],"OCRExitCode":1,"IsErroredOnProcessing":false,"ProcessingTimeInMilliseconds":"359","SearchablePDFURL":"Searchable PDF not generated as it was not requested."}

Can you make sure you have the correct url in your blocks

Are you talking about the web API url?

1 Like

I am talking about the free version of the same API you are using.

Just to explain more. This is the image I’m using test image and in the response of the API you can see the following text GAVE AWAY MY BOOK\r\nFREE ON\r\nREACHED TOP OF AMAZON\r\nBESTSELLER\r\n which means that it is working fine

1 Like

I think it’s kind of working, but this is the error message that I am getting now:
“{“OCRExitCode”:3,“IsErroredOnProcessing”:true,“ErrorMessage”:[“File failed validation. File size exceeds the maximum size limit. Maximum size limit 1024 KB”],“ErrorDetails”:”",“ProcessingTimeInMilliseconds”:“31”}"

1 Like

I have also checked the size of my image and it says that it is 926KB, which is less than 1024KB. So I don’t really know what the problem is.

1 Like

I can’t really provide any comments without testing the URL and image that you are using resulting in this error.

Unfortunately, if I share the url, I would have to share my API key. Is there anything you think might be the problem? Maybe you could check your blocks with mine?

1 Like