clear connected pixel touching a non square border
Show older comments
hi, i am trying to remove the border objects from an image of an octogonal sample. plese see the image
i would like to know if there is a way to create a mask that is octogonal and then perhaps apply imclearborder.
other suggestions are very welcome.
thank, S
Accepted Answer
More Answers (1)
Image Analyst
on 17 Feb 2012
1 vote
Threshold to get the dark outer octagon. You might need to dilate this a layer or two. Then threshold to get the bright particles. Then AND those two together. This gets you a combined binary image that has both the dark surround and the bright inner particles. Then call imclearborder() and subtract from your original combined binary image to get a binary image of just the dark surround and the particles that touch it. Then use that to mask out (zero out, erase) the bright particles that touch the border from your original image.
Your flickr web site says "The owner has disabled downloading of their photos" so I can't get a copy unless you want me to.
Categories
Find more on Convert Image Type in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!