Histogram
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
please tell me the way to display histogram of colored image? thanks
0 Kommentare
Antworten (2)
Walter Roberson
am 16 Mär. 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 Kommentare
Leepakshi
am 3 Jun. 2025
Bearbeitet: Leepakshi
am 3 Jun. 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 Kommentare
Siehe auch
Kategorien
Mehr zu Histograms finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!