There are 10 objects in my picture of varying sizes. two of them are connected to (contain) the lower boreder of an 80x80 image. The image is binary. I do not want to use bwareaopen.Plzzzzzzzz help. Thank You
% Start by padding the image with 0s on the left, top, and right. bw2 = padarray(bw,[1 0],0,'pre'); bw3 = padarray(bw2,[0 1],0,'both');
% Remove objects touching the border of the padded image. bw4 = imclearborder(bw3);
% Remove the padded columns and padded row. bw5 = bw4(2:end,2:end-1);
See my 18-Dec-2012 blog post.
You could use the imclearborder function.
There's a blog article by Steve Eddins about this topic too: