Jump to content

Pixel searching a shape?


Recommended Posts

I've searched the forum a bit and I was wondering if anyone had a function or method to search for a shape or something similar.

Lets say I wanted to search for shape "X" on the screen. Now regular pixelsearch will supposedly return the topleft-most pixel, and I might be able to do

$pix = PixelSearch(blahblahblah)

$pix2 = pixelgetcolor($pix[0] + 1, $pix[1] + 1, etc)

Which would just search for certain pixels after the initial return, but I was wondering if anyone had anything more advanced. Example of what I'm looking for:

shapesearch(first pixel with color, second pixel proportioned to first pixel, 3rd, etc, etc, till I feel like finishing)

I was thinking of coding this myself and tried a few times but I don't know how to make optional parameters. (Yes I've looked at the help file)

The closest thing I've seen to this is _PixelSearchAdvanced but I couldn't understand how to use it to suit my needs.

Thanks for the help.

Link to comment
Share on other sites

If you know the size of the shape then it is just a matter of doing tests for specific points. Take a square for example. You find the upper left corner then just test for the same color at the other 3 points (even more if you want for accuracy).

The function _PixelSearchAdvanced I made will return every pixel for a color in an area so you could use it to just test against what is returned.

If you do not know the size of the shape then it could be harder. Take the same square example. Since you do not know how big or small it could be you would have to test a lot more pixels to determine if it is a square.

Kohr

Edited by Kohr
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...