sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #30240
Re: [Question #260950]: If something exists in region one then find it region 2
Question #260950 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/260950
Status: Open => Answered
RaiMan proposed the following answer:
To avoid these irritations due to "flashy effects", the first thing to do is to catch as little background as possible around the visual object of interest (the x in your case), meaning: concentrate the shot to the area, that distinguishes it.
with such images one should be able to search with a high similarity (> 0.9 or even exact (>0.99)), trying to avoid false positives.
If this does not help, the next option is to restrict the region, so
that it does not contain candidates for false positives.
The last option indeed is, to check different possible image variants, that should match with a high score exactly.
But since this costs time, one should make the search region as small as possible and minimise the image variants used.
A basic function, that would replace an exists():
def myExists(reg, similar, *images):
for img in images:
if reg.exists(Pattern(img).similar(similar), 0):
return true;
return false;
usage:
with one image
if myExists(someRegion, 0.95, someImage):
which is the same as
if reg.exists(Pattern(img).similar(similar), 0):
and with 2 or more images
if myExists(someRegion, 0.95, someImage1, someImage2, someImage3 ):
print "found one"
else:
print "none found"
If you go this way and need it extensively, then it might be worth, to
try with threading in the function, to parallelize the searches.
version 2 will have more features to better support these situations.
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.