How to fit a line through a 3D pointcloud?

前端 未结 1 1400
伪装坚强ぢ
伪装坚强ぢ 2021-02-09 12:37

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 ve

1条回答
  •  独厮守ぢ
    2021-02-09 13:23

    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)
    

    0 讨论(0)
提交回复
热议问题