MATLAB Answers

How to get mode values of RGB to represent one image

13 views (last 30 days)
Hello
I got the sub-images and I tried to find a proper way to extract RGB from those images and I used mean value for each color ( redChannel = subImk(:,:,1); meanR = mean(redChannel(:));) and it's great for perfect image. Anyway, some images have shadow, grains or some undetermined artifacts that still remaining from segmentation step (attached image) and these effect a lot in getting mean RGB representatives.
Now, I think that getting mode (most frequent R,G,B value in sub-image) might be the better way because the images are quite constant. However, I do not know how to code it in efficient way. Can anyone please help me how to write to find a proper mode in sub-image? and if you have a better idea to get RGB, please say it.
Thanks in advance :)

Accepted Answer

Image Analyst
Image Analyst on 27 Feb 2021
Explain exactly what "extract RGB from those images" means to you. Because to get the individual color channels (R, G, and B) from the images, you'd use imsplit():
[R, G, B] = imsplit(rgbImage);
I don't see what messing with the means and modes adds. imsplit() will extract the R, G, and B from an RGB image without worrying about (computing) means and modes.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by