SolveP3P() returns assertion error

cv2.solveP3P() returns assertion errors.

The reproducer…

points3d = np.array([
	(0.0, 0.0, 0.0),
	(0.0, 0.0, 0.0),
	(0.0, 0.0, 0.0),
],dtype=np.float32)

impoints = np.array([
	(0.0, 0.0),
	(0.0, 0.0),
	(0.0, 0.0)
	],dtype = "double")

imagePoints = np.ascontiguousarray(impoints[:,:2]).reshape(impoints.shape[0],1,2)
success, rvec, tvec = cv2.solveP3P(points3d, imagePoints, camera_matrix, distortion_coeff,0)

This code returns the following error.

cv2.error: OpenCV(4.5.4) /tmp/opencv-20211208-61021-1x46q66/opencv-4.5.4/modules/calib3d/src/solvepnp.cpp:432: error: (-215:Assertion failed) flags == SOLVEPNP_P3P || flags == SOLVEPNP_AP3P in function 'solveP3P'

Did I miss anything?

Thanks in advance.

why did you put a 0 for the flag param ?
error clearly states, that you need either flags == SOLVEPNP_P3P || flags == SOLVEPNP_AP3P

I copied the part from solvePnP() code and forgot to change the value.
Simply giving cv2.SOLVEPNP_P3P solved problem.

Thank you.