how to convert the binarized image to the original gray image
10 次查看(过去 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!