erget / StereoVision

Library and utilities for 3d reconstruction from stereo cameras.
http://erget.github.io/StereoVision
GNU General Public License v3.0
648 stars 268 forks source link

cvCalibration2 bug in calibrate_cameras #16

Closed melhousni closed 7 years ago

croomjm commented 7 years ago

Second this pull request. Without this change, I get the following error.

cv2.error: /Users/jhelmus/anaconda/conda-bld/work/opencv-2.4.8/modules/calib3d/src/calibration.cpp:1477: error: (-211) image width and height must be positive in function cvCalibrateCamera2

Per cv2 docs, arguments should be listed in the following order:

Python: cv2.stereoCalibrate(objectPoints, imagePoints1, imagePoints2, imageSize[, cameraMatrix1[, distCoeffs1[, cameraMatrix2[, distCoeffs2[, R[, T[, E[, F[, criteria[, flags]]]]]]]]]]) → retval, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, R, T, E, F

erget commented 7 years ago

Thanks for this!

sokol07 commented 5 years ago

I just had the same problem with Python 3.7 and OpenCV 3.4.3.18. I had to move the self.image_size back between dist_coefs["right"] and calib.rot_mat.