part color part black and white
조회 수: 3 (최근 30일)
이전 댓글 표시
I have a grayscale image. I want to change some pixels to colored pixels. How do I do that? thanks
댓글 수: 1
채택된 답변
Walter Roberson
2016년 10월 25일
You need to convert the grayscale to equivalent (gray-toned) RGB image, after which you can add color to the image.
newRGBimage = YourGrayImage(:,:,[1 1 1]); %a fast way of copying the image to three color planes
newRGBimage(:,[1 end], 1) = 255; %draw a red left and right border
댓글 수: 2
Walter Roberson
2016년 10월 25일
Small correction:
newRGBimage(:,[1 end], 1) = 255; %draw a red left and right border
newRGBimage(:,[1 end], 2:3) = 0;
If your image is double instead of uint8 then change the 255 to 1.0
추가 답변 (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!