Detect and remove T/Y joints in a binary image

4 ビュー (過去 30 日間)
Ramin Dastanpour
Ramin Dastanpour 2015 年 10 月 1 日
コメント済み: Walter Roberson 2015 年 10 月 1 日
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
Walter Roberson 2015 年 10 月 1 日
Should the result be to break the Y/T into three line segments?
Ramin Dastanpour
Ramin Dastanpour 2015 年 10 月 1 日
編集済み: Ramin Dastanpour 2015 年 10 月 1 日
Yes, exactly. But I need to get the index of the pixel on the joint as well. After breaking the joint I want to reconnect the disconnected objects which are in one direction (more).

サインインしてコメントする。

採用された回答

Walter Roberson
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
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!

Translated by