binary image to RGB image

4 次查看(过去 30 天)
Hi all,
I would like to know how to convert binary image to RGB. Let say, I want WHITE become RED and BLACK become GREEN. Anyone can help me please...really need any suggestion.
Thank you

采纳的回答

Walter Roberson
Walter Roberson 2011-8-5
RGBIMG = cat(3, IMG, ~IMG, zeros(size(IMG)));
  3 个评论
Srivatsan N
Srivatsan N 2020-7-20
I am getting error when I try to display that image using imshow function.Can anyone help me out with this?.
Image Analyst
Image Analyst 2020-7-20
Sure, just tell us what the error is
mask = false(480, 640);
mask(100:200, 150:450) = true;
subplot(2, 1, 1);
imshow(mask);
rgbImage = cat(3, mask, ~mask, zeros(size(mask)));
subplot(2, 1, 2);
imshow(rgbImage);

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by