Ask Your Question
0

Problems with StereoCalibrate

asked 2012-08-21 13:16:09 -0500

lich gravatar image

Hi, I wanted to calibrate my camera system using the SteroCalibrate function and then undistort the images. But the undistort function rather returns extremely distorted images, which is not the case when I calibrate each camera seperately. The strange thing is, I get the same distorted images with the "official" OpenCV sample program.

I guess, it won't be a problem to calibrate each camera itself and then compute the projection matrices with the stereoRectify function, but how do I get the translation vector T?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2012-08-22 01:38:39 -0500

If you are getting the same effect on your images using the "official" OpenCV sample calibration program, then the problem is likely in your images.

The first thing that comes to my mind is: What kind of stereo camera rig are you using? Is it a commercial stereo camera or is it custom made? For best results the left and right cameras should be as parallel as possible. Otherwise you can get wildly undistorted images depending on how much overlapping area there is between left and right cameras.

Second: how many images are you using for calibration? For best results you should use images with the calibration pattern in as many different positions and orientations as possible.

Maybe if you post some example images we could be more helpful.

edit flag offensive delete link more

Comments

Thank you for your response!

I don't think the images are the problem. With the ones provided by OpenCV the result is even worse. Besides, the "normal" calibrate function works perfectly.

The stereo camera is custom made, but we paid much attention to the parallel alignment of the cameras. Also I thought, the distortion coefficients for each camera are computed independently of each other, aren't they?

I am using 52 images from each camera with the chessboard in nearly every possible position and orientation. I am afraid, for privacy reasons, I can't post the images, because they are not my property.

lich gravatar imagelich ( 2012-08-22 04:19:11 -0500 )edit
2

That is not the case. Im also on the "stereo business" :P and opencv clearly states that the default stereo calibration calibrates each camera and the stereo rig using the same images You have to make your own code in order to firstly calibrate each camera seperately (that means different images for each camera) and then calibrate the stereo rig. Also use the dotted pattern instead of the squares one, it produces better results. I managed to have an error of 0.3 pixels for each camera and a total of 0.4 pixels this way

AgentCain gravatar imageAgentCain ( 2012-08-22 05:18:43 -0500 )edit

Sorry I don't understand what you are saying. How is it possible not to use different images for each camera?

lich gravatar imagelich ( 2012-08-22 05:59:12 -0500 )edit

First step is to use the function calibrateCamera() for each of your cameras. So youll end up with intrinsic and extrinsic parameters for each camera seperately. Second step is to use the function stereoCalibrate() with the flag CV_CALIB_FIX_INTRINSIC enabled. This way it will only calculate the R,T,E and F parameters.

Inside the opencv documentation it clearly says that:

"due to the high dimensionality of the parameter space and noise in the input data, the function can diverge from the correct solution. If the intrinsic parameters can be estimated with high accuracy for each of the cameras individually (for example, using calibrateCamera() ), you are recommended to do so and then pass CV_CALIB_FIX_INTRINSIC flag to the function along with the computed intrinsic parameters. "

AgentCain gravatar imageAgentCain ( 2012-08-22 10:46:07 -0500 )edit

Oh I see, I somehow missed this paragraph in the documentation.

Now it works, though it does not make sense to me. However, thank you very much!

lich gravatar imagelich ( 2012-08-22 12:16:57 -0500 )edit

You're welcome. I guess calibrating each camera helps because you can cover the whole FOV of the camera. Calibrating it through a stereo rig decreases this area to just the common FOV of the stereo rig.

AgentCain gravatar imageAgentCain ( 2012-08-23 02:40:59 -0500 )edit
Login/Signup to Answer

Question Tools

Stats

Asked: 2012-08-21 13:16:09 -0500

Seen: 2,754 times

Last updated: Aug 22 '12