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.
댓글 수: 0
채택된 답변
Walter Roberson
2016년 5월 21일
You probably want
maskedImage = binaryImage .* originalImage;
댓글 수: 3
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
추가 답변 (1개)
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 Center 및 File Exchange에서 Modify Image Colors에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!