Speeding up ImageSearch?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
SOBETed
Posts: 15
Joined: 03 May 2018, 12:40

Speeding up ImageSearch?

Post by SOBETed » 03 May 2018, 12:53

Hi, Community.

I use ImageSearch a lot to automate tasks on my desktop, and I recently wrote a script to play a card game. The player is dealt 5 cards, so I run a loop of 52 ImageSearch commands to recognize the first card, then another loop of 52 to recognize the 2nd...the 3rd...4th...and 5th.

The method works fine, but it takes a little time to run through 260 ImageSearch commands. Is there a way to speed up the process?

Thanks!





Ex.

Loop
{

ImageSearch,FoundX, FoundY, 671, 1030, 764, 1122, C:\Users\Me\Desktop\CardFolder\AceSpades.png
If errorlevel=0
{
break
}

ImageSearch,FoundX, FoundY, 671, 1030, 764, 1122, C:\Users\Me\Desktop\CardFolder\KingSpades.png
If errorlevel=0
{
break
}

.......

.....

}

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Speeding up ImageSearch?

Post by swagfag » 03 May 2018, 15:00

SOBETed wrote:260 ImageSearch commands
just lol :shock: :lolno:

this doesnt sound like a task for image search at all. cant u identify the cards by a pixel? post an image of a couple of them. then u could use pixelsearching

as for how to speed up image search in no particular order:
scan a smaller area
look for a smaller image
break up ur search space in chunks and parallelize the task(not always applicable)
parallelize the task itself(ie 1 thread per card)

Post Reply

Return to “Ask for Help (v1)”