How to find a specific word after running the OCR function

5 views (last 30 days)
I'm working on a project where I use the OCR function to analize a picture. I want to find a specific word in the picture, for instance find only the word "and" in the picture. I tried to do this using
results = ocr(myimage, 'CharacterSet', '"and"');
confidence_mark = results.CharacterConfidences > 0.80;
But this didn't work. Instead the 'CharacterSet' made the program find the individual characters "a", "n", and "d" but i wanted to only find a string of these three characters "and". Thank you guys so much for helping!

Accepted Answer

tiwwexx
tiwwexx on 9 Jul 2019
In case anyone sees this string I thought of a way around this. Use the code
results = ocr(myimage, 'CharacterSet', '"and"');
Then just look throught the results.Words sting for the word "and" so you get out a string that only has what the ocr program recognized as the word "and". Then do
results.WordConfidence('newWordList') > significance_value & strcmp(results.Words,'and');
and this should give you all the instances of the word "and"

More Answers (0)

Tags

Products


Release

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!