Camera Calibration Code - Opencv Error: Assertion Failed
I'm trying to execute this code for camera calibration. This code is detecting corners but after that error is coming. OpenCV Error: Assertion failed (nimages > 0) in unknown
Solution 1:
In your code you have:
objpoints = []
but you never append anything to it. You are missing:
objpoints .append(objp )
after the line
imgpoints.append(corners)
One extra thing, you should check if they have points before doing calibration like:
iflen(objpoints) == len(imgpoints) andlen(objpoints) > 0:
ret, mtx, dist, rvecs, tvecs = cv2.calibrateCamera(objpoints, imgpoints, gray.shape[::-1],None,None)
else:
print("not enough points to calibrate")
Post a Comment for "Camera Calibration Code - Opencv Error: Assertion Failed"