How can I compare a text input to text converted from an image using an OCR API?

I have made a text input, and another label that displays a number scanned from an image taken by the user. I want to compare both numbers (text input and label). I know we should use the Logic block (=).

However the problem I am facing is that the label related to image is initially empty and then is changed depending on the number scanned from image. Because the label string is initially empty, the (=) block does not work, because it is clearly not a match.

What is the code that can compare the text input and number scanned from the image correctly?

Hi and welcome to Thunkable!

You’ll find that it’s very hard to answer questions if we can’t see your blocks. Please post a screenshot of what you have so far.

Also, see this: How to ask Great Questions v2.0

My code is about entering a car plate number (Text input) and later on taking a picture of the actual car plate number, the number is scanned and is displayed by (Number label).

I want to compare the 2 numbers/text and print text accordingly, however, whenever I try to compare them, even if they are the same number it shows that it is not a match.

What I was trying to say is that (Number label) is initially empty until the picture is scanned and a number is displayed, that’s why it is showing that it is not a match.

When I have changed the (Number label) to a fixed number and compared the same number it was a match, so I knew that the issue is from the fact that (Number label) is an empty label so when comparing those 2 values it is not equal so it doesn’t match.

Use the blank TEXT block and put it as a 0 not a number block. You are comparing a text value to a number value and text blocks dont work that way.
test1

Are you able to share a link to your project?

If you compare two text strings that are identical, that should result in the IF condition being true.

If you need to, you can convert text to a number by adding zero (0) to it. Or you can convert a number to text by joining the number with an empty string (“”) using the Join block in the Text drawer.

https://x.thunkable.com/copy/9f5609d30f9a563e275a45e03e5cc58a

This is the link to my project, I will try what you both have suggested, and get back to you.

Thank you for replying

I am a high school student so I don’t really have a lot of knowledge about Thunkable or how to implement what I want in mind, so I would appreciate your help.

What is the name of the screen that you took the screenshot from?

Edit: found it → Driver Info

I get a “null” value every time I take a photo of a license plate. For example, this one: https://upload.wikimedia.org/wikipedia/commons/4/4a/California_2018_License_Plate.jpg.

But honestly, that doesn’t even matter because the OCR API you’re using is not high quality enough to recognize license plates consistently.

I discuss that in a long thread linked from this post: Displaying the texts from the picture similar to the one from the textbox - #4 by tatiang.

The bottom line is that if you want to do license plate recognition, you’re going to have to pay for a better OCR API. I spent a lot of time trying to do what you’re doing with the same free API that you’re using so that I could help the users in those two topics. But I’m sorry to say that the free API you’re using is not worth your time.

It does work, but it depends on how you take the picture, you should only take a picture of the number itself. Anyways, the problem that I was having is solved now.

For my code, I have only programmed it to scan the number itself. for example like this picture:

What I am trying to do with the app is to show the main idea of our project, it is not my goal to make it work perfectly as it is only for a high school graduation project.

In other words, the app is half or part of the idea, it is not the project itself.

1 Like

I have added a map that shows my location and the parking spot’s location, how can I show a line (path route) from my location to the parking spot location? (such as google maps)

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.