Sign in to follow this  
Followers 0
oinkl

Optimal PixelSearch Strategy

2 posts in this topic

#1 ·  Posted (edited)

Description

I'm trying to detect a circle moving across the screen at a moderate rate.

It would take about 8-10 seconds to move horizontally across my 1024x768 monitor.

The circle can be contained in a 10px by 10px square

The circle is generally of a bluish hue.

The circle contains the colour 0x0000FF at a specific spot within the circle(3, 3)

The background is non static and can be any colour.

When the circle is found at specific spot, press {Enter}.

Problem

The circle never stops consistently at the same spot.

Sometimes it's off by half a circle(5px), sometimes it's off by a whole circle(10px)

I'm trying to get the circle to stop at a precise location(with maybe 1-2px error)

I've tried pixelsearch variations of the following:

AutoItSetOption ("SendKeyDelay", 0)
AutoItSetOption ("SendKeyDownDelay", 100)
Dim $time = 5 ; I've tried varying this variable between 1 and 100
PixelSearch(90, 90, 100, 100, 0x0000FF, 5)     ;Inconsistent
;PixelSearch(90, 90, 100, 100, 0x0000FF, 5, 2) ;Inconsistent
;PixelSearch(90, 90, 100, 100, 0x0000FF)        ;Misses detection ~50% of the time
;PixelSearch(93, 93, 93, 93, 0x0000FF)          ;Misses detection ~95% of the time
While @error
    PixelSearch(90, 90, 100, 100, 0x0000FF, 5)
    Sleep($time)
WEnd
Send("{Enter}")

Question

What would be an optimal way to search for a moving pixel with consistent timings?

Is there a better way to detect the circle?

Edited by oinkl

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