如何使线穿过3D点云? [英] How to fit a line through a 3D pointcloud?

查看:149
本文介绍了如何使线穿过3D点云?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一条电缆要从车辆上移到地面上.使用摄像头系统,我可以实时估计绳索接触地面的位置.车辆的运动和位置估计的不准确性导致着陆位置的点云.从这一点开始,我想得出电缆在地面上最可能的路径.我想实时实现这一目标,并且希望根据新数据来更新拟合度.被添加的新点的频率约为20 Hz,而车辆的运动速度约为1 m/s.因此,点云相当密集.电缆在地面上遵循的路径是平滑的(因为电缆是硬的),并且在3D模式下(x,y,z:地面不平坦!).

我一直在寻找3D线/样条线/曲线拟合/插值.我发现了一些有前途的方法(B样条拟合,

如下面的图片所示,我设法在2D模式下使用LOWESS获得了合理的结果,但在3D模式下却没有.

我可能要添加的另一件事是数据带有时间戳.我可以想象这可能对调整生产线是有益的.

解决方案

您可以使用scipy UnivariateSpline.

从scipy.interpolate导入

 #新轴u = np.arange(len(x))#UnivariateSplines = 0.7 * len(u)#平滑因子spx = UnivariateSpline(u,x,s = s)spy = UnivariateSpline(u,y,s = s)spz = UnivariateSpline(u,z,s = s)#xnew = spx(u)ynew =间谍(u)znew = spz(u) 

I have a cable I am dropping from moving vehicle onto the ground. Using a camera system I estimate the location where the rope touches the ground in realtime. Movement of the vehicle and inaccuracy in the estimation of the location result in a point-cloud of touchdown locations. From this point cloud, I'd like to obain the most likely path of the cable lying on the ground. I'd like to achieve this in real-time, and I'd like the fit to be updated according to new data. The frequency of new points being added is approximately 20 Hz, whereas the movement speed of the vehicle is about 1 m/s. Therefor the point cloud is rather dense. The path followed by the cable on the ground is smooth (since the cable is stiff) and in 3D (x,y,z: the ground is not flat!).

I've been looking for 3D line/spline/curve fit/interpolation. I have found some promising methods (B-spline fits, LOWESS -> seems viable, is available in 2D, but not in 3D). However I can not find any clear explanation on what method would be suited for my case. What fitting method would you suggest for this situation?

The current dataset I'm working on is generated by:

import numpy as np

tMax = 10 # s
f = 20 # hz
v = 2 # m/s
samples = tMax*f
t = np.linspace(0,tMax, samples)
div = 00.[![2][2]][2]
x=1*np.sin(t)+t+np.random.uniform(-div,div,samples)
y=1*np.cos(t)+t+np.random.uniform(-div,div,samples)
z=1*np.sin(t)*np.cos(t)+t+np.random.uniform(-div,div,samples)

I manage to obtain reasonable results with LOWESS in 2D, as can be seen in the image below, but not 3D.

Another thing I might add is that the data is time-stamped. I can imagine this might be benificial in fitting the line.

解决方案

You can use scipy UnivariateSpline.

from scipy.interpolate import UnivariateSpline

# new axis
u = np.arange(len(x))

# UnivariateSpline
s = 0.7 * len(u)     # smoothing factor
spx = UnivariateSpline(u, x, s=s)
spy = UnivariateSpline(u, y, s=s)
spz = UnivariateSpline(u, z, s=s)
#
xnew = spx(u)
ynew = spy(u)
znew = spz(u)

这篇关于如何使线穿过3D点云?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆