5

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!

user2812874
  • 99
  • 1
  • 2
  • 4
  • 1
    I would also love to know that. There's a lot of API explained in OpenCV, but not what you're actually supposed to do pysically. – nh2 Sep 23 '14 at 15:33

2 Answers2

4

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 !

Engine
  • 5,360
  • 18
  • 84
  • 162
  • 1
    I already understand the working principle of this function, but I wanted to know the calculations behind it. Assume that the chessboard is 7x7 and every square has a dimension of 2x2cm. How does the method estimates the distance from camera to the chessboard? Because if the chessboard is far away from the cam but the cam has a huge zoom lens, the image will be the same as it was held closeby with a normal lens. The only way i see to get a better estimate, is to have some images were the chessboard is tilted a bit... Or is there something else i don't see? – user2812874 Dec 20 '13 at 19:43
  • There are lots of articles regarding this subject. Also, numerous questions are asked in stackoverflow. If you take a look at O'Reily's OpenCV book (or any appropriate book), you would understand the working principle of the concept. – satishffy Dec 21 '13 at 09:07
1

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?

Community
  • 1
  • 1
jayce
  • 11
  • 2
  • 1
    I've heard that placing the chessboard on a parallel plane to the image plane (camera looking straight forwards at it) introduces calibration errors. – rbaleksandar May 02 '14 at 08:24