Comment 5 for bug 673995

Revision history for this message
RaiMan (raimund-hocke) wrote : Re: [Bug 673995] Re: [request] Transparent pixels should be ignored in matching process
  • test1.png Edit (7.5 KiB, image/png; x-unix-mode=0644; name=test1.png)

Hi Laurent,

I just made some tests and found out, that transparency works on backgrounds that are not too dark.

I created a png image of the Sikuli logo from the launchpad page and made the surrounding white pixels transparent (i have it attached) (done with Pixelmator on my Mac ;-).

On the white background it is found without any problems. Even background with some colored structure is not a problem, as long as it is not too dark.
Might be, that this is because (I am not sure so) internally the images are turned to grayscale under normal conditions (finder.cpp -> TemplateFinder::find()). I will later look into the code again.
Furthermore, I have no idea, how the transparent pixels are treated in The OpenCV.matchTemplate() with the used method CV_TM_CCOEFF_NORMED.

Nevertheless I think it is worth some testing.

BTW: I am not one of the developers ;-)

Raimund

Am 06.02.2012 um 16:39 schrieb Laurent Vaucher:

> If I was interested in trying to implement that feature, where should I start?
> I've seen that the matching process relies on OpenCV function 'matchTemplate', but from its documentation I'm not even able to tell if there is a way to exclude some pixels.
>
> --
> You received this bug notification because you are subscribed to Sikuli.
> https://bugs.launchpad.net/bugs/673995
>
> Title:
> [request] Transparent pixels should be ignored in matching process
>
> Status in Sikuli:
> New
>
> Bug description:
> I'm using Sikuli 0.10.2 on a 32-bit Windows XP system. I just noticed
> that if you are using a png file, containing transparent pixels as a
> pattern for image recognition, these pixels are not skipped during the
> matching process, thus resulting in a wrong match if you have some
> kind of background under the transparent part of the image. I think
> this behavior is incorrect - and Sikuli could be even more powerful if
> able to skip some pixels from the pattern.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/sikuli/+bug/673995/+subscriptions