7

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)

enter image description here

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

enter image description here

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

marqram
  • 725
  • 12
  • 26
  • Maybe [Gaussian process regression](http://scikit-learn.org/stable/modules/gaussian_process.html)? Without having access to the data it's hard to give a more concrete answer. – ali_m Feb 08 '16 at 23:18
  • Could you add some data!? – Cleb Feb 09 '16 at 11:02
  • Please post a data set, or link to one. It is not a difficult problem, and since you have asked, we might as well post an answer. – DrM Dec 24 '19 at 14:19
  • Given the problem was poosted in '16, I don't have access anymore to the respective dataset (I am aware the first request for data was from '16 too - sorry for not responding to that). The data was classified and couldn't be shared anyway. The problem was very close though to the data as generated by the code provided in the question. What issues does using that data give you? – marqram Jan 02 '20 at 15:10
  • 1
    @ali_m. Essentially a Kalman Filter? – Mad Physicist Mar 30 '20 at 19:50
  • @marqram. Have you considered writing a simple Kalman Filter for your process? Making some assumptions about the derivatives and permitted deviations, it would act as a low-pass filter on the data. – Mad Physicist Mar 30 '20 at 19:53

1 Answers1

0

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)
w..k
  • 60
  • 4