Ask Your Question

Revision history [back]

bug found in a tutorial

I think I have found a bug in this tutorial: http://docs.opencv.org/trunk/doc/py_tutorials/py_calib3d/py_pose/py_pose.html for this part: def draw(img, corners, imgpts): corner = tuple(corners[0].ravel()) img = cv2.line(img, corner, tuple(imgpts[0].ravel()), (255,0,0), 5) img = cv2.line(img, corner, tuple(imgpts[1].ravel()), (0,255,0), 5) img = cv2.line(img, corner, tuple(imgpts[2].ravel()), (0,0,255), 5) return img because cv2.line() return none, img will be nonetype. so the correct way should be: def draw(img, corners, imgpts): corner = tuple(corners[0].ravel()) cv2.line(img, corner, tuple(imgpts[0].ravel()), (255,0,0), 5) cv2.line(img, corner, tuple(imgpts[1].ravel()), (0,255,0), 5) cv2.line(img, corner, tuple(imgpts[2].ravel()), (0,0,255), 5) return img

bug found in a tutorial

I think I have found a bug in this tutorial: http://docs.opencv.org/trunk/doc/py_tutorials/py_calib3d/py_pose/py_pose.html for tutorial. It is focussed in this part: part:

def draw(img, corners, imgpts):
 corner = tuple(corners[0].ravel())
 img = cv2.line(img, corner, tuple(imgpts[0].ravel()), (255,0,0), 5)
 img = cv2.line(img, corner, tuple(imgpts[1].ravel()), (0,255,0), 5)
 img = cv2.line(img, corner, tuple(imgpts[2].ravel()), (0,0,255), 5)
 return img

because cv2.line() return img because cv2.line() return none, none, img will be nonetype. so nonetype. So the correct way should be: be:

def draw(img, corners, imgpts):
 corner = tuple(corners[0].ravel())
 cv2.line(img, corner, tuple(imgpts[0].ravel()), (255,0,0), 5)
 cv2.line(img, corner, tuple(imgpts[1].ravel()), (0,255,0), 5)
 cv2.line(img, corner, tuple(imgpts[2].ravel()), (0,0,255), 5)
 return img

img