Wayne G
Wayne G

Reputation: 41

Is it possible to configure Google ML Kit's Text Recognition to only recognize numbers and letters found in standard English?

I am trying to use Google ML Kit's Text Recognition V2, using the default Latin script, in my Flutter application.

The whole thing works, but there are lots of characters being incorrectly recognized, especially if the image quality is poor (which, in my project, would be frequent).

For instance, "1" would be recognized as "|". Or if there's even a speck of dust above an "o", it would be recognized as "Ö" or some other variation of it.

So now I'm trying to lessen the possibilities of that happening. Would it be possible to limit the character pool the vision could choose from to only standard numbers and letters from the English alphabet?

Thank you so much.

I tried brute forcing the problem and just exclude the characters I don't want using if statements, but as you can imagine, that takes a lot of time and effort.

Upvotes: 4

Views: 778

Answers (1)

BrettFromLA
BrettFromLA

Reputation: 916

For me, scanning text is always frustrating because of this. In the past, I've used a streamlined brute-force approach:

  1. Create a key-value list.
  2. Add the characters you want to change (like "Ö") as keys, and the characters they should be (like "0") as values.
  3. Loop through all the extracted characters. If it's not a number, and not a space, then loop through your key-value list to see if the extracted character is one of the list keys. If it is, replace it with the corresponding list value.

You can add onto this key-value list easily and quickly. It will never be perfect, but it's pretty good, it's simple to update, and it doesn't require multiple If statements.

Upvotes: 0

Related Questions