Search code examples
pythonopencvopencv-solvepnp

What does the error fabs(sc) > DBL_EPSILON mean in function cvFindExtrinsicCameraParams2?


I am using the solvePnPRansac function from OpenCV (4.0.0) in python. Sometimes (but not all the time) when I pass points into the function I get an error:

(-215:Assertion failed) fabs(sc) > DBL_EPSILON

in function `cvFindExtrinsicCameraParams2' called from 'solvePnPRansac' (the function I am directly using). Does anyone know what this means or what might be going wrong?

In my use case, I am using 'solvePnPRansac' like this:

_, rvec, t, _ = cv2.solvePnPRansac(pts_3D, pts_2D, K, distortion_coefficients)

Solution

  • In my case pts_3d contained some NaN values. After excluding the specific rows in pts_3d and pts_2d the error was gone.