Commit f4dc4b43 authored by Vadim Pisarevsky's avatar Vadim Pisarevsky

fixed calibrateCamera API (ticket #1143)

parent d5ba7c38
...@@ -562,7 +562,7 @@ CV_EXPORTS_W double calibrateCamera( InputArrayOfArrays objectPoints, ...@@ -562,7 +562,7 @@ CV_EXPORTS_W double calibrateCamera( InputArrayOfArrays objectPoints,
Size imageSize, Size imageSize,
CV_IN_OUT InputOutputArray cameraMatrix, CV_IN_OUT InputOutputArray cameraMatrix,
CV_IN_OUT InputOutputArray distCoeffs, CV_IN_OUT InputOutputArray distCoeffs,
OutputArray rvecs, OutputArray tvecs, OutputArrayOfArrays rvecs, OutputArrayOfArrays tvecs,
int flags=0 ); int flags=0 );
//! computes several useful camera characteristics from the camera matrix, camera frame resolution and the physical sensor size. //! computes several useful camera characteristics from the camera matrix, camera frame resolution and the physical sensor size.
......
...@@ -3351,7 +3351,7 @@ cv::Mat cv::initCameraMatrix2D( InputArrayOfArrays objectPoints, ...@@ -3351,7 +3351,7 @@ cv::Mat cv::initCameraMatrix2D( InputArrayOfArrays objectPoints,
double cv::calibrateCamera( InputArrayOfArrays _objectPoints, double cv::calibrateCamera( InputArrayOfArrays _objectPoints,
InputArrayOfArrays _imagePoints, InputArrayOfArrays _imagePoints,
Size imageSize, InputOutputArray _cameraMatrix, InputOutputArray _distCoeffs, Size imageSize, InputOutputArray _cameraMatrix, InputOutputArray _distCoeffs,
OutputArray _rvecs, OutputArray _tvecs, int flags ) OutputArrayOfArrays _rvecs, OutputArrayOfArrays _tvecs, int flags )
{ {
int rtype = CV_64F; int rtype = CV_64F;
Mat cameraMatrix = _cameraMatrix.getMat(); Mat cameraMatrix = _cameraMatrix.getMat();
......
...@@ -51,7 +51,8 @@ if __name__ == '__main__': ...@@ -51,7 +51,8 @@ if __name__ == '__main__':
camera_matrix = np.zeros((3, 3)) camera_matrix = np.zeros((3, 3))
dist_coefs = np.zeros(4) dist_coefs = np.zeros(4)
img_n = len(img_points) img_n = len(img_points)
rvecs = [np.zeros(3) for i in xrange(img_n)] rms, camera_matrix, dist_coefs, rvecs, tvecs = cv2.calibrateCamera(obj_points, img_points, (w, h), camera_matrix, dist_coefs)
tvecs = [np.zeros(3) for i in xrange(img_n)] print "RMS:", rms
rms = cv2.calibrateCamera(obj_points, img_points, (w, h), camera_matrix, dist_coefs) #, rvecs, tvecs) print "camera matrix: ", camera_matrix
print rms print "distortion coefficients: ", dist_coefs
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment