フィルターのクリア

Line drawing

1 回表示 (過去 30 日間)
K BV
K BV 2012 年 4 月 11 日
Hi,
I would like to draw 12 lines linking two endpoints pt_orth_int and pt_orth_ext, for that I wrote this part of code :
for i=1:12
xx(i,:) = [pt_orth_int(i,2) pt_orth_ext(i,2)];
yy(i,:) = [pt_orth_int(i,1) pt_orth_ext(i,1)];
line(xx(i,:),yy(i,:),'LineWidth',2,'Color','y');
end
The problem I have is only the 12th line was drawn in my figure and not the totality of them. I think it is a problem of overwriting, would you please help me to fix it ?
Thank you !

回答 (3 件)

Image Analyst
Image Analyst 2012 年 4 月 11 日
Try putting this code in the loop after the call to line().
if i == 1
hold on;
end

Jan
Jan 2012 年 4 月 11 日
The line command handles matrices also:
xx = [pt_orth_int(1:12, 2), pt_orth_ext(1:12, 2)];
yy = [pt_orth_int(1:12, 1), pt_orth_ext(1:12, 1)];
line(xx, yy, 'LineWidth', 2, 'Color','y');
Perhaps xx and yy must be transposed - I cannot test this currently.

K BV
K BV 2012 年 4 月 11 日
I added the "hold on" statement where did suggest Image Analyst and used the matrices xx and yy as suggested by Jan Simon.
Now I have all my lines and I can finish my tracking program :)
Thank you again !

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by