I have an application which uses the Microsoft Kinect camera device.

At each point I can obtain the position of my hand in the 3 Dimensional space ( X - Y - Z ) and I want to compute acceleration of my hand over each second on each axis.

Basically, I can obtain the coordinates at each frame(where 1 sec = 30 frames), and I want to compute the acceleration of my hand in 1 sec.

StartPoint - (x1, y1, z1)

EndPoint after 1 sec from StartPoint ( 30 frames ) - (x2, y2, z2)

Acceleration between StartPoint and EndPoint = ?

Also I can obtain all the other coordinates of my hand over time, but I want to compute the acceleration in the period of time between start point and end point.

Could you please explain or show me how?

  • 2
    \$\begingroup\$ If you want to compute an acceleration based purely on positions, you'll need at least three points. \$\endgroup\$
    – Raskolnikov
    May 2, 2012 at 8:42
  • \$\begingroup\$ I can have as many positions as I want. I can have the position at StartPoint minus half second and for StartPoint plus half second and the same for end point. The only problem is that I don't know how to compute the acceleration given this input of the problem. \$\endgroup\$
    – Simon
    May 2, 2012 at 8:47
  • \$\begingroup\$ Speed is just a change in position divided by a time interval. Acceleration is a change in speed divided by a time interval. This already gives you a basic approach. But more elaborated ones could use some smoothing of the trajectory. If nobody answers before I come back, I'll post an approach. \$\endgroup\$
    – Raskolnikov
    May 2, 2012 at 8:49
  • \$\begingroup\$ Since this question has been migrated from Physics SE, but we don't have MathJax support like they do, you may see funky sequences of symbols below where there should be equations. As a workaround, paste the bit between the $$s into this sandbox to see a properly rendered equation. \$\endgroup\$
    – Anko
    Feb 23, 2015 at 11:10

2 Answers 2


Suppose you have a sequence of positions for different times which could be summarized in a table

$$ \begin{array}{c|ccc} t & x & y & z \\ \hline t_1 & x_1 & y_1 & z_1 \\ t_2 & x_2 & y_2 & z_2 \\ \vdots & \vdots & \vdots & \vdots \\ \end{array}$$

then computing velocities amounts to compute the following differences:

$$(v_{x,i},v_{y,i},v_{z,i}) = \frac{(x_{i+1}-x_{i},y_{i+1}-y_{i},z_{i+1}-z_{i})}{t_{i+1}-t_{i}} \; .$$

Strictly speaking, these are mean velocities for the time intervals $[t_i,t_{i+1}]$. You could for instance associate them to the midpoint time of each interval $t^*_i=(t_i+t_{i+1})/2$.

From there the accelerations can be computed as

$$(a_{x,i},a_{y,i},a_{z,i}) = \frac{(v_{x,i+1}-v_{x,i},v_{y,i+1}-v_{y,i},v_{z,i+1}-v_{z,i})}{t^*_{i+1}-t^*_{i}} \; .$$

These could again be associated to midpoints \$ t'_i=(t^*_i+t^*_{i+1})/2 \$.

Another approach would be to use some curve fitting techniques for your data points. For instance some Bézier curve techniques. This would have the advantage that you could then immediately define instantaneaous velocities and accelarations for any point in time you'd like.


Does it matter if your hand isn't moving in a straight line? For example, suppose you're moving your hand in a circle, do you just want the acceleration as defined by the magnitude of the speed? This matters because if you're moving your hand in a circle the acceleration is non-zero even when your hand is moving at a constant speed. This will be true for any curve.

If you want to ignore the direction your hand is moving in, and I would guess you do, then for each pair of \$ (t, x, y, z) \$ points calculate the distance moved using Pythagorus:

$$ds_i = \sqrt{(x_i - x_{i+1})^2 + (y_i - y_{i+1})^2 + (z_i - z_{i+1})^2}$$

This gives you a squence of $(t, s)$ points where $s$ is the distance moved if the curve your hand moved in was unrolled along a flat line.

Assuming constant acceleration the equation you need to fit is then simply:

$$s(t) = ut + \frac{1}{2}at^2$$

You've probably used linear regression to fit a straight line to experimental data. To fit your data you need quadratic regression. The equations for this are a bit more complicated than for linear regression, but are easily programmed. I think I have C code lying around somewhere if you want it. Alternatively Googling for "least squares quadratic regression" finds lots of code snippets, or I bet asking on Stack Overflow would quickly get you some code to do the job.

The least squares fit gives you the best fit average acceleration (and initial speed if that matters) over your whole set of points. An alternative would be to just take three points and calculate the parabola passing through those three points. This is a lot simpler and quicker, but noisier because you don't get the averaging over a whole sequence of points. I found a Stack Overflow post giving the equations for this here.


You must log in to answer this question.