From 98dce911ca46b192423d595e63c272a6488b6810 Mon Sep 17 00:00:00 2001 From: Susmit Date: Thu, 2 Jun 2016 01:06:17 +0530 Subject: [PATCH 1/2] Update py_calibration.markdown In the camera calibration code { cv2.cornerSubPix() } will be of no use.In the updated code it is assigned to the (corners2) variable which is passed down to { cv2.drawChessboardCorners() } --- .../py_calib3d/py_calibration/py_calibration.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/py_tutorials/py_calib3d/py_calibration/py_calibration.markdown b/doc/py_tutorials/py_calib3d/py_calibration/py_calibration.markdown index 9c6c1fb643..1e22cedfb0 100644 --- a/doc/py_tutorials/py_calib3d/py_calibration/py_calibration.markdown +++ b/doc/py_tutorials/py_calib3d/py_calibration/py_calibration.markdown @@ -130,11 +130,11 @@ for fname in images: if ret == True: objpoints.append(objp) - cv2.cornerSubPix(gray,corners, (11,11), (-1,-1), criteria) + corners2=cv2.cornerSubPix(gray,corners, (11,11), (-1,-1), criteria) imgpoints.append(corners) # Draw and display the corners - cv2.drawChessboardCorners(img, (7,6), corners, ret) + cv2.drawChessboardCorners(img, (7,6), corners2, ret) cv2.imshow('img', img) cv2.waitKey(500) From d913463932440b7ba56b4bf527887b509b5ca71a Mon Sep 17 00:00:00 2001 From: Susmit Date: Thu, 2 Jun 2016 17:47:45 +0530 Subject: [PATCH 2/2] Terrible bugs in the tutorial code in py_pose.markdown There were two bugs that were solved here.Changes were done after extreme testing. 1.replaced cv2.solvePnPRansac() with cv2.solvePnP() previous fc was giving terrible errors. 2.The code was incapable of saving edited pics;Now fixed with little code mods. --- doc/py_tutorials/py_calib3d/py_pose/py_pose.markdown | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/py_tutorials/py_calib3d/py_pose/py_pose.markdown b/doc/py_tutorials/py_calib3d/py_pose/py_pose.markdown index f0d48265c9..0ec22c6297 100644 --- a/doc/py_tutorials/py_calib3d/py_pose/py_pose.markdown +++ b/doc/py_tutorials/py_calib3d/py_pose/py_pose.markdown @@ -70,15 +70,15 @@ for fname in glob.glob('left*.jpg'): corners2 = cv2.cornerSubPix(gray,corners,(11,11),(-1,-1),criteria) # Find the rotation and translation vectors. - rvecs, tvecs, inliers = cv2.solvePnPRansac(objp, corners2, mtx, dist) + ret,rvecs, tvecs, inliers = cv2.solvePnP(objp, corners2, mtx, dist) # project 3D points to image plane imgpts, jac = cv2.projectPoints(axis, rvecs, tvecs, mtx, dist) img = draw(img,corners2,imgpts) cv2.imshow('img',img) - k = cv2.waitKey(0) & 0xff - if k == 's': + k = cv2.waitKey(0) & 0xFF + if k == ord('s'): cv2.imwrite(fname[:6]+'.png', img) cv2.destroyAllWindows()