How to create histograms for L a b channels separately in CIELAB color space.
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
senthil vadivu
el 24 de Nov. de 2016
How to create histograms for L a b channels separately in CIELAB color space.
0 comentarios
Respuesta aceptada
Image Analyst
el 24 de Nov. de 2016
Editada: Image Analyst
el 7 de Mayo de 2024
Try this:
rgbImage = imread('peppers.png'); % Read in example image shipped with MATLAB
labImage = rgb2lab(rgbImage);
[LImage, AImage, BImage] = imsplit(labImage);
Then call histogram on each image.
figure;
subplot(4, 2, 1);
imshow(rgbImage);
title('Original RGB image')
subplot(4, 2, 3);
imshow(LImage, []);
title('L Image')
subplot(4, 2, 4);
histogram(LImage);
title('Histogram of L image');
subplot(4, 2, 5);
imshow(AImage, []);
title('A Image')
subplot(4, 2, 6);
histogram(AImage);
title('Histogram of A image');
subplot(4, 2, 7);
imshow(BImage, []);
title('B Image')
subplot(4, 2, 8);
histogram(BImage);
title('Histogram of B image');
Or see my attached demo and adapt it to LAB color space.
0 comentarios
Más respuestas (1)
DGM
el 7 de Mayo de 2024
Editada: DGM
el 24 de Mayo de 2024
Let's actually plot some histograms. I'm using fixed xlimits so that the histograms are presented consistently between images and it's readily apparent where the chroma distribution is in relative terms. The limits I chose are wider than the gamut of sRGB as projected into LAB using the applied transformation parameters buried in rgb2lab(), though I've made no effort to mark those extents. I just wanted the neutral axis to be centered.
inpict = imread('peppers.png');
labpict = rgb2lab(inpict);
limits = [0 100; -108 108; -108 108]; % oversize and symmetric
for c = 1:3
subplot(3,1,c)
histogram(labpict(:,:,c));
% use fixed limits so that presentation is consistent
xlim(limits(c,:))
end
MIMT now has a tool to do this.
% an RGB image
inpict = imread('peppers.png');
% use defaults
cshist(inpict,'lab');
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1703146/image.png)
% use a filled patch instead of the default bar plot
cshist(inpict,'lab','style','patch');
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1703151/image.png)
% or use a stem plot like imhist()
cshist(inpict,'lab','style','stem');
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1703156/image.png)
See also:
0 comentarios
Ver también
Categorías
Más información sobre Histograms en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!