Topic: About "Camera calibration"

Hi,
I introduce myself : I am a coach of gymnastics , from south of Italy.
I'm using Kinovea few months. My hardware: Logitech C920; Sony Ps3Eye; Samsung VP-HMX20C; Nikon AW110.
I would like to begin with the work with video analysis . I've Kinovea experimental version 0.8.24.
I saw that there is a new function "camera calibration". I thought that could be used to correct the wide angle of some cameras (like the action cameras) . So I have also downloaded agsoft lens . But I don't think I've understand how to use this tool. The guide did not find anything . Does anyone tell me? Thank you,

Francesco
(ITALY)

Re: About "Camera calibration"

It depends what camera and type of lenses you are using. If you have wide lenses camera then you'll have picture distortion. Maybe for start try this:
- fixed camera position
-calibration 2 d object of large size ,let say 1x 1 M like net 1O cm x 10 cm squares or you can make it according software template ( count number of squares ) or you can make in dimensions you wish to make.


In plane of movement you have first to make video of calibration object, then remove object, and then execute movement or activities that you are filming. It is important to film everything with fixed camera and in one take.

Analysis:
go backwards to calibration sequence and calibrate it with that new kinovea software feature. You should strech kinovea net on calibration object.
After that go forward to the movement sequence and make your analysis.

But I think that is easiest for you to use camera without distortion. Most cameras like gopro and gopro category  have big plan distortion

3 (edited by joan 2015-Nov-02 12:49:08)

Re: About "Camera calibration"

bluesrumba wrote:

I saw that there is a new function "camera calibration". I thought that could be used to correct the wide angle of some cameras (like the action cameras) .

Here are some notes I wrote last year regarding lens calibration. They should still be relevant I think, let me know if it works.

Summary : film checkerboard pattern, import 5 images to Agisoft, export calibration file, import calibration in Kinovea.

1. In Agisoft Lens: Tools > Show chessboard.
2. Film the screen with the camera from up close. About 10 cm for a GoPro. Film from 5 different angles: one central and the others from the corners. This assumes a flat screen. See example images below.
3. Open the video in Kinovea.
4. In Kinovea: Find 5 clear images (no motion blur) corresponding to the 5 various points of view and export them as images.
5. In Agisoft Lens: Tools > add photos. Add the 5 images.
6. In Agisoft Lens: Tools > Calibration. Check every checkbox except "skew" and "k4". Run calibration.
7. In Agisoft Lens: File > Save calibration…
8. In Kinovea: Image > Camera calibration. File > Import > Agisoft Lens. Import the file and Apply.

Done.

You can reuse the same calibration file for all videos filmed with this camera with the same lens settings. (If you change from wide angle to normal, another calibration file is needed.) Other cameras of the same model will have similar calibration files, but for the most accurate result you'll want to use a file specific to your camera.

The calibration computes the focal length, the misalignment of the lens center with regards to the sensor center, optical axis orientation with regards to the sensor plane, and distortion coefficients.

Verification

1. Go into the image tab in the calibration window and check the rectified image.

2. With a perspective plane.
- Reopen the checkerboard video in Kinovea.
- Add a perspective grid on the checkerboard and verifies that the lines are correctly distorted.
- Zoom to the max, adjust corners of the perspective grid and then calibrate the grid by the number of blocks covered horizontally and vertically.
- Display the coordinate system and check that it is correctly distorted. You can see the error accumulating at the periphery.
- Add a line covering a number of blocks, display its measurement and check that it matches.

My calibration images looked like this:
http://www.kinovea.org/screencaps/0.8.x/0823-calibration.jpg

Re: About "Camera calibration"

Ok, completely accurate. Thanks. But i've a question: wich is the correctly distance from the monitor to calibrate the camera?
The distorsion change if i'm 10 centimeter or 5 to the monitor. Wich is correct? And then is the same if the subject is 10 meters far or 5 or more, when i will record the atlet?
I mean: if i calibrate the camera with a video recorded about 10 cm to the monitor (or 5???), this kind of calibration will work for movie with subject 5 meters, 10 meters far or more?

Re: About "Camera calibration"

Yes it will work. It doesn't matter that you film from 10cm or 5cm. The program knows the expected geometry of the checkerboard and it compares it to what the image shows. Whether the squares occupy 25 pixels or 100 is not important for this. It is however important that all parts of the image are mapped to take into account asymmetries, so it should be from various angles.

It may appear that the distortion changes when you move the camera closer or farther away from the screen but in reality it does not. The periphery of the image still has the same amount of distortion. If you filmed a checkerboard ten times bigger from ten times farther away you would get the same image.

If you do the calibration several times you will see that the coefficients are not exactly the same. It should still work accurately and this margin of error is probably lower than the error introduced during digitization of points/objects positions.

The calibration of distortion works on the projected image so once calibrated it will work no matter how far the subject is.

Re: About "Camera calibration"

Good. I understand very well the operation . I 'll try and let you know .

Re: About "Camera calibration"

Ok, i've done. Now I've the xml file. I upload it in "Camera Calibration" and it fix correctly the preview that i see on the tab "image" but i can't apply it on the vid. I push on "apply", but it don't modify the vid.

Re: About "Camera calibration"

Ah, maybe it wasn't clear enough about what the feature is supposed to do.

The image will not be undistorted, it is the coordinate system that will now take the distortion into account. So if you add a planar or perspective coordinate system, the coordinates used for positions, distances, angles, speed, etc. will be distortion corrected.

If you add lines or grids, you will see them bend along the distortion field.

Rectifying the images in real-time is costly and Kinovea architecture is not suitable for this as it is.

Regarding accuracy there could be arguments in both directions, on one hand it is better to use the actual pixels captured by the sensor for digitizing points rather than use the rectified images that will be interpolated. On the other hand a circular marker will no longer be circular at the image periphery which could limit the accuracy of automated tracking. Currently the philosophy is to respect the original image from the sensor as much as possible.

Re: About "Camera calibration"

Ok. great.  Thanks!