Sign in to follow this  
Followers 0
=sinister=

Check Pixel Change with Tolerance

2 posts in this topic

So I have a script that uses PixelSearch to check 1 pixel and see if it has changed past a certain tolerance. However, this method is slow and unreliable, and I was wondering if there is somehow a way to check 1 pixel (with tolerance) to see if it has changed. Maybe like PixelCheckSum but with a tolerance parameter.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Something like this should work for you.

#Include <Color.au3>

$iTestColour = 0xAB1200
$iTolerance = 10
$var = PixelGetColor( 10 , 100 )
If (Abs(_ColorGetRed($var) - _ColorGetRed($iTestColour)) <=  $iTolerance) _ 
    And (Abs(_ColorGetBlue($var) - _ColorGetBlue($iTestColour)) <=  $iTolerance) _
    And (Abs(_ColorGetGreen($var) - _ColorGetGreen($iTestColour)) <=  $iTolerance) Then
    MsgBox(0,"The colour matches", Hex($var,6))
Else
    MsgBox(0,"The colour does not match", Hex($var,6))
EndIf
Edited by Bowmore

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

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