how to analyse this image??
3 views (last 30 days)
Show older comments
I have this image. I want to find the percentage value of red colour of pixel. What I know is that first I need to separate the image into red, green, and blue. next find the threshold of each image. then what i want is that for the red image, the red colour become black and other become white. this is same as for blue and green. Now, what i don't know is to find the threshold value so that i can change the red colour to black? Can anyone help me?? Thank you
0 Comments
Answers (2)
Walter Roberson
on 6 May 2015
No, we cannot. Your problem is definitional. What does it mean to you for a pixel to be "red" ?
When you read in images, usually the result is integer values from 0 to 255, for each of the three RGB planes. Clearly (0,0,0) would be "black", by definition, and clearly (255,255,255) would be "white", by definition. But how about (1,0,0) ? Is that "dark red" or is it "sensor quantization error" on (0,0,0) black?
Are there perhaps systematic limitations in the image processing (reflected light for example) such that what you "know" to be "black" might come out non-zero? If you are using an illuminating source, then is it pure white? Really ?? What is its color temperature ?
You could do repeated tests with a "black" sample with no features, or tests with the lens cap on, in order to estimate the sensor quantization error. Or if you are lucky enough to be using a scientific instrument it might even be in the documentation. We cannot tell you "anything up to 11 might be noise" because we don't know your equipment: it is an experimental parameter for your particular setup, rather than a theoretical parameter.
When it comes to distinguishing between colors, you need to keep in mind quantization errors, and you need to keep in mind illumination differences (it is much more typical for illumination to not be completely uniform.)
I can see from your sample image that portions to the left are "blue green", so if you are wanting to determine features, it would be a mistake to look only at one color plane at a time. On the other hand, it looks like possibly the green regions might represent a slightly "higher" area within the lighter blue, so I cannot immediately rule out the value of looking at the different planes.
What might interest you is to convert your image to HSV and then classify the regions according to Hue.
0 Comments
Image Analyst
on 7 May 2015
nurul:
Regarding that other discussion I had here: http://www.mathworks.com/matlabcentral/answers/214737-insignificant-changes-in-mean-value-of-rgb-for-different-images-with-contrary-color#comment_282649 with suhaini, can you explain why you both posted virtually the same question and images? Is this homework? Are you colleagues working at a fishery? How do two different people happen to have the same images?
4 Comments
Image Analyst
on 7 May 2015
I have 3 color segmentation methods uploaded to my File Exchange: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862. Try one, such as the HSV one. The only tricky part is that reddish colors have hues that are both less than about .1 and more than about .9. But it looks like you're on the right track with nonRedIndex. That should show the red area as black and non-red as white.
See my updated thresholding app in my file exchange to do thresholding.
Image Analyst
on 7 May 2015
totalPixels = numel(sPlane);
redAreaFraction = (totalPixels - sum(nonRedIndex(:))/totalPixels;
See Also
Categories
Find more on Convert Image Type in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!