X 1.0rc1 Observe() not working (0.10.2: on Windows)

Bug #604514 reported by RaiMan
30
This bug affects 5 people
Affects Status Importance Assigned to Milestone
SikuliX
Fix Released
High
Unassigned

Bug Description

Win7-32, 0.10.1

onAppear(any-visible-image); observe()
the observation loops infinite, though the image gets visible and would be matched by a find()

onVanish(any-visible-image); observe()
the observation loop finishes at once, though the image is still visible

the test script:

def myH(e):
   popup("Hello")
   stopObserver()

imgObs =
if not exists(imgObs, 0):
 onAppear(imgObs, myH)
else:
 onVanish(imgObs, myH)

popup("Start")
observe()
popup("End")

the script behavior is controlled, by either hide or unhide the image before it is run and then unhide/hide it respectively, by dragging around a window on the desktop.

All this works perfectly on Mac 10.6

RaiMan (raimund-hocke)
tags: added: observe windows
RaiMan (raimund-hocke)
description: updated
Revision history for this message
niknah (hankin0) wrote :

I have a problem with observe too but it's unrelated to windows.
Adding this line at the top of SikuliEventManager::update fixed it for me...

cvCvtColor(screen_image, screen_image, CV_RGB2BGR);

This line is in the FinderProxy::createFinder function which is used by find() but not observe()

You can see see that the image that's passed to this function via observe() is faulty by adding cvSaveImage("/tmp/t.png", screen_image); at the start of the update() function.

The cool thing about this is that I've noticed that it still matched the image with all the wrong colors but it just gave it a lower score.
Maybe you're using a different image in windows?

Revision history for this message
niknah (hankin0) wrote :

Here's a patch for various problems I've had with observe()

* wrong colors being used, not getting the same matches.
* when no similarity is specified, similarity is set to 0.8 (MIN_SIMILARITY in event-manager.cc) which is different than the default 0.7 with find(), etc.

I am using ubuntu x64

Revision history for this message
Tsung-Hsiang Chang (vgod) wrote :

just committed niknah's patch. (r324, r325)
Thank you, niknah!

Changed in sikuli:
status: New → Fix Committed
Changed in sikuli:
milestone: none → x1.0-rc1
Revision history for this message
Nirmal (nirmaljpatel) wrote :

This is still broken on Sikuli-X-1.0rc1-win32

I am running Windows Vista.

Revision history for this message
Tsung-Hsiang Chang (vgod) wrote :

The observer has some fundamental problems. We've had a new implementation and will incorporate it into the next release.

Revision history for this message
Danielo (rdanielo-gmail) wrote :

I Will be waiting for this thing to be solved on windows.

Thanks.

Revision history for this message
RaiMan (raimund-hocke) wrote :

a temporary solution, if you want to wait for changes in a region:

theRegion = the-region-to-observe
img = capture(theRegion)
for i in range(10):
   if not theRegion.exists(img,0): break
   wait(1)

Revision history for this message
Danielo (rdanielo-gmail) wrote :

""""a temporary solution, if you want to wait for changes in a region:

theRegion = the-region-to-observe
img = capture(theRegion)
for i in range(10):
   if not theRegion.exists(img,0): break
   wait(1)""""

But this stops your script, and avoids it to do other things during this search.

The good thing about observe it's to run it in background. At least for me

Revision history for this message
RaiMan (raimund-hocke) wrote :

@Danielo: """"a temporary solution, if you want to wait for changes in a region:

yes, when writing that, I knew what you really wanted: ... if you want to WAIT for changes...

but I thought, that you might spend some time with the rest of your workflow AND have a chance to test it.

Tip: the above solution packed in a def() and then threaded runs in background :-) (see your other question)

RaiMan (raimund-hocke)
Changed in sikuli:
milestone: x1.0-rc1 → x1.0-rc2
summary: - Observe() not working on Windows
+ X 1.0rc1 Observe() not working (0.10.2: on Windows)
Changed in sikuli:
importance: Undecided → High
RaiMan (raimund-hocke)
Changed in sikuli:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.