Jump to content

PixelSearch count?


Recommended Posts

When I use PixelSearch it returns me the first match, however I need to check all matches in a specific area. Is there any way to add a count (eg. when count is 2 it returns the second match) so I can make a loop?

Link to comment
Share on other sites

When I use PixelSearch it returns me the first match, however I need to check all matches in a specific area. Is there any way to add a count (eg. when count is 2 it returns the second match) so I can make a loop?

You need to use PixelGetColor in a loop to check every pixel.

The example below will check every pixel within a 50 x 50 square. If you test a large it won't be very fast.

$TestColour = Dec("FF0000")
For $i = 250 To 300
    For $j = 450 To 500
        If $Colour =  PixelGetColor( $i , $j ) Then
            ;Do what you need to do or save the coords to an array
        EndIf
    Next
Next

"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

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...