How to use solvePnP with new set of 2d points

I am having trouble using solvePNPRansac correctly. I try to estimate the camera pose for each frame of a video. I have a set of 3d points using recoverPose then TriangulatePoints after selecting keyframes. But I also would like to have the pose for all the frames between so I am trying to use solvePNPRansac with the set of 3d points and the newly detected 2d points. However the two set are not of the same size, and I am having this error:

cv2.error: OpenCV(4.5.1) error: (-215:Assertion failed) npoints >= 4 && npoints == std::max(ipoints.checkVector(2, CV_32F), ipoints.checkVector(2, CV_64F)) in function ‘cv::solvePnPRansac’

I am not sure how I should select the correct points in this case.
Do you have some suggestions?

how do you do this ? seems you did not supply the minimum required number of 4 2d points

I have 552 3D points and 594 2D points, the 2d points are detected in each keyframe then tracked using optical flow

I have the same problem with solvePnPRansac. I get the same error message despite sending in a (1 row, 3 col) numpy.ndarray, and a (917 row, 2 col )numpy.ndarray. I really would appreciate help in solving this.

try reshaping to (-1, 1, 3) or (-1, 1, 2)

that’s equivalent to a column vector of 2/3-channel elements

Thanks, all sorted now, my mistake.