by frank26080115 » Tue Oct 09, 2007 9:26 pm
if i can calculate the RGB values for each pixel using the microcontroller, i will take the red for each pixel, and if it is significantly different from any of the adjacent pixels, it is tagged as an edge. do the same again for green and blue.
after all the edge pixels are found, i'd pretend it was minesweeper, scan the image for the first non-edge pixel, remember it's position as the top edge depending on my scanning order, and remember i've already gone through that pixel. i'd then check the adjacent pixels to see if the solid mass connects, if it doesn't it is ignored for now because it belongs to another edge, if it does connect it is marked as already scanned, the last one scanned will be marked as the bottom. Then quickly scan the vertical colums from the left and find the left edge at the first encountered "already been counted" pixel, do the same from the right.
now you have the position of that object, now turn 4 bit shade value into 2 bits and add them all up, now you will have a rough average, which then you either report to the user, or process that even further by getting the ratios between the colours, if red is significantly more by percentage, then the object is red, etc
now that area has been marked old, mark them all again as edge and repeat the above algorithum
resolution can be reduced in order to increase processing speed and more useful data
all any body wants to know is where it is, how big is it, and what colour, all roughly, it's already a low resolution