← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #255516]: how to detect when screen changes - java

 

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

RaiMan posted a new comment:
--- getColor is available in the Sikuli API 1.0.1+
org.sikuli.script.Location.getColor()

which returns a Java Color object.

I made some tests last year with it: for only one pixel it is rather
fast, but if one decides to check some more pixels the time consumed is
simply time-for-one-pixel * number-of-pixels, which does not make sense
for more than some ten pixels, since the check of an image 10x10 against
an even sized or slightly larger region is only some milli-seconds.

--- some kind of CRC against the raw pixel data
this is similar, to what OpenCV matchTemplate does.
 I just made a test with version 1.1.0:

for an observed region of about 20x20 pixels it takes on average about 3 - 5 milli-seconds for a check.
So you have a scan rate of about 200+ per second, which should not be necessary, about 50 should be sufficient.

this is my test script:

img = Pattern("1412875178325.png").exact()
reg = exists(img)

i = 0
start = time.time()
while True:
  if reg.exists(img, 0):
    wait(0.01)
    i += 1
  else:
    print i, (time.time()-start)/i
    break

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