How to get Color Histogram of an Image

Hello everyone,I want to get Color Histogram from a image.What is the Code to get color histogram.what is the difference between HISTOGRAM and COLOR HISTOGRAM.How to show it on screen.

 Réponse acceptée

Mehdi Saberioon
Mehdi Saberioon le 5 Mar 2015
Modifié(e) : Mehdi Saberioon le 5 Mar 2015
Histogram is displaying the distribution of data. Color histogram shows distribution for each band.
%Split into RGB Channels
Red = image(:,:,1);
Green = image(:,:,2);
Blue = image(:,:,3);
%Get histValues for each channel
[yRed, x] = imhist(Red);
[yGreen, x] = imhist(Green);
[yBlue, x] = imhist(Blue);
%Plot them together in one plot
plot(x, yRed, 'Red', x, yGreen, 'Green', x, yBlue, 'Blue');

4 commentaires

sarah ismail
sarah ismail le 14 Sep 2017
will this work if I have 1000 images to display ? thank you
Image Analyst
Image Analyst le 14 Sep 2017
Yes
teja jayavarapu
teja jayavarapu le 13 Jan 2018
How to find the bin count in hsv color space
yara anitha
yara anitha le 13 Mai 2020
can anyone expain the output?

Connectez-vous pour commenter.

Plus de réponses (3)

teja jayavarapu
teja jayavarapu le 13 Jan 2018

0 votes

I have quantized hsv into 8×3×3 combinations,so I want to find what is number of pixels per each bin how do I do it

1 commentaire

Image Analyst
Image Analyst le 13 Jan 2018
It's the value of the histogram that you say you've created.

Connectez-vous pour commenter.

mariena aloor
mariena aloor le 22 Oct 2018

0 votes

Sir i want to apply moving average filter to the individual color histogram planes
Abcd efgh
Abcd efgh le 23 Avr 2021

0 votes

Please refer this tutorial--
Hope this will be helpful.
Happy Learning :-)

Community Treasure Hunt

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

Start Hunting!

Translated by