OCR.readLines how to intepret results?

Asked by matteoa on 2020-09-03

hello,
I'm trying to parse an image similar to an excel spreadsheet that contains lines of text that I have to OCR and have divided one per row.
I was using something like:
ListStr=rAppoDTC.textLines()
obtaining a list of the text present one by one on the lines.
Now I'd like to use
OCR.readLines
But this API returns a list of matches instead of a list of strings.
I suppose there is a way to extract also the text.
I've tried this:
linescode=rAppoDTC.textLines()
log.writeLogAll ("Lines="+str(linesPcode))
it works
linescode2=OCR.readLines(rAppoDTC)
for m in linescode2:
    apporeg=Region(m)
    log.writeLogAll ("LinesText=" + OCR.readText(apporeg))
and this gives me this error:

[error] java.lang.NullPointerException ( java.lang.NullPointerException )
[error] --- Traceback --- error source first
line: module ( function ) statement
576: main ( <module> ) log.writeLogAll ("LinesText=" + OCR.readText(apporeg))
[error] --- Traceback --- end --------------

The main question is: how do I extract text from the matches that are returned by OCR.readLines?
this is my configuration:
2.0.4-2020-03-14_08:01/Windows10.0/Java8(64)1.8.0_251-b08
Thanks in advance

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
2020-09-08
Last query:
2020-09-08
Last reply:
2020-09-07
matteoa (matteoa) said : #1

hello,
even a simple example would be appreciated...
Thanks

Best RaiMan (raimund-hocke) said : #2

match.getText()

matteoa (matteoa) said : #3

Thanks RaiMan, that solved my question.