how to convert from grayscale to rgb by lightness method ??
3 次查看(过去 30 天)
显示 更早的评论
how to convert from grayscale to rgb by lightness (desaturation) method (matlab code)??
采纳的回答
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!