Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calibrate camera with opencv, how does it work and how do i have to move my chessboard

I'm using openCV the calibrateCamera function to calibrate my camera. I started from the tutorial implementation, but there seems something wrong.

The camera is looking down on a table and i use a chessboard with an area that covers about 1/2 or 1/4 of my total image. Since I aim to track a flat object that slides over this table, I also slide my chessboard over this table.

So my first question is: is it ok that i move my chessboard over this table? Or do I have to make some 3D movements in order to get some good result? Because I was wondering: how does the function guesses the distance between the table and the camera? He has only a guess of his focal point, and he has only one "eye", so there is no depth vision.

My second question: how does the bloody thing work? :p Can anyone show me some implementation of this function?

Thx!

like image 870
user2812874 Avatar asked Dec 20 '13 15:12

user2812874


2 Answers

the camera calibration needs a seed of points to calculate the camera matrix and the the position of the central point of the camera, and the distortion matrices , if you want to use a chessboard you have to take in consideration its dimension(I never used the circles function because the detection of chessboard is easier ) , the dimension of the chessboard should be pair X unpair number so you can get a correct rotation matrix ! the calibration function needs minimum 8x set of chessboardCorners and ( I use 30 tell 50) it depends on how precise you want to be .the return value of the calibration function is the re-projection error this should be near to zero if the calibration is good. the cameraCalibration take a the size of used chessboards ( you can use different chessboardSize) and the dimension ( in mm or cm or even m etc.. ) your result will depend on your given dimension. By the way after getting the chessboardCorners you have to refines them with the function CornerSubPix you can set how good the refinement is in the function parameter.

In the internet you can find a lot docs about this subject.

http://www.ics.uci.edu/~majumder/vispercep/cameracalib.pdf

I hope it helps !

like image 81
Engine Avatar answered Sep 29 '22 21:09

Engine


regarding the chessboard positions, I got best results with 25-30 images First I do 3 -4 images that show the chessboard at different distances full frame half 1/3 1/4 then I make sure to go to each corner, each center of each edge plus 4 rotation on each axis XYZ. When using a 640x480 sensor my reprojection error was mostly around 0.1 or even better

here a few links that got me in the right direction: How to verify the correctness of calibration of a webcam?

like image 40
jayce Avatar answered Sep 29 '22 21:09

jayce