Remove single pixel width connecting lines between objects
이전 댓글 표시
Hi all,
How can I remove/disconnect the connecting lines between objects while keeping the boundaries of my objects intact?

댓글 수: 6
KALYAN ACHARJYA
2019년 10월 21일
As per previous discussion, have you tried with Morphological operations?
Haider Ali
2019년 10월 21일
Matt J
2019년 10월 21일
I recommend that you attach your image in a .mat file to speed things up.
Haider Ali
2019년 10월 21일
Matt J
2019년 10월 21일
An intriguing problem.
darova
2019년 10월 22일
=)
답변 (1개)
darova
2019년 10월 22일
Here is an idea: find large areas and merge them to remove walls
I = imread('image.png');
I1 = im2bw(I);
% I2 = bwmorph(~I1,'thin',3);
[I3,n] = bwlabel(I1,8); % label image
p = regionprops(I3,'Area'); % find area of each region
ar = cat(1,p.Area);
ind = find( 400 < ar & ar < 5000); % find interested areas
I4 = I3*0;
for i = 1:length(ind)
ix = find( I3==ind(i) ); % find pixels of interested areas
I4(ix) = 1;
end
I5 = imdilate(I4,ones(3)); % merge neigbouring areas
I6 = imdilate(~I5,ones(3)); % return original size of areas
II = cat(3,I1,~I6,I1*0);
imshow(II)
figure
imshow(I1 | ~I6)
The result: Green lines/walls removed, Yellow areas detected

댓글 수: 2
Haider Ali
2019년 10월 22일
darova
2019년 10월 23일
I'm afraid that i can't help. All i can advise is binarizing image and manipulating with graythersh
카테고리
도움말 센터 및 File Exchange에서 Image Thresholding에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!