13
$\begingroup$

I am trying to use the TextRecognize function to extract data from certain screenshots. This is already a cropped version.

long

Using TextRecognize on this yields 12 Catherine FicktEuSC|'\A|V|K. Not very satisfactory. Isolating the last word, however:

short

This yields FicktEuschAMK. Why is this different? I tried converting the image to black and white first (both using ColorConvert and Binarize), but that didn't improve anything. Is there any way to get the desired result without having to crop the former image even more? This is problematic because I can't tell where the first word ends and the second one begins, without manual inspection.

$\endgroup$
  • 2
    $\begingroup$ I can only surmise that TextRecognize employs meta-level analyses to determine if the text in question is likely to appear in a dictionary or not. Once it determines that "Catherine" appears in the dictionary, it "assumes" that the final character string will as well, leading to the erroneous transcription. However, when applied to the last character string alone, it determines that the word does not appear in the dictionary and recognizes it character-by-character (correctly). You should be able to test this with other word/non-word pairs. $\endgroup$ – David G. Stork Mar 11 '15 at 0:19
  • 1
    $\begingroup$ In support of @DavidG.Stork's hypothesis, setting the language to German via TextRecognize[img, Language -> "German"] gives an almost correct text recognition. $\endgroup$ – bobthechemist Mar 11 '15 at 1:44
  • 2
    $\begingroup$ You can also cheat which works perfectly. $\endgroup$ – bobthechemist Mar 11 '15 at 1:54
5
$\begingroup$

For this example, it seems that setting the Alpha Channel to .1 yields correct result across all languages without needing to crop.

TextRecognize[img ~SetAlphaChannel~ .1, 
   Language -> #] &  /@ {"English", "French", "German", "Spanish", 
  "Portuguese", "Italian"}

{"12 Catherine FicktEuschAMK", "12 Catherine FicktEuschAMK", "12 
Catherine FicktEuschAMK", "12 Catherine FicktEuschAMK", "12 Catherine 
FicktEuschAMK", "12 Catherine FìcktEuschAMK"}

(PS: it's "my secret trick", don't tell anybody...hi,hi,hi)

$\endgroup$
  • $\begingroup$ With versions from 10.4.1 to 11.1.0 this trick doesn't work... $\endgroup$ – Alexey Popkov Mar 30 '17 at 13:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.