필터 지우기
필터 지우기

How to clear objects connected to the lower borederof the image?

조회 수: 3 (최근 30일)
Richa Nayak
Richa Nayak 2013년 3월 29일
댓글: ammar roslan 2021년 6월 23일
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

채택된 답변

Steve Eddins
Steve Eddins 2013년 3월 29일
% 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
Steve Eddins
Steve Eddins 2013년 3월 29일
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
ammar roslan 2021년 6월 23일
Hi Sir Steve, i want to ask. How can i remove objects that connected to the upper border?

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Anand
Anand 2013년 3월 29일
You could use the imclearborder function.
There's a blog article by Steve Eddins about this topic too:
  댓글 수: 1
Richa Nayak
Richa Nayak 2013년 3월 29일
thanks but it removes all the border connected objects. i wanna remove oly lower border connected ones

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by