Found Image with transparency


#1

Sometimes I want to find an image that has transparent parts, but whenever I try one of these images in a Found Image, it's always unsuccessful.

For example, I want to find the first image in the second image, but this never seems to work:

reticle 57am


#2

This cannot be done with Keyboard Maestro. Not currently anyhow, and not any time soon either I am afraid.


#3

I'm not sure I understand your objective, but I just ran a test with the second image, and it found it.
I also tested for an image just slightly larger than the first image, selected from the second image, and it found it.

image

Image I searched for:
image


#4

Thanks @JMichaelTX

From what I can tell, your example finds part of the second image inside the original second image. Whereas, I would like to find the first image inside the second image.

What makes the first image different is that it contains a transparent background. The idea is to match the non-transparent (i.e. opaque) parts of the first image in the second image. Basically I'd like the KM image matching algorithm to ignore the transparent parts, and only match the opaque ones.

Think of each pixel in the transparent parts as unknown variables. I don't care what each of those pixels is set to. I only care about the opaque pixels.

@peternlewis is saying it's not currently possible in KM so if anyone knows of any tools that do it then that'd be awesome. I'm first going to check ImageMagick


#5

All KM can do is return the coordinates of the found image, and/or click on it.
To find an image, you already have to have copy/paste into the KM Action image well.

So, what exactly do you want to do with the image?


#6

yes, I would like the coordinates of the image. I do already have an image - it just has a transparent background.

The image is a cursor inside a video stream. I don't care what's behind part of the cursor. I just want to know where the cursor is. Since it's in a video stream, I can't just use KM to get the cursor location.


#7

Found an ImageMagick solution: Find sub-image while ignoring transparent pixels

Now I just have to figure out how to speed it up. @peternlewis - how the heck is yours so fast!?!?