Difference in im2bw and imbinarize function while display the binary image

5 ビュー (過去 30 日間)
Kavita
Kavita 2019 年 7 月 9 日
コメント済み: Kavita 2019 年 7 月 18 日
BW=im2bw(I);
subplot(1,1,1), imshow(BW), title('BINARY')
I am getting the binary image as output when i run the above code but the same thing if i use imbinarize function than display the BW than i am getting the x & y axis plot. why is this ?
am using Matlab R2018a version tool.

採用された回答

Vinai Datta Thatiparthi
Vinai Datta Thatiparthi 2019 年 7 月 16 日
Hey Kavita!
From your question, I understand that you are using the commands ‘im2bw’ and ‘imbinarize’ to threshold an RGB color image. You are able to get the expected output from the ‘im2bw’ command, but you are not able to get the expected output when using ‘imbinarize’.
For both these commands, the acceptable input is a grayscale 2-D image. If you feed in an RGB color image directly into ‘imbinarize’, it will consider it as a 3-D volume instead and throw an error since you are trying to display a 3-D logical value. Hence, the displayed output will simply be an X-Y axis, followed by an error in MATLAB. However, when you use an RGB color image as input for ‘im2bw’, the image is automatically converted to grayscale before thresholding. So, no error will be thrown and you get the expected output.
If you wish to binarize an RGB color image, please use the ‘Color Thresholder’ app in MATLAB. You can find relevant documentation about the 'Color Thresholder' app here.
  1 件のコメント
Kavita
Kavita 2019 年 7 月 18 日
@Vinai Datta Thatiparthi : Thanks for your reply in helping me understand the basics.

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by