← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #688961]: about onChange() function

 

Question #688961 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/688961

RaiMan proposed the following answer:
What you want to know is when in a small region, that usually shows some
background, some pattern appears, that can be distinguished from the
background (meaning: some to many of the pixels show a significant
different color).

The current implementation of findChanges is not really appropriate for your situation, since:
- both images are converted to grayscale
- pixels are isolated, that differ more than +-3 in the range of 0 .. 255 (PIXEL_DIFF)
- if more than 5 pixels are detected, then the evaluation of rectangles is done (IMAGE_DIFF)

In your situation, the pixels of the background are constantly changing
in a way, that is detected by findChanges.

I played a bit around with different DIFF settings:
PIXELDIFF = 20
IMAGDIFF = 50
comes near to what you want (97 and 98 are detected, but also 101)

I will add the 2 settings as parameters to findChanges. Available in
2.0.4 the next days.

BTW: you Python OpenCV example has a problem:
subtract will set results <0 to null and >255 to 255.
hence it depends on the order of the 2 given mats.

We use absDiff to calculate the pixel diffs.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.