Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

AHK ImageSearch algorithm?


  • Please log in to reply
2 replies to this topic
kinnex
  • Members
  • 12 posts
  • Last active: Jan 09 2016 02:08 AM
  • Joined: 14 May 2009

I am curious how AHK performs the ImageSearch function.  I know there has been a lot of threads on GDIP image search, and I am not sure if AHK main has included that now, or if it does something else entirely.  (I'm not even sure what file the function would be found in, to take a look on github.)

 

I like AHK a lot, but am looking to tinker with something that has threading / OS agnostic, and there is PyAutoGUI, which looks interesting.  However, it uses the Knuth–Morris–Pratt algorithm for locating an image on screen], and the results are less than impressive.

 

Test Task:  find an 83x83 png image of the recycling bin on a 1920x1080 screen.

AHK_L:  0.07 to 1.20 seconds.

PyAutoGUI: 13 to 55 seconds.

 

Given the huge difference, I am really curious how AHK does it so fast.  I was certainly not expecting AHK to do this 13 to 50 times faster!



gregster
  • Members
  • 283 posts
  • Last active: Nov 09 2015 03:08 AM
  • Joined: 19 Mar 2009

I have no idea how it works, but it is open source. So, you could take a look at the C++ source of AHK, I guess... there is a link: http://ahkscript.org/download/



kinnex
  • Members
  • 12 posts
  • Last active: Jan 09 2016 02:08 AM
  • Joined: 14 May 2009

Thank you,  I did take a look there, but have no clue which of the many files it might be in.   Never really done any c/c++ program beyond extremly simple command line stuff.  I am hoping someone can point me to correct cpp or h file.