I have some circles located in an image
, I could find the location for each circle (diameter and origin or centre), so first of all how could I check all pixels inside that circle (I'm thinking of for loop). second how could I ask if pixel color in nearly gray?
At first I thought of asking if Red, Green and Blue values are higher than 125 But that doesn't work. For example: (200,130,170) is for sure not a gray color!
If you want to check whether a point is within a circle, use pythagoras..
Math.sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2))
..to work out how far the point (x1,y1) is from the center (x2,y2) of the circle. If the value you calculate is less than the radius of the circle, the point is in the circle. This can be optimised slightly by removing the sqrt, and testing if the result is less than the square of the radius
Anything is nearly gray if the RGB are nearly the same. 64,64,64 = dark grey, 72,64,64 = slightly red looking dark grey. You'll have to define what "nearly" means