binary image to RGB image

4 visualizaciones (últimos 30 días)
marlina
marlina el 5 de Ag. de 2011
Comentada: Image Analyst el 20 de Jul. de 2020
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

Respuesta aceptada

Walter Roberson
Walter Roberson el 5 de Ag. de 2011
RGBIMG = cat(3, IMG, ~IMG, zeros(size(IMG)));
  3 comentarios
Srivatsan N
Srivatsan N el 20 de Jul. de 2020
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 el 20 de Jul. de 2020
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);

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Image Processing Toolbox en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by