Connect lines of binary image

Dear comunity,
I have the following image composed by many (almost closed) lines. I am contacting you because I would like to know if somebody has an elegant solution to connect the lines (some of them are broken). If possible, I would like to avoid the use of morphological operators as it is importat to me to maintain the lines profile.
Thank you in advance for your help,
Santiago

6 件のコメント

KALYAN ACHARJYA
KALYAN ACHARJYA 2020 年 1 月 24 日
I would like to know if somebody has an elegant solution to close the lines
What does it mean?
Santi
Santi 2020 年 1 月 24 日
Dear Kalyan, I just changed the text so it can be better understood; I want to connect the lines. Thanks!
Rik
Rik 2020 年 1 月 24 日
Have you tried a morphological operation with a non-symmetrical structuring element? That would probably get you most of the way there.
Mohammad Sami
Mohammad Sami 2020 年 1 月 26 日
Have you tried houghtransform. It can help you find the lines.
[H,T,R] = hough(BW);
P = houghpeaks(H,5,'threshold',ceil(0.3*max(H(:))));
lines = houghlines(BW,T,R,P,'FillGap',5,'MinLength',7);
Santi
Santi 2020 年 1 月 27 日
Dear Mohammad Sami,
That sounds very interesting. Could you please explain a little bit more? (e.g. how to plot the lines...)
Thank you very much.
Rik
Rik 2020 年 1 月 27 日
Have you looked at the documentation for the houghlines function? It includes an example.
As for my suggestion, you can very easily create a non-symmetrical structuring element like this:
r=1;
x=linspace(-1,1,10);
y=linspace(-2,2,10);
[X,Y]=ndgrid(x,y);
SE=sqrt(X.^2+Y.^2) <= r;

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

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeImage Processing Toolbox についてさらに検索

質問済み:

2020 年 1 月 24 日

コメント済み:

Rik
2020 年 1 月 27 日

Community Treasure Hunt

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

Start Hunting!

Translated by