← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #676086]: Ocr not always working

 

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

    Status: Answered => Open

matteoa is still having a problem:
Thanks RaiMan, 
I've tried this, merging together the two above mentioned answers :
img1 = Image.create(capture(selectRegion()))
imgGrey = Image.convertImageToGrayscale(img1.get())
imgGreyResized = Image.resize(imgGrey, 3)
print imgGreyResized().text()
But I have had this error:
[error] Error caused by: Traceback (most recent call last): File "C:\Projects\DataPurchase\REACT\SikuliX\Test_h20\interactTextBetter.sikuli\interactTextBetter.py", line 3, in <module> imgGreyResized = Image.resize(imgGrey, 3) TypeError: resize(): self arg can't be coerced to org.sikuli.script.Image 

It is not clear to me if when you say that these are static methods you mean of Java or python:
if Java I've checked this:
https://docs.oracle.com/javase/7/docs/api/java/awt/Image.html
and I did not find the image.resize method.
If Python I found here:
https://python.developpez.com/cours/pilhandbook/php/image.php
The resize method, but it says that there are two calls possible:
resize
im.resize(size) => image
im.resize(size, filter) => image
In your 271593 response do you mean that what is needed is to do something like:
imgGreyResized = Image.resize(float(imgGrey[0])*3.0, float(imgGrey[1])*3.0))
?
Because I tried and have had this error:
line 4, in <module> imgGreyResized = Image.resize(imgGrey[0]*3, imgGrey[1]*3) TypeError: 'java.awt.image.BufferedImage' object is unsubscriptable 
then I tried also this line:
imgGreyResized = Image.resize(imgGrey.getHeight()*3, imgGrey.getWidth()*3)
With this error:
line 5, in <module> imgGreyResized = Image.resize(imgGrey.getHeight()*3, imgGrey.getWidth()*3) TypeError: resize(): self arg can't be coerced to org.sikuli.script.Image 
It is probably a stupid error from my side...thanks for any help!

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