Histogram
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
please tell me the way to display histogram of colored image? thanks
0 commentaires
Réponses (2)
Walter Roberson
le 16 Mar 2011
In order to display a histogram of something, there has to be a measurable property that can be quantized. Unfortunately, color images have multiple measurable properties that can be quantized, so you are going to have to figure out which property you want to construct the histogram of.
Is this, by the way, one of those questions where you have to construct 72 or 144 bins based upon the HSV values?
0 commentaires
Leepakshi
le 3 Juin 2025
Modifié(e) : Leepakshi
le 3 Juin 2025
Hi Muhammad,
To display the histogram of a colored image in MATLAB, plot separate histograms for each color channel (Red, Green, and Blue).
Refer to following example:
img = imread('sampleImage.jpg');
redChannel = img(:,:,1);
greenChannel = img(:,:,2);
blueChannel = img(:,:,3);
figure;
hold on;
histogram(redChannel(:), 256, 'FaceColor', 'r', 'EdgeColor', 'r');
histogram(greenChannel(:), 256, 'FaceColor', 'g', 'EdgeColor', 'g');
histogram(blueChannel(:), 256, 'FaceColor', 'b', 'EdgeColor', 'b');
hold off;
This code extracts each color channel from the RGB image and plots their histograms overlaid in red, green, and blue colors, showing the distribution of pixel intensities for each channel separately.
Hope this helps!
Thanks
0 commentaires
Voir également
Catégories
En savoir plus sur Histograms dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!