Display an image processed in LAB channel

11 ビュー (過去 30 日間)
Quoc Anh Vu
Quoc Anh Vu 2023 年 8 月 29 日
コメント済み: Quoc Anh Vu 2023 年 8 月 30 日
I'm dealing with processing blood vessels image in LAB channels, first i Convert the image to LAB color space, then i applied Contrast Limited Adaptive Histogram Equalization (CLAHE) to L channel, finally i converted the enhanced LAB image back to RGB color space.
% Load an image
originalImage = imread('7roi.png');
% Convert the image to LAB color space
labImage = rgb2lab(originalImage);
labImage = im2double(labImage);
% Apply Contrast Limited Adaptive Histogram Equalization (CLAHE) to L channel
clabImage = labImage;
clabImage(:,:,1) = adapthisteq(labImage(:,:,1));
% Convert the enhanced LAB image back to RGB color space
enhancedRGBImage = lab2rgb(clabImage);
% Convert enhanced image back to the original data type
enhancedRGBImage = im2uint8(enhancedRGBImage);
figure
imshow(enhancedRGBImage);
Here is the original and the result image, is it normal or i have some mistake in my algorithm, please help, thank you so much.

採用された回答

DGM
DGM 2023 年 8 月 30 日
編集済み: DGM 2023 年 8 月 30 日
LAB images from rgb2lab() are not on the same scale expected of RGB images. You'll need to rescale the data appropriately if you want to feed it to something that isn't expecting that sort of range.
% Load an image
originalImage = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1467156/image.png');
% Convert the image to LAB color space
labImage = rgb2lab(originalImage);
% there's no need to convert to double when using lab2rgb()
% Apply Contrast Limited Adaptive Histogram Equalization (CLAHE) to L channel
% adapthisteq() expects floating point images to be in unit-scale (0 to 1)
% but this LAB representation is not unit-scale
clabImage = labImage;
clabImage(:,:,1) = adapthisteq(labImage(:,:,1)/100)*100; % rescale L as needed
% Convert the enhanced LAB image back to RGB color space
enhancedRGBImage = lab2rgb(clabImage);
% Convert enhanced image back to the original data type
enhancedRGBImage = im2uint8(enhancedRGBImage);
figure
imshow(enhancedRGBImage);
... or if you were using MIMT, you could do the whole thing in one line without worrying about scale or truncation:
enhancedRGBImage = histeqtool(originalImage,'ahisteqlchab');
  1 件のコメント
Quoc Anh Vu
Quoc Anh Vu 2023 年 8 月 30 日
thank you so much sir, it actually works.

サインインしてコメントする。

その他の回答 (1 件)

Image Analyst
Image Analyst 2023 年 8 月 29 日
The code looks right. The problem is that CLAHE is often not a good algorithm because it's non-linear. Try imadjust instead.
  1 件のコメント
Quoc Anh Vu
Quoc Anh Vu 2023 年 8 月 30 日
thank you, i've tried imadjust but the result is still the same. i'm afraid that the problem is not the processing step, maybe it's out of range of display. do you know how to fix it sir?

サインインしてコメントする。

製品


リリース

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by