← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #239302]: Identifying image quickly

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
this test script running with version 1.0.1 on a Mac Book Air (2GHz
Intel Core I7):

logo = "1384684031942.png" # Sikuli logo on webpage
img = Pattern("1384683797229.png").exact() # a part of it having size 15x30
reg = find(logo)
card = reg.find(img) # card now is the 15x30 region to search in

# now running 52 times 
start = time.time()
for i in range(52):
    card.exists(img, 0)
print int((time.time()-start)*1000)

this takes less than 200 msecs

...but then I checked the not found situation and uuups, there is a bug in 1.0.1, which I did not remember, since my daily work is with version 1.1 (under development):
the bug: the minimum time (found or not found) is always given by the WaitScanRate (how many searches per second, which is 3 in the standard and hence 300 msec per search - which leads to your 15 secs).

The workaround:
Use this:
Settings.WaitScanrate=500 # (min wait time = 2 msec)
reg = <define your target region>
Settings.WaitScanrate=3 # reset to normal to not overload your system with normal searches

This is another oddity with 1.0.1:
the region takes the value from the settings at the time when it gets defined and does not look again for changes before a search.

All this is fixed in 1.1 (where it is possible to set theses search
influencing values per region)

BTW: It does not make any difference for this timing test, wether you
take different images or all the same.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.