Stereo calibration and triangulation

Hi,

I’m trying to properly calibrate a stereo camera with a very small baseline (2 millimetres).
These are my steps:

  • I calibrated the 2 channels separatelly
  • I use the obtained camera matrixes and distortion coefficients as initializzation for StereoCalibrate.
  • I call StereoCalibrate obtaining the rotation matrix, the translation vector and the updated camera matrixes and distortion coefficients
  • Using the outputs of StereoCalibrate, I call StereoRectify obtaining the rectification transforms and the projection matrixes.

At this point I have left and right channels stereo rectified with an epipolar error lower than 1.

After that, I use the obtained intrinsics and extrinsics parameter to triangulate some points. To evaluate the performances of the triangulation, I am trying to triangulate a checkerboard.
The triangulated points seems like a checkerboard but a curved checkerboard. Moreover, If I measure the euclidean distance between the triangulated points, it decrease if I move the camera away (I would expect it to be constant since the checkerboard size is constant).

If I do everything with a stereo camera with a larger baseline everything work well and I can obtain really precise 3d points of the checkerboard, the points lie on a plane and if I move the camera away the euclidean distance between the triangulated points is partically constant. So I think my calibration workflow is correct but probably with the stereo camera with 2 mm baseline I should use different flags in StereoCalibrate or add/replace some steps.

Do you have any suggestion?

Thank you

I can’t quite make sense of your question/post.

do you understand the difference between “disparity” and “distance/depth”? if yes, I’m out of ideas as well as understanding.

Thank you for your reply.

Yes I know the difference.

I will try to better explain my problem.
I have 2 stereo cameras. Let’s call them A and B.
A is a stereo camera with baseline 12.5 cm.
B is a stereo camera with baseline 2 mm.

I know that the dept is proportional to the disparity so I know that the dept estimation for the stereo camera B will be by definition less accurate than the dept estimation with the stereo camera A because of the shorter baseline.

However, my question is: is there any trick that can be useful to better estimate the dept in the case of the stereo camera B that has a so small baseline?

  • disassemble, reassemble with more baseline
  • use mirrors to cause wider baseline
  • subpixel trickery but that’s a tradeoff between Z resolution and XY resolution
  • don’t image objects that far away, get them closer

for a given geometry, math puts a theoretical limit on things.

2 mm is tiny. that’s either not a stereo camera but an accident of design (was intended to be 0), or you’re dealing with something that’s supposed to be for microscopic applications, in which case 2 mm may be just perfect, relative to the intended object sizes and distances.

Thank you.

Is there any good strategy to choose what flags to use in cv.calibrateCamera and in cv.stereoCalibrate?

trial and error, I’d say :stuck_out_tongue: perhaps lock down everything, feed it ideal model values for cx,cy, … so the optimization can’t mess up too much.

and don’t watch the reprojection error too closely. even if it looks good, the calibration can still suck. don’t even bother with anything simpler than charuco. if I had the time and inclination, I’d give OpenCV some code that extracts the connectivity from arbitrary views of infinite square grids. that’d really make calibration easy because you don’t have to worry about seeing partial arucos, or seeing a partial board, or anything… but I hate C++ and would only offer some python proof of concept code and maybe mentor anyone who’s got the nerve to turn it into C++