find() not working with much text in region
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SikuliX |
Fix Released
|
High
|
Tom Yeh |
Bug Description
OS X 10.6.2 Sik 098
based on some tests I made together with bug (screenshots not recognised when re-running script) https:/
This is the first one: Too much text in a capture
If a captured region contains significantly more text, than grafical information, the find may not work at all or with a lower similarity will find a displaced area. This can be reproduced with all the capture techniques available. For documentation I have chosen one, that does not depend on manual capturing (either in advance or interactively) to exactly know the (x, y, w, h).
The material is available at:
- script together with messages: http://
- a screenshot as an overview: http://
This is the script I use:
switchApp("iPhoto")
sub = <captured subregion> # you have to capture a region
pos = (sub.x, sub.y, sub.w, sub.h)
(x, y, w, h) = pos
print "++++ Our testarea: ", pos
p = capture(x, y, w, h)
print "++++ find all ", find(p)
for iW in range (20, w, 50):
print "++++ Try with width = ", iW
p = capture(x, y, iW, h)
fnd = find(p)
print "++++ found? ", fnd
if fnd and iW > 200:
break
if not fnd:
pat = Pattern(
print "++++ try again with Pattern ", pat
fnd = find(pat)
print "++++ found pattern? ", fnd
To really understand, what happens, look at the screenshot in parallel.
The critical area is the menu section below "MobileMe Gallery" in the left column of iPhoto. If I capture only the menu section (about 160 x 180 in size), this is not found. If you reduce the similarity to 0.29, it is found, but displaced by about (-20, -100).
How my test works:
First I capture a region from left side with the mobileme-icons to the edge of the screen on the right. Then I start to capture slices starting with width 20 and stepping 50 always starting left side of the region.
You can see:
- the column of icons is found
- a slice about 120 in width is found, but not the slice with 170
- starting with a width of about 350, its found always, so I stop at the first successful find above 200.
when not found, I reduce the similarity to 0.2 and try again with this pattern. That is always successful here (must not be in other situations), but with a significant displacement of the match area (compare the pattern match coordinates with the region).
interesting is the fact, that a single menu entry like "Feuer_
Changed in sikuli: | |
importance: | Undecided → High |
assignee: | nobody → Tom Yeh (doubleshow) |
status: | New → In Progress |
One more thing
As you will see, when testing other situations, for one of these find()'s that are not successful, there are up to 4 screen captures reported. Normally its only one, which is what one expect.