This is the error:
cv2.solvePnP(obj_points, image_points, mtx, dist)
cv2.error: OpenCV(4.2.0) C:\projects\opencv-python\opencv\modules\calib3d\src\solvepnp.cpp:754: 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::solvePnPGeneric'
And this is my code:
mtx = np.load("./camera_params/mtx.npy")
dist = np.load("./camera_params/dist.npy")
obj_points = np.array([[0, 0, 0], [297, 0, 0], [297, 210, 0], [0, 210, 0]])
image_points = np.array([[416, 268], [422, 535], [826, 543], [829, 264]])
cv2.solvePnP(obj_points, image_points, mtx, dist)
I don't have any idea how to solve it. I tried to play with the arguments but it didn't help. If you know a way to solve this error it be very helpful.