binary image to RGB image

조회 수: 4 (최근 30일)
marlina
marlina 2011년 8월 5일
댓글: Image Analyst 2020년 7월 20일
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