how to convert the binarized image to the original gray image

2 ビュー (過去 30 日間)
Khaing Zin Htwe
Khaing Zin Htwe 2016 年 5 月 20 日
コメント済み: Emerson Nithiyaraj 2019 年 5 月 20 日
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 Center および File ExchangeModify Image Colors についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by