MATLAB: Removing Labeled components based on boundary condition.

image processing

Hey guys i have a binary image in which there are letters in white and background is black. No letter is attached to the boundary but some unwanted areas are attached to the boundary. Is there any way to remove these areas using the fact that those will always be attached to the boundary. Following is a link to a sample image.. http://www.image-upload.net/viewer.php?file=hiu4aujtlbl4pwbc3d3w.jpg

Best Answer

Hey one simple command solved my problem.
imclearborder(bw);
It removes the components attached to the border.