how to analyse this image??

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

Respuestas (2)

Walter Roberson
Walter Roberson el 6 de Mayo de 2015

0 votos

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.
Image Analyst
Image Analyst el 7 de Mayo de 2015

0 votos

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 comentarios

nurul hafizah
nurul hafizah el 7 de Mayo de 2015
We are friend. this is our project but we using different parameters to study.
Hello I'm suhaini,nurul friend.here is the image after we convert it into HSV and seperate the red color from the rest.
cdata=imread('matlabanswer1crop.jpg');
hsvImage = rgb2hsv(cdata); %# Convert the image to HSV space
%Resize the image because the original image is too big.
%cdata_resize=imresize(hsvImage,0.25);
%figure(1), imshow(cdata_resize), title('HSVImage');
set(gcf, 'Position', get(0, 'ScreenSize'));
hPlane = 360.*hsvImage(:,:,1); %# Get the hue plane scaled from 0 to 360
sPlane = hsvImage(:,:,2); %# Get the saturation plane
nonRedIndex = (hPlane > 20) & ... %# Select "non-red" pixels
(hPlane < 325);
sPlane(nonRedIndex) = 0; %# Set the selected pixel saturations to 0
hsvImage(:,:,2) = sPlane; %# Update the saturation plane
rgbImage = hsv2rgb(hsvImage); %# Convert the image back to RGB space
figure(2),imshow(rgbImage)
.from this image,is it possible to convert red area to black and the rest to white,so that we can calculate the percentage of red area.Plus, how to find threshold value of the image..
Image Analyst
Image Analyst el 7 de Mayo de 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
Image Analyst el 7 de Mayo de 2015
totalPixels = numel(sPlane);
redAreaFraction = (totalPixels - sum(nonRedIndex(:))/totalPixels;

Iniciar sesión para comentar.

Categorías

Preguntada:

el 6 de Mayo de 2015

Comentada:

el 7 de Mayo de 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by