Measuring angles in perspective

The last experimental version of Kinovea introduced the ability to use the perpective grid as a coordinate system, which allows all kind of measurements on the grid. Here I’ll describe on what we have done with it in the context of podiatrics.

The experiment

For an experiment in podiatrics, we needed to measure how much people rotate when asked to perform 50 steps in the same spot, blindfolded. This is known as the Fukuda stepping test, it is generally used to detect neuropathologies but it has the interesting feature of being reproducible. I’ll not go into much details over the experiment itself or the rest of the setup as it is still unpublished and not my work. I’ll focus on the use of the perspective grid.

For this experiment, we developped a custom tool tailored for the Fukuda stepping test. The tool itself might be dissected in a future post, but the important thing here is that it is capable of measuring the angle of rotation of the person relatively to his initial direction (Σ on the tool).

 

Using the perspective grid’s ability to act as a coordinate system was very interesting here. Not only it lifted the need to mount the camera to the ceiling to get the view from above, but it actually allowed us to take series of images weeks apart without fearing measurement errors due to small changes in how the camera was fixed or how the experiment was set up. We could have taken the plastic track and set it up anywhere, even outdoors, and still have reproducible measures.

Once a person had performed the test (about 1 minute), we marked his feet position and took a picture. The picture was later processed in Kinovea to find the rotation angle.

Calibration

To be able to make measurements on the perspective grid, we first needed to calibrate it. To do this we measured the physical size of four segments on the plastic track that would be guaranteed to always be visible on any image we would take.
After laying down the grid and aligning its corners on these four points, we open the calibration dialog and enter the corresponding measures.

Note that the quadrilateral in the calibration dialog will have the same shape as the real one. This can be handy to give the segments the correct measure, especially when we take a picture from a completely different angle, rotate the camera, etc.

After the calibration is done, we can lay down the custom tool and make our measurement. (We generally do this on a different key image and disable the persistance for the grid so the grid doesn’t get in the way of the tool positionning).

 

Accuracy

During the course of the experiment we tested for the accuracy of the system.
To get the best results, we need to have the most precise calibration possible. It’s one of these cases where the number of megapixels does matter, and we used a still images camera rather than a camcorder to collect the measurement pictures.

To adjust the corners of the grid perfectly, we zoom to the max and adjust at pixel level.

To test the reproductibility, we started with the result of  a single person and took several pictures from various angles around the room. We then processed the images independently from one another and compared the resultts. We also measured the angle manually, to act as the “ground truth”.

We got approximately ±1° margin of error, which was perfectly acceptable with regards to the experiment.

 

How the perspective grid works

3D geometry tells us that any quadrilateral on a plane can be seen as the projection of a rectangle from another plane. In other words, a rectangle can be mapped to an aribitrary quadrilateral and back, with a transform matrix. In Kinovea, the pixel coordinates of the grid on the screen represent the quadrilateral, while the physical position of the corners on the ground represent the rectangle.

This means that after the calibration is done, any coordinate on the screen plane can be converted to its coordinate in the ground plane. It’s as if Kinovea could see the ground from above.

To measure angles in perspective, we first convert the screen coordinates of the three points to physical world coordinates, and we make the measurement from there. After the conversion step all the measurements use regular 2D geometry. A similar approach is used to measure distances, speed, etc.

Future

Many things can be done when we can measure snakesthings on a plane. Statistical analysis of ball impacts in table tennis? Distribution of scoring angles in football? Tell us what you did with the perspective grid! And report what parts of the tool can be improved to further streamline the process.

Notes

 

 

 



Comments are closed.