【发布时间】:2014-04-14 18:32:40
【问题描述】:
我目前正在处理一个MATLAB 项目,我需要找到膝盖两块骨头之间的距离。
在将chenvese 程序用于活动轮廓并设法绘制骨骼曲线后,我需要找到它们之间的空间。
我使用interp1 函数尝试了各种程序,但我的曲线没有相同的大小/长度。所以我试图用findobj 提取曲线方程,但它没有让我到任何地方。
%*********************** Chen Vese ***********************************
m=zeros(size(IBinaire,1),size(IBinaire,2));
m(300:900,400:1200)=1; %200,1200
seg = chenvese(IBinaire,m,500,0.2,'chan');
%*********************** Courbes de contours *************************
c = contour(seg);
s = getcontourlines(c);
plot(s(1).x,-s(1).y, 'b', s(2).x,-s(2).y,'g', s(3).x,-s(3).y,'r')
h = findobj('type', 'line', 'marker', '-and', 'b', [1 0]);
xx1 = get(h, 'XData')
yy1 = get(h, 'YData')
h = findobj('type', 'line', 'marker', '-and', 'g', [1 0]);
xx2 = get(h, 'XData')
yy2 = get(h, 'YData')
%****************Distance entre lignes ************************
z1=xx1+1i*yy1;
z2=xx2+1i*yy2;
i=interligne(z1,z2);
plot(i)
interligne 是一个计算两条曲线之间距离的程序,但它不起作用并告诉我我的曲线大小不一样...
【问题讨论】:
-
我认为
interp1是正确的 - 但使用单独的尺寸。 -
如果你有统计工具箱,或许可以使用
pdist2。
标签: matlab line distance curve