I'm using OpenCV 2.3.1 under Ubuntu 12.04, and trying to use the cv2.solvePnP function. I cannot seem to figure out what format the two point arguments are supposed to be in. The document states:
objectPoints – Array of object points in the object coordinate space, 3xN/Nx3 1-channel or 1xN/Nx1 3-channel, where N is the number of points. vector<point3f> can be also passed here.
imagePoints – Array of corresponding image points, 2xN/Nx2 1-channel or 1xN/Nx1 2-channel, where N is the number of points. vector<point2f> can be also passed here.
I have so far tried the following inputs:
- NumPy arrays with shape (N, 3) and (N, 2)
- Numpy arrays with shape (N, 1, 3) and (N, 1, 2)
- Python lists of NumPy arrays of (N,3) and (N,2)
The most typical error I get reads:
cv2.error: /build/buildd/opencv-2.3.1/modules/calib3d/src/solvepnp.cpp:52: error: (-215) npoints >= 0 && npoints == std::max(ipoints.checkVector(2, CV_32F), ipoints.checkVector(2, CV_64F)) in function solvePnP
What format are these two arguments supposed to be in? Is there something I'm missing?