"from org.sikuli.script.natives import Vision" statement not working

Asked by Rafiq Mohammed

Hi,
I am using the following code to enhance the robustness of sikuli.

from org.sikuli.script.natives import Vision
Vision.setParameter("MinTargetSize", 18)

My scripts were running fine with the previous version of Sikuli. After formatting my system, i installed the latest version of sikuli on my windows 7 computer. This version of sikuli is giving me the following error when I am running the same script.

[error] script [ Register-Files ] stopped with error in line 18
[error] ImportError ( No module named natives )

Please advise on how to resolve this error.

Thanks,
Rafiq

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

see https://answers.launchpad.net/sikuli/+question/234821

Be aware: this will change again with version 1.1.0 later this year. (see related bug)

What are your experiences with the usage of this parameter?

Revision history for this message
Rafiq Mohammed (rcholayil) said :
#2

Hi RaiMan,
I included the following code as suggested:

FileManager.loadLibrary("VisionProxy")
Vision.setParameter("MinTargetSize", 18)

I received the following error when executing this code:
[error] NameError ( name 'FileManager' is not defined )

Then I used the following code:

find(img)
Vision.setParameter("MinTargetSize", 18)

And again I received the same error:
[error] NameError ( name 'Vision' is not defined )

Could you please let me know what is that I am doing wrong.

Regarding my experience with the usage of MinTargetSize...I do not have any hard data to support my claim, but I feel that the robustness of sikuli script increased after I set the value 18. However, the script still occasionally fails to find images that it regularly finds otherwise. But after increasing MinTargetSize, I feel that the failure rate has decreased.

Thanks,
Rafiq

Revision history for this message
Best RaiMan (raimund-hocke) said :
#3

You have overseen the changed import in the question ;-)

import org.sikuli.basics.proxies.Vision;

so instead of
from org.sikuli.script.natives import Vision

use
from org.sikuli.basics.proxies import Vision

Revision history for this message
RaiMan (raimund-hocke) said :
#4

thanks for explanation of your experiences.

Revision history for this message
Rafiq Mohammed (rcholayil) said :
#5

Thanks RaiMan, that solved my question.

Revision history for this message
Dmitry (november) said :
#6

for SikuliIDE 1.1.0 both imports are incorrect
"from org.sikuli.script.natives import Vision"
"from org.sikuli.basics.proxies import Vision"

the working one is "from org.sikuli.natives import Vision"
pls update docs

Revision history for this message
RaiMan (raimund-hocke) said :
#7

@Dmitry
thanks, but the docs for SikuliX 1.1.0+ are here:
http://sikulix-2014.readthedocs.io/en/latest/globals.html#advanced-settings-for-speed-and-robustness

... were it is correct.

Revision history for this message
Michael Bvhm (badboi) said :
#8

from org.sikuli.natives import Vision
Vision.setParameter("MinTargetSize", 6) # the default is 12.

returns error:
in <module> from org.sikuli.natives import Vision ImportError: cannot import name Vision

..using Sikulix 1.1.4

Revision history for this message
Richard Chubb (r1chbb) said :
#9

also does not work for 2.0.5.

Where is vision now located?

Revision history for this message
RaiMan (raimund-hocke) said :
#10

--- 2.0.5

vision is no longer supported since many versions (not sure since when).

It was no longer relevant with the new implementation of OpenCV at the Java level.

Just remove the 2 lines