← Back to team overview

sikuli-driver team mailing list archive

[Question #692723]: OCR.readLines how to intepret results?

 

New question #692723 on Sikuli:
https://answers.launchpad.net/sikuli/+question/692723

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

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.