OCR API and search results don't show expected output



How come after taking the photo, then clicking on the OCR button and then pressing search, the details of the license plate isn’t shown in the 3 text boxes provided below? But when I manually type in the license plate number itself, only then will the 3 text boxes display the details of the license plate itself?

https://www.kapwing.com/6467063c1e78840011854866/studio/editor/sharing
This video shows the problem that I’m facing

There is no way we can troubleshoot a problem you’re having without seeing how you actually coded it.

Can you share a screenshot of your blocks or a link to your project?

https://x.thunkable.com/projects/64670fd0fa089d59f5c7162b/a93a6e15-190d-4887-9274-522878e10a01/designer

When I open your project, it shows 8 errors with your blocks. It looks like you deleted an initialize block for a variable you’re now trying to use:

You will need to add a new initialize block and probably re-select all of the variable blocks that have errors.

I changed those blocks with error already but it still doesn’t make a difference

https://x.thunkable.com/copy/e1b739c95509bfa247220106ac0163d2

I scanned this sample license plate:

And got the response:

7LBZZ810 drnv-ca-gov

Your blocks search your data source for an exact match which would need to be 7LBZ281

How confident are you that the OCR is reading the correct data from the license photos?

The OCR software that we are using is from an open source so it is not very advanced but if we were to take the photo of the license plate correctly and then press on the search button, then there will not be any results shown despite the license plate already registered in our Google Sheet. However, the search button will only be successful if we were to type in the number plate ourselves without taking the picture of it.


Can you try to take a picture using the plate number above as it is already recorded in our Google Sheet?

What I’m telling you is that the OCR result is not going to (always) match what you have in the Google Sheet. So you need to find a better OCR service if you are going to rely on this.

I’m not able to successfully do that because the API is responding:

{“OCRExitCode”:3, “IsErroredOnProcessing”

Is there a better OCR service that you would recommend?

Did you wait after capturing the image on your phone before pressing the OCR button?

Yes, sometimes Cloudinary can take up to 15 seconds to upload an image and return a url. So I waited.

I don’t use OCR so I can’t recommend anything. If Google had a product, that’s what I would use.

But now our OCR isn’t our main focus as the text box where it displays the plate numbers can be edited by the user themselves. The main issue is that when we press the scan button and after taking photo of the plate numbers, it still shows error even though the plate numbers have already been registered inside my Google Sheet.

Do you mean the Search button? You don’t have a Scan button.

When I tried it, it worked for me:

But if you click OCR before clicking Search, it’s going to break everything because the OCR is unreliable. So if you want the search to work, just skip steps #1 and #2.

https://x.thunkable.com/copy/a8c1f1d01861c48e97826f4b333383f1
This is the latest version of the project and we have now merged all 3 buttons into 1 button where you would just have to press 1 button to take photo and the plate number will be displayed automatically and it would also indicate whether there would be an error or not but we are still facing the same issue where it will still show error even though we’ve taken a photo of the car plate that has been registered inside my Google sheet but if I were to search up the car plate on its own without pressing the scan button, then the details of the license plate would be shown and there won’t be any error indicated. Is there a way to solve this issue?

Yes, get a better OCR service, like I said above.

Your project does this:

  1. Take photo
  2. Upload photo to Cloudinary
  3. Send Cloudinary url to OCR API
  4. Get response from OCR API
  5. Search Google Sheets for response from OCR API

Right now, #1 works. #2 works. #3 works. #4 does not work. #5 works (when manually entered).

So you either need to troubleshoot the OCR response to make sure it always matches what you have in your Google Sheet or you need to replace it with better OCR.

When I scan your sample license plate:

I get this JSON response from the OCR API:

{"ParsedResults":[{"TextOverlay":{"Lines":[],"HasOverlay":false,"Message":"Text overlay is not provided as it is not requested"},"TextOrientation":"0","FileParseExitCode":1,"ParsedText":"SBXJ234A\r\n","ErrorMessage":"","ErrorDetails":""}],"OCRExitCode":1,"IsErroredOnProcessing":false,"ProcessingTimeInMilliseconds":"1953","SearchablePDFURL":"Searchable PDF not generated as it was not requested."}

And if I view that in https://codebeautify.org/jsonviewer, I get this tree:

So the “Parsed Text” property’s value is: SBXJ234A\r\n

That does not match your license plate value in Google Sheets which is SBA 1234A.

So there is no way to make this work without finding a better OCR service or giving that OCR service images it can recognize better.

1 Like

Ok now I understand the issue thanks for explaining