how to convert from grayscale to rgb by lightness method ??
2 ビュー (過去 30 日間)
古いコメントを表示
how to convert from grayscale to rgb by lightness (desaturation) method (matlab code)??
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/720099/image.png)
2 件のコメント
採用された回答
Turlough Hughes
2021 年 8 月 24 日
編集済み: Turlough Hughes
2021 年 8 月 24 日
You can do the following:
I=imread('peppers.png');
newImage = uint8(( double(min(I,[],3)) + double(max(I,[],3)) ) ./ 2);
imshow(newImage)
5 件のコメント
Turlough Hughes
2021 年 8 月 24 日
Thanks @Image Analyst. I should have converted to a datatype not capped at 255 in order to add the values. I've edited the answer with the correction.
Actually, one could also just do the following without converting datatypes:
I=imread('peppers.png');
newImage = min(I,[],3)./2 + max(I,[],3)./2;
imshow(newImage)
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Convert Image Type についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!