Get the position of pixels with specifed color
1 view (last 30 days)
Show older comments
Hi! I have a problem.I have a picture with two circle in it.A red and a green.I want to get the postion of their centers and connecting them and how can I get the position of all red pixel in that picture.Please help me and thanks a lot
0 Comments
Accepted Answer
Walter Roberson
on 19 Apr 2011
I answered about finding the positions a moment ago in response to your earlier post.
For the matter of finding all the red pixel in an image, first you have to define what "red" means. If a pixel has red turned on as high as it can go also happens to have blue turned on to (say) 1/10th of the maximum, then is that pixel still "red" ? If so, then how far could the intensity of the red component be reduced and you would still deem the pixel to be "red" instead of "purple" ?
3 Comments
Walter Roberson
on 20 Apr 2011
Start with something that is pure red. Mix more and more white in by increase the G and B. With G and B at their lowest non-zero settings, pretty much everyone would agree that the color was still "red". Okay, now bump up the G and B to make it a lighter red. At some point it starts to look pink-ish but you might still identify it as red. Keep pushing up the G and B until you get something that you say is no longer "red" but is instead "pink". How where _exactly_ is that boundary between "red" and "pink" ? And how would the boundary change if the original red was not 100% red but was (say) only 95% of the maximum strength of red? If it was 75%? 50%? 25% red to start with?
Red is not an absolute class: it is a fuzzy concept. You have to tell us exactly what *you* mean by red before we can tell you how to detect the "red" pixels apart from the ones that are (say) merely a mauvey shade of pinky-russet.
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!