1

As we know in ordinary linear interpolation, the final destination is fixed. I want to use a camera to catch the moving objects and the coordinate can be the final destination. Anybody could help me finish this algorithm in C code?

Rafael
  • 141
  • 1
  • 1
  • 5

1 Answers1

0

Assuming that you're trying to track a moving object with a gimballed camera, the problem is the mismatch between the linear, constant speed assumption and the motion of the camera. Even if your object is moving at a constant speed, the camera will have to rotate at a non-constant speed to keep track of the object. For example, the camera will have to rotate quickly when the object is near the camera, but will rotate very slowly when the object is far away.

1) Figure out the Cartesian (XYZ) coordinates of the starting and ending points.

2) Compute a sequence of linear interpolations between the start and end point in Cartesian space. This is a sequence of points in Cartesian space that estimate the object's trajectory.

3) Convert the sequence of Cartesian points from the Cartesian coordinate system to the Spherical coordinate system.

4) The spherical coordinates Theta and Phi are the angles that your camera must move through in time.

All of the computations described above are simple and closed-form. You shouldn't need to apply any "real-time" programming techniques aside basic concepts like no dynamic allocation and no interpreted or garbage collected languages. If reliability is very important then you will want to employ a suitable real-time OS. Linux has a good real-time patch that provides pretty good soft-real-time performance.

David
  • 1,624
  • 11
  • 13
  • Oops I want to achieve this subject in SCM, I want to use the camera like kinect and then use the motor to control a funnel to catch the falling ball. Maybe I should use digital incremental linear interpolation combined with the signal from camera. Do you think so? – Rafael Oct 05 '16 at 03:57
  • Probably not. The Kinect and other similar platforms all have some way of accurately estimating depth. You won't be able to do this unless there are additional constraints to your problem. – David Oct 05 '16 at 04:01
  • Yes the Kinect have the way of accurately estimating depth, I want to use this way to calculate the ball's coordinate and then let the coordinate to be the algorithm's final destination. But I have no idea how to combine the basic linear interpolation and the real-time sampling. – Rafael Oct 05 '16 at 04:07