Hello, I was wondering about the practical use of the cv2.solvePnP() function, and didn’t manage to find a solution in your GitHub repository mentioned in the paper - what parameters does it expect? I tried to pass an [x, y] vector for image points, an [x, y, z] vector for object points and a 3x3 two dimensional list for the camera matrix, however it gave me the following error:

cv2.error: OpenCV(4.0.0) C:\projects\opencv-python\opencv\modules\calib3d\src\solvepnp.cpp:92: error: (-215:Assertion failed) ( (npoints >= 4) || (npoints == 3 && flags == SOLVEPNP_ITERATIVE && useExtrinsicGuess) ) && npoints == std::max(ipoints.checkVector(2, CV_32F), ipoints.checkVector(2, CV_64F)) in function ‘cv::solvePnP’

If it helps, this is the exact code that caused it:

two_d = cv2.UMat(np.array([x, y], dtype=np.uint8))

three_d = cv2.UMat(np.array([distance, constants.TARGET_SIZES[‘2019’][‘height’], 0], dtype=np.uint8))

camera_matrix = cv2.UMat(np.array([[constants.FOCAL_LENGTHS[‘realsense’], 0, frame_center_x],

[0, constants.FOCAL_LENGTHS[‘realsense’], frame_center_y],

[0, 0, 1]], dtype=np.uint8))

tvec, rvec = cv2.solvePnP(three_d, two_d, camera_matrix, None)