繁体   English   中英

Matlab中路径的腋曲线

[英]Axillary curve line for a path in Matlab

图像fig a 通过减少图像噪声,最终可以使smoothspline适合点,如图fig b所示。 现在,我们希望在原始线的两侧找到两条腋线,例如偏移(在这种情况下,最好用轮廓线表示)。 如何找到这些线(黄色和绿色)? 如果有一条简单的直线会很容易,但这是样条曲线。 任何想法将不胜感激。 在此处输入图片说明

我认为这是您想要的:

% generate random curve
xy = randi(5,[2,3]);
t = 1:3;
tq = linspace(1,3,100);
xyq = interp1(t',xy',tq','spline');
xx = xyq(:,1);
yy = xyq(:,2);
% get curve's approx. angle in each point
theta = atan2(xyq(2:end,2) - xyq(1:end-1,2),xyq(2:end,1) - xyq(1:end-1,1));
theta(end+1) = theta(end);
% add or subtract 90 degrees to get downward or upward normal angle
tp1 = theta + pi/2;
tp2 = theta - pi/2;
% distance from original curve
d = 0.1;
% compute x-y additions
[xa1,ya1] = pol2cart(tp1,d);
[xa2,ya2] = pol2cart(tp2,d);
% plot curve and its axillary lines
plot(xx,yy,'g')
hold on
plot(xyq(:,1) + xa1,xyq(:,2) + ya1,'b')
plot(xyq(:,1) + xa2,xyq(:,2) + ya2,'r')
legend('orig.','axil._1','axil._2');

你得到这个: 在此处输入图片说明

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM