3

Ive implemented a stereo pipeline in Matlab multiple times, and now I am trying to implement one in OpenCV. Ive been following Martin Peris's reconstruction: http://blog.martinperis.com/2012/01/3d-reconstruction-with-opencv-and-point.html

When implementing with Matlab, my pipeline goes like this: calibration -> rectification -> stereo matching -> unrectify/unwarp matches -> triangulate matches.

In OpenCV, the pipeline goes like this calibration -> rectification -> stereo matching -> reprojectTo3D

with the reprojectTo3D function here: http://docs.opencv.org/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html#void%20reprojectImageTo3D%28InputArray%20disparity,%20OutputArray%20_3dImage,%20InputArray%20Q,%20bool%20handleMissingValues,%20int%20ddepth%29

Is it not doing triangulation? How is this possible? Is it assuming the cameras are in a canonical setup and parallel already?

1 Answers1

3

OpenCV pipeline gets a disparity map for triangulation from stereo matching, and the projection matrices of the cameras from calibration and rectification steps. You could use triangualtePoints with positions of points viewed from both cameras and their projection matrices from stereoRectify function. The main algorithm is the same, You just use slightly different intermediate products.

morynicz
  • 2,322
  • 2
  • 20
  • 34
  • In my view, there is minor error in the answer. You could use triangualtePoints with positions of points viewed from both cameras and their projection matrices(not their positions) from stereoRectify function. – Jogging Song May 08 '14 at 02:43
  • Yeah, You are right. I thought that projection matrices contain information about camera positions, but even if it's true, there is a lot more than that. Fixed. – morynicz May 08 '14 at 06:38