Histogram
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
please tell me the way to display histogram of colored image? thanks
0 comentarios
Respuestas (2)
Walter Roberson
el 16 de Mzo. de 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 comentarios
Leepakshi
el 3 de Jun. de 2025
Editada: Leepakshi
el 3 de Jun. de 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 comentarios
Ver también
Categorías
Más información sobre Histograms en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!