Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[camera_calibration] OpenCV Error: Assertion failed (ni > 0 && ni == ni1) #225

Closed
MartinPeris opened this issue Oct 4, 2016 · 0 comments

Comments

@MartinPeris
Copy link
Contributor

When calibrating a stereo camera with multiple calibration patterns, the following error occurs under some circumstances:

OpenCV Error: Assertion failed (ni > 0 && ni == ni1) in collectCalibrationData, file /build/buildd/opencv-2.4.8+dfsg1/modules/calib3d/src/calibration.cpp, line 3193
Traceback (most recent call last):
  File "/opt/ros/indigo/lib/camera_calibration/cameracalibrator.py", line 244, in on_mouse
    self.c.do_calibration()
  File "/opt/ros/indigo/lib/python2.7/dist-packages/camera_calibration/calibrator.py", line 1093, in do_calibration
    self.cal_fromcorners(self.good_corners)
  File "/opt/ros/indigo/lib/python2.7/dist-packages/camera_calibration/calibrator.py", line 865, in cal_fromcorners
    self.r.cal_fromcorners(rcorners)
  File "/opt/ros/indigo/lib/python2.7/dist-packages/camera_calibration/calibrator.py", line 603, in cal_fromcorners
    flags = self.calib_flags)
cv2.error: /build/buildd/opencv-2.4.8+dfsg1/modules/calib3d/src/calibration.cpp:3193: error: (-215) ni > 0 && ni == ni1 in function collectCalibrationData


Steps to reproduce the error:

  • Print two calibration chessboards: 9x6 and 8x6 (in my case the square size for 9x6 was 0.0315m and for 8x6 was 0.021m)
  • Start your stereo camera (with whatever rosrun/roslaunch command appropriate for your camera)
  • Start the calibration node:

rosrun camera_calibration cameracalibrator.py --size=9x6 --square 0.0315 --size=8x6 --square 0.021

  • Swing the 9x6 calibration chessboard around until the "Calibrate" button is activated.
  • Move the 9x6 calibration chessboard towards the edge of one of the images until you get something similar to the following screenshot (notice that on the left image the chessboard is detected as 9x6 but on the right image the chessboard is detected as 8x6):

bad_chessboard_detection

  • Click the "Calibrate" button and enjoy your "Assertion failed" error.

The stereo calibration node is not checking if the calibration pattern detected in left and right images are the same.

MartinPeris added a commit to MartinPeris/image_pipeline that referenced this issue Oct 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant