realizator / stereopi-fisheye-robot

Python stereoscopic robot vision
GNU General Public License v3.0
45 stars 25 forks source link

Error during step 4 calibration #1

Open wimg opened 3 years ago

wimg commented 3 years ago

I'm getting errors during step 4 (calibration of the fisheye) : `$ python 4_calibration_fisheye.py Main cycle start Import pair No 1 Scale ratio: 0.5 Import pair No 2 Scale ratio: 0.5 Import pair No 3 Scale ratio: 0.5 Import pair No 4 Scale ratio: 0.5 Import pair No 5 Pair No 5 ignored, as no chessboard found Import pair No 6 Scale ratio: 0.5 Import pair No 7 Pair No 7 ignored, as no chessboard found Import pair No 8 Scale ratio: 0.5 Import pair No 9 Scale ratio: 0.5 Import pair No 10 Pair No 10 ignored, as no chessboard found Import pair No 11 Scale ratio: 0.5 Import pair No 12 Pair No 12 ignored, as no chessboard found Import pair No 13 Scale ratio: 0.5 Import pair No 14 Pair No 14 ignored, as no chessboard found Import pair No 15 Pair No 15 ignored, as no chessboard found Import pair No 16 Scale ratio: 0.5 Import pair No 17 Scale ratio: 0.5 Import pair No 18 Scale ratio: 0.5 Import pair No 19 Pair No 19 ignored, as no chessboard found Import pair No 20 Scale ratio: 0.5 Import pair No 21 Scale ratio: 0.5 Import pair No 22 Pair No 22 ignored, as no chessboard found Import pair No 23 Pair No 23 ignored, as no chessboard found Import pair No 24 Pair No 24 ignored, as no chessboard found Import pair No 25 Scale ratio: 0.5 Import pair No 26 Scale ratio: 0.5 Import pair No 27 Scale ratio: 0.5 Import pair No 28 Scale ratio: 0.5 Import pair No 29 Pair No 29 ignored, as no chessboard found Import pair No 30 Pair No 30 ignored, as no chessboard found End cycle Left camera calibration... Right camera calibration... Stereoscopic calibration... ./calibration_data/240p/camera_calibration_left.npz ['camera_matrix', 'distortion_coeff', 'imgpoints', 'map1', 'map2', 'objpoints'] Camera calibration data has been found in cache. ./calibration_data/240p/camera_calibration_right.npz ['camera_matrix', 'distortion_coeff', 'imgpoints', 'map1', 'map2', 'objpoints'] Camera calibration data has been found in cache. Calibrating cameras together... Traceback (most recent call last): File "4_calibration_fisheye.py", line 296, in result = calibrate_stereo_cameras() File "4_calibration_fisheye.py", line 254, in calibrate_stereo_cameras cv2.CALIB_FIX_INTRINSIC, TERMINATION_CRITERIA) cv2.error: OpenCV(3.4.4) /home/pi/packaging/opencv-python/opencv/modules/calib3d/src/fisheye.cpp:1420: error: (-3:Internal error) CALIB_CHECK_COND - Ill-conditioned matrix for input array 0 in function 'CalibrateExtrinsics'

$ `

Any idea what might be wrong ?

TuanNguyenSKKU commented 3 years ago

This is the same situation for me, does anyone support us to solve this issue? Thank you.

realizator commented 3 years ago

Hi @wimg and @TuanNguyenSKKU, This issue caused by images, where the chess corners are too close to the left side of the image. AFAIK, this is fixed in the latest OpenCV builds, but there are no stable builds of them on the PiWheels (used for OpenCV installation by pip). Please try this workaround. If it works for you, I will add this code to the 4th script.

TuanNguyenSKKU commented 3 years ago

hi @realizator, Thank you so much.