Stereo vision basics

Hello! I'm new here and in opencv too (and in english language :D).

I want to calibrate my stereo camera. I have read the "Learning OpenCV" book by OReilly, and everything is explicated very well. But at the rectification part I stucked. I don't understand exactly, I have to do the rectification with all of the images, or just with the images with the chessboard, what I'm using to calibrate the camera. And the same problem with the cvInitUndistortRectifyMap function. So I have to use everytime, or just when I calibrate the cameras.

The biggest problem that, my depth map is very poor. I think is because of bad rectification.

edit retag close merge delete

Sort by ยป oldest newest most voted

OpenCV algorithms for computing stereo correspondence (StereoSGBM, StereoBM) require rectified images. If you use them on non-rectified images they won't work correctly.

Rectification is a transformation of images such that projections of the same scene point have equal y-coordinate on both images. E.g. if a projection of some 3D point onto a left image has y-coordinate = 150 it'll have y-coordinate = 150 on the second image. So rectification simplifies finding corresponding points (and subsequently simplifies computation of a depth map).

If you want to build your stereo vision application use the following approach:

1. Calibrate cameras. The simplest approach is to use calibration procedure (stereo_calib.cpp/stereo_calib.exe) distributed in OpenCV examples. This will give intrinsic and extrinsic camera parameters. From rectification procedure you should get reprojection error on the level of 0.5 pixel. Much bigger reprojection error (above 1 pixel) usually means that there're some issues with a calibration.
2. Use stereo camera parameters estimated by stereo calibration procedure to rectify ALL images. You may verify correctness of this step by looking on rectified images: projections of the same scene points on both images should have the same y-coordinate.
3. Use stereo correspondence function on RECTIFIED images. I can suggest using StereoSGBM - it usually produces better results than simple StereoBM procedure.

Function cvInitUndistortRectifyMap needs to be used only once - after you get stereo camera parameters from stereo calibration procedure. This funciton computes a mapping needed to rectify images. Then you rectify ALL images using mapping returned by cvInitUndistortRectifyMap.

more

Thank you very much. This all procedure is more clear now.

"Then you rectify ALL images using mapping returned by cvInitUndistortRectifyMap."

And with cvRemap I can rectify all of my images?

Thanks again...

( 2012-08-29 10:38:41 -0500 )edit