how to convert the binarized image to the original gray image

조회 수: 2 (최근 30일)
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.

채택된 답변

Walter Roberson
Walter Roberson 2016년 5월 21일
You probably want
maskedImage = binaryImage .* originalImage;
  댓글 수: 3
Image Analyst
Image Analyst 2016년 5월 22일
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 2019년 5월 20일
thank you..This works for me

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Image Analyst
Image Analyst 2016년 5월 21일
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.

카테고리

Help CenterFile Exchange에서 Modify Image Colors에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by