← Back to team overview

sikuli-driver team mailing list archive

[Question #263444]: How to compare 2 regions

 

New question #263444 on Sikuli:
https://answers.launchpad.net/sikuli/+question/263444

Hi,

What I am trying to do is to check whether a certain area has changed after performing some activity or not. So the scenario is as follows:

1. Define and create a region on the screen
2. Some unrelated activity . . .
3. Create another region (exactly the same as in step1)
4. Check whether anything changed between these Regions.

So what I did is something like that:

#Create a region
tableRegion = Region(categoryColumn)
tableRegion = Region(categoryColumn.x, categoryColumn.y, categoryColumn.w + 500, categoryColumn.h + 100)

do something...

#Create another region (exactly the same)
tableRegion1 = Region(categoryColumn)
tableRegion1= Region(categoryColumn.x, categoryColumn.y, categoryColumn.w + 500, categoryColumn.h + 100)

# Now make sure that nothing changed:

if tableRegion == tableRegion1:
    print "2 regions are similar!"


However this is clearly not the way to go as I always get them as not equal. 
I also tried to compare the captures:

reg = tableRegion.getScreen().capture(tableRegion)
reg1 = tableRegion.getScreen().capture(tableRegion1)


And I also attempted to create and compare Patterns as well:
regPattern = Pattern(reg)
regPattern1=Pattern(reg1)


In all cases I get that both areas are not equal.
How can I validate that both regions are similar?


Thanks!
Eugene S

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