bwareaopen for RGB and binary

hi sir, can I know how to use bwareaopen for RGB image. after I convert the rgb image to binary, do I need to put uint8 and [] when displaying the binary images?
[Merged information from duplicate question]
hi sir, may I know how to assign the conversion of rgb to binary. for instance,, I've used this coding but the output is all black,why is that:
%%Binary
im=uint(im)
figure;imshow(im,[])
%%remove pxls less than 100
pixels=100;
detectObject=uint8(bwareaopen,pixels)
figure;imahow(detectObject,[])

回答 (2 件)

Image Analyst
Image Analyst 2012 年 10 月 29 日
編集済み: Image Analyst 2012 年 10 月 30 日

0 投票

That doesn't make sense. You don't use bwareaopen for RGB AND binary. You use it just for binary images.
You do not need to cast binary (logical) images to uint8 or use [] in imshow() for binary images.
Try
binaryImage = im < someThresholdValue;
detectObject = bwareaopen(binaryImage, pixels);
imshow(detectObject);

5 件のコメント

Tulips
Tulips 2012 年 10 月 30 日
編集済み: Tulips 2012 年 10 月 30 日
it doesn't make sense, this error appeared:
Error in imageDisplayParseInputs (line 79)
common_args = imageDisplayValidateParams(common_args);
Error in imshow (line 198)
[common_args,specific_args] = ...
Error in rgbCombine (line 62)
imshow(im);
why is that. Why I cannot use bwareaopen for type of RGB image after converted to binary?
Image Analyst
Image Analyst 2012 年 10 月 30 日
You CAN use it on a binary image. If an RGB image has been processed such that you produce a binary image, and you pass the binary image into bwareaopen(), then you aren't really using it on an RGB image, are you? You're using it on a binary image, not an RGB image.
What does the debugger say when you hover over im when you stop there are a breakpoint?
Walter Roberson
Walter Roberson 2012 年 10 月 30 日
Please show your actual coding. The code you posted in the Question would not have gotten that far as there is no routine named "uint".
Tulips
Tulips 2012 年 11 月 1 日
I just want to why after the conversion from rgb to binary , the used of bwrareaopen function produced all black images?I want to remove certain noise from the binary image.how can I do that , instead of using bwareaopen.thanks!
Image Analyst
Image Analyst 2012 年 11 月 1 日
Are you asking us to give advice on your image without showing us your image? How successful do you think we can be in that situation?

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

Walter Roberson
Walter Roberson 2012 年 10 月 29 日

0 投票

bwareaopen() is a function call that you need to apply to your data. You are instead calling it with no parameters, so it would be returning the empty matrix.

カテゴリ

ヘルプ センター および File ExchangeConvert Image Type についてさらに検索

質問済み:

2012 年 10 月 29 日

Community Treasure Hunt

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

Start Hunting!

Translated by