How to compute the RGB Pixel frequency that represents the colour in whole channels.

2 次查看(过去 30 天)
Hello Matlab experts,
To compute pixels frequency on RGB image, we usually use histogram on each individual channel. Here my question is how to compute the pixel colour occurrence that represent the color itself. For example, how to compute how many occurrence for the Red pixel (255,15,20).
I know how to do it by counting using 3 for loops, but my idea is very complicated and would like to know if there is more efficient way.

采纳的回答

Image Analyst
Image Analyst 2013-11-8
You need to do the full 3D histogram as you were thinking. Because a red that is (255,15,20) is a different color than the red that is (255,15,21). It's not complicated at all. In the spectrum from simple to complicated for MATLAB coding, this would be way, way, way towards the simple end. Doesn't even come close to "very complicated" or even a little bit complicated. I attach my color gamut visualizer below in case you want to see how I did it. Of course you can use fewer bins if you want a histogram that's smaller than 16.7 million colors. For example, you can quantize to 32x32x32 if you want.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by