Display L*A*B space channels separately
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Stephani Kanga
le 1 Déc 2021
Réponse apportée : Image Analyst
le 1 Déc 2021
I want to display the component images of a true colour image in L*A*B space. Although, i don't want to show them all as grayscale images. I want the L* image to show the brightness(so this is going to be a grayscale image) and a* and b* images should show the corresponding hues.
0 commentaires
Réponse acceptée
DGM
le 1 Déc 2021
Modifié(e) : DGM
le 1 Déc 2021
Lemme try that again...
RGB = imread('peppers.png');
[L A B] = imsplit(rgb2lab(RGB));
Lfill = 50*ones(size(L)); % pick some L level for representing A,B
Zfill = zeros(size(L));
Lvis = mat2gray(L);
Avis = lab2rgb(cat(3,Lfill,A,Zfill));
Bvis = lab2rgb(cat(3,Lfill,Zfill,B));
figure; imshow(Lvis)
figure; imshow(Avis)
figure; imshow(Bvis)
Plus de réponses (1)
Image Analyst
le 1 Déc 2021
Try this:
rgbImage = imread('peppers.png');
imshow(rgbImage);
labImage = rgb2lab(rgbImage);
[lImage, aImage, bImage] = imsplit(labImage);
% Show the L channel
subplot(3, 1, 1);
imshow(lImage, []);
impixelinfo;
title('L image')
% Create red to green colormap.
ramp = linspace(0, 1, 256)';
z = zeros(size(ramp))
colormapRG = [ramp, flipud(ramp), z];
% Create blue to yellow colormap.
colormapBY = [ramp, ramp, flipud(ramp)];
% Show the A channel
subplot(3, 1, 2);
imshow(aImage, 'Colormap',colormapRG);
impixelinfo;
caxis([-128, 127]);
title('A image')
% Show the B channel
subplot(3, 1, 3);
imshow(bImage, 'Colormap',colormapBY);
impixelinfo;
caxis([-128, 127]);
title('B image')
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/820235/image.png)
0 commentaires
Voir également
Catégories
En savoir plus sur Red 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!