how to convert from grayscale to rgb by lightness method ??
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hanan Elsayed
am 24 Aug. 2021
Kommentiert: Hanan Elsayed
am 24 Aug. 2021
how to convert from grayscale to rgb by lightness (desaturation) method (matlab code)??

2 Kommentare
Akzeptierte Antwort
Turlough Hughes
am 24 Aug. 2021
Bearbeitet: Turlough Hughes
am 24 Aug. 2021
You can do the following:
I=imread('peppers.png');
newImage = uint8(( double(min(I,[],3)) + double(max(I,[],3)) ) ./ 2);
imshow(newImage)
5 Kommentare
Turlough Hughes
am 24 Aug. 2021
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)
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Convert Image Type finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!