sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #31766
[Question #265404]: Using Region.highlight() conflicts with Find() operations in that Region
New question #265404 on Sikuli:
https://answers.launchpad.net/sikuli/+question/265404
(I think this is a bug, but maybe it's the intented behaviour, so I'll ask a question)
I have two functions as defined below:
>>> def f1(x, y, w , h):
... region = Region(x, y, w, h)
... image = capture(region)
... region.find(Pattern(image).similar(0.99))
...
>>> def f2(x, y, w, h):
... region = Region(x, y, w, h)
... image = capture(region)
... region.highlight() #Highlight the region to show where's being searched, should be harmless?
... try:
... region.find(Pattern(image).similar(0.99))
... except:
... raise
... finally:
... region.highlight() #turn off highlight even if there's a nasty failure
...
The function 'f1' always passes. The function 'f2' only sometimes passes. The following are some examples showing how 'f2' passes and fails:
CALL: f2(0, 0, 50, 50) | RESULT: fail
CALL: f2(0, 10, 50, 50) | RESULT: fail
CALL: f2(10, 0, 50, 50) | RESULT: fail
CALL: f2(10, 10, 50, 50) | RESULT: pass
The problem seems to be that the highlight overlays the Region when the Region borders the screen. Personally I think that this is incorrect behaviour.
I understand that Region.highlight() may affect Find() operations *in general*, but I do not think that it should affect Find() operations within the Region. It makes more sense for Region.highlight() to always be externally bounding, even if that means part of the highlight being offscreen.
The only problem I can see with my proposed functionality is that using SCREEN.highlight() would display nothing. (though, I think it's more important for Region.highlight() to behave consistently)
What do you think: Bug? Or is this how things are supposed to work?
NOTE: 'f2' never works when used in the Sikulix-IDE, as the Sikulix-IDE transposes the highlighted region
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.