MATLAB Answers

How to bridge the gaps

Please, see attached image.
I already, tried bwmorph(img,'bridge'); but it couldn't connect the detached lines.
I don't want to use extreme values of imdilate() since then the original shape and direction of the lines is lost. With extreme values of imdilate() I get thicker lines and this is not something I want to. I want to retain the same thickness but to get them elongated in a way so they can connect.
Any advice please?
Thanks

  댓글 수: 0

로그인 to comment.

답변 수: 1

KALYAN ACHARJYA 님의 답변 17 Sep 2019
KALYAN ACHARJYA 님이 편집함. 17 Sep 2019
 채택된 답변

"I want to retain the same thickness but to get them elongated in a way so they can connect".
I tried using
se=strel('line',h,v);
result=imdilate(binary_image,se);
After that
use imerode (different structuring element), may be you will get similar to the original shape, with reaching the almost equal thickness.

  댓글 수: 4

표시 이전 댓글 수: 1
Like
se=strel('line',10,2);
% Check with different values, h represents horizantal (borading) pixels
%v represents vertical (borading) pixels
%Test with different values ans structuring elements, you will see the differences
The challenge due to the shape of the lines, which are little curves, not exactly as horizantal line.
Yeah. The small gaps filled. However there is a big gap at the upper curve that when I use high values e.g. 45 or 55 for horizontal and 14 for vertical in order to bridge the big gap, they usually tend to lose their shape and direction.
Please look here it may helps

로그인 to comment.



Translated by