How to clear objects connected to the lower borederof the image?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Richa Nayak
am 29 Mär. 2013
Kommentiert: ammar roslan
am 23 Jun. 2021
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
0 Kommentare
Akzeptierte Antwort
Steve Eddins
am 29 Mär. 2013
% 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);
3 Kommentare
Steve Eddins
am 29 Mär. 2013
Yes, it will remove only the objects connected to the lower border. That's the reason for the first two lines (padding the image) and the last line (removing the padded columns and row). Follow the link to my blog post for more explanation about this technique.
ammar roslan
am 23 Jun. 2021
Hi Sir Steve, i want to ask. How can i remove objects that connected to the upper border?
Weitere Antworten (1)
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!