Isolating a pixel pattern in an image
briany at qldlearning.com
Tue Jul 31 18:54:02 CDT 2007
You'll probably want to search through the imageData of the image.
ImageData is a row-by-row format, so I would do something like:
1) Search for a row with one white pixel
2) Check that the following row *also* has one white pixel in the
3) Check that the following row has three pixels in a row white --
and the middle is in the column from #1 and #2
4) Check for two more rows with one white pixel in the proper column
5) The center of the plus sign is the middle white pixel from #3
If you aren't familiar with manipulating imageData, there are a fair
number of examples in the list archives. I believe Ken Ray also has a
nice tutorial up on his site. In a nutshell, you'll be reading one
pixel at a time - and each pixel is represented by 4 characters
(alpha, red, green, blue). For your example, you'll be searching for
white pixels (0, 255, 255, 255) amongst many black pixels (0, 0, 0, 0).
Hope that points you in the right direction.
> I have a small handler I am trying to chart out and I am stumped as
> to even how to begin, or if it is even feasible in Rev.
> In simplified terms: suppose I have a gif, all black except for
> one or more plus symbols that are white. The plus symbol's
> horizontal stroke being three pixels wide by one high, and the
> vertical three pixels high by one wide.
> How could I go about determining the x and y location of the plus
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
More information about the use-livecode