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)??
댓글 수: 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!