Detect and remove T/Y joints in a binary image
조회 수: 2 (최근 30일)
이전 댓글 표시
I have a binary image and I want to detect and remove all pixels with >2 pixels connected to them (e.g. Y and T joints). The image is produced by thinning of the image and all lines have a thickness of 1 pixel. Below is a sample image. My first guess was to check connectivity for all pixels but since I have hundreds of these objects in each image, this approach would be too expensive. Thanks,

댓글 수: 2
채택된 답변
Walter Roberson
2015년 10월 1일
NewImage = BWimage;
NewImage( (conv2(0+BWImage,[1 1 1;1 0 1;1 1 1],'same') .* BWimage) > 2 ) = 0;
댓글 수: 1
Walter Roberson
2015년 10월 1일
With index:
NewImage = BWImage;
idxmask = (conv2(0+BWImage,[1 1 1;1 0 1;1 1 1],'same') .* BWimage) > 2;
NewImage(idxmask) = 0;
idx = find(idxmask);
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!