sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #17849
Re: [Question #227960]: How to make sikuli detect motions within a specific region?
Question #227960 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/227960
Status: Open => Answered
RaiMan proposed the following answer:
If you want to detect, wether the video stops at a time it should not do
that, then looking for changed pixels with the foreground observer is
not the right way, because your script will simply hang at the
observer(), when the video stops.
Hence you have to use the background observe() (see version 2 in comment
#3), to be able to check, that nothing changed within the last x
seconds.
But for your purpose, the following might be sufficient:
r = GetAppRegion(app_name) #some function that returns an app region
img = capture(r)
wait(1)
while not r.exists(Pattern(img).similar(0.99), 0):
wait(1)
img = capture(r)
wait(1)
print "video seems to have stopped"
this takes an image of the region, waits 1 second and then checks,
wether the region content is still the same - if not, waits 1 second and
starts all over.
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.