Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

solvePnP not woking

I'm trying to run the simplest possible example in solvePnP in pyOpenCV (3.3)

camera_matrix_left = np.eye(3)
dist_left = np.zeros((5, 1))

image_points = np.array([[1,2], [2,3]])
object_points = np.array([[1,2,0], [2,3,0]])


cv2.solvePnP(image_points, object_points, camera_matrix_left, dist_left)

This is the error I'm getting:

OpenCV Error: Assertion failed (npoints >= 4 && npoints == std::max(ipoints.checkVector(2, CV_32F), ipoints.checkVector(2, CV_64F))) in solvePnP, file /Users/travis/miniconda3/conda-bld/opencv_1506476120161/work/opencv-3.3.0/modules/calib3d/src/solvepnp.cpp, line 64
Traceback (most recent call last):
  File "/Users/me/Documents/Code/my_project/file.py", line 140, in <module>
    cv2.solvePnP(image_points, object_points, camera_matrix_left, dist_left)
cv2.error: /Users/travis/miniconda3/conda-bld/opencv_1506476120161/work/opencv-3.3.0/modules/calib3d/src/solvepnp.cpp:64: error: (-215) npoints >= 4 && npoints == std::max(ipoints.checkVector(2, CV_32F), ipoints.checkVector(2, CV_64F)) in function solvePnP

I'd really appreciate some help, as I'm at a loss for how to continue.