Sign in to follow this  
Followers 0
blahblahblah5038

Fast Pixel Search

5 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



hi im tested your pixel search.. and the original PixelSearch that is in autoit is about twice as fast.. but i dont rly understand how your "circle" search works.. that thing might be the fast thing

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

I don't know why there would be a difference between our 2 computers, but on mine I get 1031 miliseconds for my dll and 4556 miliseconds for the pixel search.


Noteworthy works:Fast Pixel SearchSigned: WG

Share this post


Link to post
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
Sign in to follow this  
Followers 0