MATLAB: How to find the pixel co-ordinates in an image in order to find the colour properties like red_mean, blue_mean, etc at that pixel

blue_meancolor measurementImage Processing Toolboximage segmentationpixelpixel co-ordinatesred_meanregionprops

I want to find the pixel co-ordinates of an image containing nuclei of cells. I implemented the following commands:
conn_c = bwconncomp(tneg_bwLabel);
PixelListTo = regionprops(conn_c,'PixelList');
I received a struct that has a pixel list. How do I find the red mean, blue mean, gray mean and standard deviation at these particular pixel co-ordinates that I have received in the pixel list?
Also, I am getting values like 29 x 1 double in PixelList. Could you help me understand how to find co-ordinates using these values?

Best Answer

You don't need to get the pixel locations of every pixel in the blobs. You just pass in the labeled image itself and ask regionprops for the MeanIntensity. Try this:
% Extract the individual red, green, and blue color channels.
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
% Now find the mean intensities for each blob identified by the labeled image.
propsRed = regionprops(tneg_bwLabel, redChannel, 'MeanIntensity');
propsGreen = regionprops(tneg_bwLabel, greenChannel, 'MeanIntensity');
propsBlue = regionprops(tneg_bwLabel, blueChannel, 'MeanIntensity');