フィルターのクリア

how to draw lines of shortest distances on this image identifying a particular shape ?

2 ビュー (過去 30 日間)
Shan  Kapoor
Shan Kapoor 2012 年 1 月 9 日
Hi All,
I have an image on which i marked some points running "imregionalmax" function. like below
Now I want to join points on each black laths like this
I tried to write a code like below,
for p = 1:(length(trI)-1) y = [trI(p),trI(p+1)]; x= [trJ(p),trJ(p+1)]; linexy=line(x,y); plotline=plot (x,y);
how will I eliminate this situation of likes connecting between laths... it should be the shortest line in a single grain as shown in the expected results...
thanks in advance, Shanoob

回答 (1 件)

Michael
Michael 2012 年 1 月 10 日
An idea might be to rank pairs of points based on their proximity, then define some sort of cut-off below which the pair gets a line between them. Of course this method may lead to overlapping lines and you might need a second routine which disregards a pairing between two points who also have (shorter) pairings to a common 3rd point.
Just some ideas, not sure of the best way
  1 件のコメント
Shan  Kapoor
Shan Kapoor 2012 年 1 月 10 日
Hi Mike,
This method may solve my problem. could you please guide me the way I have to code this ? thank you.

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

Community Treasure Hunt

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

Start Hunting!

Translated by