Found Images Feature Request

Is it possible to add "middle most" "2nd most left" "3rd most left" etc?

I have a really elegant image rec macro programmed to finally control curves in Resolve.

Please @peternlewis? :smiley:

Hey Ernest,

I can't speak for Peter, but I can pretty much predict what he'll say here:

"Keyboard Maestro can already do that – you just have to process the output of the Found Images Collection."

:sunglasses:

-Chris

1 Like

@ccstone

Thank for the response. Could you explain a little more. As far as I know this is all it can find, from the wiki:

β€œYou can order the matches by best matches first, top to bottom or left to right.β€œ

The Found Images collection lists all the locations that the image matches on the screen (v7.0+).

You can order the matches by best matches first, top to bottom or left to right.

The result, stored in the For Each action variable is the rectangle containing the match followed by the fuzz of the match (0-100), ie, (left,top,width,height,fuzz).

Right. The collection works through all of the found images in order in the direction you've selected and returns a text record with the following fields:

(left,top,width,height,fuzz)

You can either operate in the loop – say when a counter equals 2 you've gotten to the 2nd image, etcetera.

Or you can save the entire list of found images to a variable and parse that to your heart's content.

Clear as mud? :sunglasses:

Try out the appended macro, so you can see for yourself what this looks like.

  • I'm using a capture from a Finder window – you MUST provide your own capture.
  • I'm creating a simple vertical text list, although in practice I'd probably turn that into an array – so I could address it with numerical array notation.

Found Images Collection Example v1.00.kmmacros (26 KB)

Macro Image

Keyboard Maestro Export

1 Like

@ccstone, ok, I think I get it. This Macro will find every instance of an image, and make a list of each image and it’s location? Is image instance location screen coordinates captured?

I don’t see how I then can select one instance in the list.

Thanks so much!!!!

1 Like

That's pretty simple if not exactly straightforward – use a counter in a loop – either the original loop that gets the image frames, or a second loop that loops through lines-in-a-collection.

However – Keyboard Maestro has a nice little cheat – using the proper sort of delimiter you can talk to your text as an array.

Run this and look at the result (remember to replace the image):

Found Images Collection Example v1.01.kmmacros (28 KB)

Macro Image

Keyboard Maestro Export

  • I've turned list of linefeed separated lines into an array separated by the delimiter β€œ|” (vertical bar).
    • By doing that we can now talk to the array using array notation.
%Variable%local_ImageFrameList[0]%		== Length of array.
%Variable%local_ImageFrameList[1]%		== Item 1 of array.
%Variable%local_ImageFrameList[-1]%		== Item -1 of array (from the right).
%Variable%local_ImageFrameList%			== Entire array.

So now you can easily designate a numerical offset up or down, left or right.

1 Like

Good PST morning @ccstone,

Thanks so much! I see both Macros correctly identify and tag each instance of the image. Do you have a sample of a loop that would then select one of the items listed in the array? So I guess it would be a macro for each offset. Select first item, select second item, select third, etc.

These are the GUI controls I'm trying to select. So it's the white dots:

Hello @ccstone, @peternlewis, @Volpila,

Just confirming there is no find next. So there isn't a way to find next through these white dots?

The topic you were in involves find next in the Keyboard Maestro Editor and has nothing to do with found images.

No – there is no neat find next feature available for found images – and really how could there be? There are too many variables.

I'll take a closer look at this in a bit...

Hey Ernest,

I don't mess with found images too much, so this was a bit of a challenge...

At the top of the macro you can enter a number for the image you want to select.

  • local_ImageNumber

I'm using the image you posted to the forum for testing, and I've gotten things to work for both the unselected dots and the selected dot by upping the fuzz-factor quite high.

-Chris


Found Images Collection Example v1.00 copy.kmmacros (51 KB)

Macro Image

Keyboard Maestro Export

@ccstone dude you're like a wizard. It took me half a day to sample the right image to get my macro to select a white dot no matter what color was behind it. It's a specific shade of green. Even desat wouldn't work.

I've enabled all the actions in your Macro and ran it. It selects the left most full white dot. I have two macros already built that will select the left most dot and the right most dot. This works fine for most of my operations in Curves. Most Curves have three dots. One selected and two unselected. When dealing with more complicated Curves with multiple unselected dots, I would like one button for each dot.

One button would select the left most, Another button would select the 2nd most left, another would select the Center dot, etc.

Thank you Merlin!

I've attached my macro
DR_CONTROL_POINT_RIGHT.kmmacros (8.4 KB)
DR_CONTROL_POINT_LEFT.kmmacros (8.4 KB)

All you have to do is tell my macro which dot you want to select.

1, 2, 3... Selects from the left.

…-3, -2, -1 Selects from the right.

You can calculate if necessary by getting the length of the array.

Zero returns the length of the array in a text variable:

%Variable%local_ImageFrameList[0]|%

That should take you pretty far.

1 Like

@ccstone what do you mean this macro gets me pretty far!?!

IT GETS ME ALL THE WAY THERE!!!!!!!!!!!

How long did this take you? Do you have a tip jar or something?

You have no idea how cool this for what I do!!!!!!!!

3 Likes

I'm not sure. I wasn't keeping track of my time yesterday and worked on a number of projects.

Since I had to learn how do this on the fly (mostly) it took me longer than usual, so I think at least a couple of hours.

Do you have a tip jar or something?

Not formally, but I'll DM you.

2 Likes