Jump to content

Fast Pixel Search


Recommended Posts

I was recently created a fast pixel search for a program I am working on, and decided to make a more generic version that could be used by autoit users. Many thanks to Lazycat, november, and Richard Robertson for help provided in the making of this function. Especially Lazycat because his screen capture dll was the basis for the search dll.

To test the example, just place them all in the same folder and try example.au3. Note that you need to keep the dll with any programs you write, compiled or not.

Here it is:

Edit: use this version of the _FastSearch.au3, the dll had it's name changed when it was uploaded.

fast_pixel_search_dll.dll

example.au3

fast_pixel_search_dll.cpp

_fastSearch.au3

Edited by blahblahblah5038

Noteworthy works:Fast Pixel SearchSigned: WG

Link to comment
Share on other sites

My search has a longer initialization time (not good for small areas), but when searching a large area, it is about 4 times faster. see the attached example2.au3. use this one instead of the other one. the example contains a timer and displays a message box with the title as the time in miliseconds. Also use the attached dll, I made an error in the last one converting from my program to the generic one.

As for the circle search feature, if you specify the optional stepX, stepY, and then Radius, the dll file is sent a positive value for your radius (normally is sent -1). there is an if else statement that says if Radius = -1 then do a regular square search, but else do the same thing but include an if statement to determine if the point we are about to compare is within the search radius, if it is not, ignore it. it uses the basic equation for a circle :

Squareroot ((X-h)^2 + (Y-k) ^2) = radius

larger h and k values shift the circle in the positive direction, and because 0,0 for my circle is the upper left corner, then the circle's center is at (radius, radius), so that the circle's top and left sides just touch the search box's top and left sides

therefore the equation I use is: Squareroot ((X-radius)^2 + (Y-radius) ^2) = radius

example.au3

fast_pixel_search_dll.dll

Edited by blahblahblah5038

Noteworthy works:Fast Pixel SearchSigned: WG

Link to comment
Share on other sites

Hi. i dont know why it is.. but as i said the original one is still alot faster for me.. on this example you sent im still getting the PixelSearch 9 times faster then the _fastSearch..

im using AutoIt Version: 3.2.4.9

and i editet your include on line 32 from:

$storage = DllCall("fast_pixel_search_dll.dll", "int",

to:

$storage = DllCall("fast_pixel_search_dll.dll", "int:cdecl",

and i got a duel cure(oops i dont..forgot im on my laptop:P)

edit:

it take me ~990 ms on _fastSearch and ~120 ms on PixelSearch

Edited by Rizzet
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...