Commit d9134639 authored by Susmit's avatar Susmit

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.
parent 98dce911
......@@ -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()
......
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