Blob Analysis - Subtract Large Blobs from Image (Keeping Small Blobs) to create a mask image
3 ビュー (過去 30 日間)
古いコメントを表示
Hello! I am currently working on some image processing stuff and am having trouble with deleting/subtracting blobs in a binary image that are less than 2000 pixels. I have used bwareaopen to do the opposite (removing blobs less than 2000 pixels). I need a way of doing this simply. I have looked at other files here, including the one posted by ImageAnalyst, but, none of it seems to be helping the way I want it to. Any suggestions? Please and thanks!
1 件のコメント
Steve Eddins
2012 年 7 月 10 日
編集済み: Steve Eddins
2012 年 7 月 10 日
I'm not sure I understand your question. Do you mean that you are having trouble deleting blogs that are more than 2000 pixels?
If that's what you mean, then I recommend Jeff EA's answer below.
回答 (2 件)
Jeff E
2012 年 7 月 10 日
Yes, there is no built-in inverse of bwareaopen. You can achieve this with some simple logic operations:
mask_out = mask_in & ~bwareaopen(mask_in, 2000);
0 件のコメント
Kevin Claytor
2012 年 7 月 10 日
You can run "bwconncomp()" to segment the binary image into chunks, then get the size of the chunks with "regionprops()". One of the fields that will be created is "Area" for which you can do whatever threshold you would like (<2000, >2000, etc). An example would be;
bw = imread('mybinaryimage.bmp'); % Your image
cc = bwconncomp(bw, 4)
graindata = regionprops(cc,'basic')
grain_areas = [graindata.Area];
figure, hist(grain_areas,20)
title('Histogram of Binary Blob size');
See this link for the full demo; http://www.mathworks.com/products/image/examples.html?file=/products/demos/shipping/images/ipexrice.html
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!