Borrar filtros
Borrar filtros

how to convert the binarized image to the original gray image

5 visualizaciones (últimos 30 días)
Dear all, Hello good morning,
Could you please share your experience how to convert the binarized image to the original image with gray vlaues? THank all.

Respuesta aceptada

Walter Roberson
Walter Roberson el 21 de Mayo de 2016
You probably want
maskedImage = binaryImage .* originalImage;
  3 comentarios
Image Analyst
Image Analyst el 22 de Mayo de 2016
For the future, this operation is called "masking", not "converting" of a binary image to a gray scale image. If original image is an integer, you need to cast binary image to the same class of integer, like
maskedImage = uint8(binaryImage) .* originalImage;
Or initialize and then use the binary image as indexes:
maskedImage = originalImage; % Initialize
maskedImage(~binaryImage) = 0; % Mask
Emerson Nithiyaraj
Emerson Nithiyaraj el 20 de Mayo de 2019
thank you..This works for me

Iniciar sesión para comentar.

Más respuestas (1)

Image Analyst
Image Analyst el 21 de Mayo de 2016
Try this:
binaryImage = grayImage;
Your (formerly) binary image will now be converted into the same array as your gray scale image, so it's now a gray scale image, not a binary image anymore.

Categorías

Más información sobre Modify Image Colors en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by