4

Why TextRecognize reads the text by column and not by line in the following scenarios?

The lines are perfect, the font is perfect, image quality is perfect so I do not understand why it does not read it normally by line.

Also notice that it reads 66 as 55, in fact every 6 it read as 5. Also in the second example it reads UJ as U] or XB as xB or QC as Qc.

The conditions can not be more perfect so why it fails in such ideal situation?

Input:

im=ImagePad[Rasterize[Grid[Partition[ToString[#[[1]]]~StringJoin~ToString[#[[2]]]&/@Partition[RandomInteger[9,105],2],7,7,{1,1},{}]],ImageSize->300],10,White]
TextRecognize[im,"Line"]

Output:

grid1

{"58", "95", "08", "55", "25", "02", "49", "84", "13", "04", "18", \
"74", "78", "19", "25", "95", "95", "35", "59", "00", "18", "94", \
"49", "10", "20", "32", "82", "88", "32", "49", "25", "98", "70", \
"87", "59", "28", "27", "84", "10", "41", "32", "27", "55", "25", \
"23", "57", "00", "55", "83", "42", "80", "97"}

Input:

im=ImagePad[Rasterize[Grid[Partition[ToString[#[[1]]]~StringJoin~ToString[#[[2]]]&/@Partition[CharacterRange["A","Z"][[1+RandomInteger[25,105]]],2],7,7,{1,1},{}]],ImageSize->300],10,White]
TextRecognize[im,"Line"]

Output:

enter image description here

{"BF", "LS", "IZ", "IX", "ZP", "NO", "ME", "QL", "LF", "YL", "SO", \
"LE", "FV", "CS", "EX", "CT", "FY", "BX", "KL", "EU", "KS", "WR", \
"LT", "PA", "CX", "IK", "PI", "GV", "MN", "OT", "FK", "xB", "DY", \
"Qc", "DN", "UL", "HB", "wz", "FY", "MH", "U]", "PK", "XL", "YT", \
"PQ", "DM", "IP", "CS", "SM", "Z]", "WV", "KF"}
azerbajdzan
  • 15,863
  • 1
  • 16
  • 48
  • 1
    Pretty weird! Using TextRecognize[im, "Line", RecognitionPrior -> "SparseText"] - it seems to work row-by-row instead but the results are poor. – flinty Aug 19 '20 at 11:49

0 Answers0