part color part black and white

4 次查看(过去 30 天)
I have a grayscale image. I want to change some pixels to colored pixels. How do I do that? thanks
  1 个评论
Chaya N
Chaya N 2016-10-25
编辑:Chaya N 2016-10-25
What kind of changes were you seeking to do?
Did you want to color certain areas of your image? or did you want to simply draw colored outlines around these areas?
An attached image and a few details by way of explanation would be most useful here!

请先登录,再进行评论。

采纳的回答

Walter Roberson
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 个评论
Douglas Brenner
Douglas Brenner 2016-10-25
I have to parse what you did but it worked once I converted my image to uint8. Thanks.
Walter Roberson
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 CenterFile Exchange 中查找有关 Convert Image Type 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by