Merge pull request #6816 from phunsukwangdu:devbranch1

This commit is contained in:
Vadim Pisarevsky 2016-07-19 15:50:11 +00:00
commit 705e776f09
2 changed files with 5 additions and 5 deletions

View File

@ -130,11 +130,11 @@ for fname in images:
if ret == True: if ret == True:
objpoints.append(objp) 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) imgpoints.append(corners)
# Draw and display the 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.imshow('img', img)
cv2.waitKey(500) cv2.waitKey(500)

View File

@ -70,15 +70,15 @@ for fname in glob.glob('left*.jpg'):
corners2 = cv2.cornerSubPix(gray,corners,(11,11),(-1,-1),criteria) corners2 = cv2.cornerSubPix(gray,corners,(11,11),(-1,-1),criteria)
# Find the rotation and translation vectors. # 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 # project 3D points to image plane
imgpts, jac = cv2.projectPoints(axis, rvecs, tvecs, mtx, dist) imgpts, jac = cv2.projectPoints(axis, rvecs, tvecs, mtx, dist)
img = draw(img,corners2,imgpts) img = draw(img,corners2,imgpts)
cv2.imshow('img',img) cv2.imshow('img',img)
k = cv2.waitKey(0) & 0xff k = cv2.waitKey(0) & 0xFF
if k == 's': if k == ord('s'):
cv2.imwrite(fname[:6]+'.png', img) cv2.imwrite(fname[:6]+'.png', img)
cv2.destroyAllWindows() cv2.destroyAllWindows()