← Back to team overview

sikuli-driver team mailing list archive

[Question #676086]: Ocr not always working

 

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

Hello,
since I have to use Sikulix on a 32bit pc I'm stuck with version 1.1.3.
I have a bar in a web app where I have to read with ocr two items, so the font, the background the size etc are the same.
What I do in the script is to select the two regions and then do the OCr one after the other(but changing the order doesn't affect the (bad) results.
The bar I' working on is something like (the "yes" is actually what I have to Ocr):
--------------------------------------------------------------------------------------------------
Everything is ok?                                                                               Yes
--------------------------------------------------------------------------------------------------
The OCR of the left phrase works perfectly, while in the right part it read nothing (instead of "Yes").
I tried with this single line script(question 674899):
print selectRegion().text()
And the results are consistent, the ocr on the right of the bar is always found with no problem, while in the left part found nothing.
The real images are available, if needed.
I tried also the advises in question 271593 but I do not manage to make it run in Sikulix IDE, with these lines:
img = capture(rValAV) # get the image from the screen (in memory)
img1 = Image.create(img) # create an with the new Image class (still in memory)
imgGrey = img1.convertImageToGrayscale(img1.get()) # does what it says (still in memory)
imgGreyResized = imgGrey.resize(3) # resize the image to about 300dpi (usually 3 as factor is sufficient) (still in memory)
text = imgGreyResized.text() # using the SikuliX builtin OCR implementation
print text
the error given is:
...
line 113, in <module> imgGreyResized = imgGrey.resize(3) # resize the image to about 300dpi (usually 3 as factor is sufficient) (still in memory) AttributeError: 'java.awt.image.BufferedImage' object has no attribute 'resize' 
...
Since in the right part the Tesseract works perfectly I suppose there is something wrong with what I do.
I'm sorry if I did some beginner mistake...
Thanks for any help



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