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

Error when using calibration #23

Closed
1gen100 opened this issue Nov 6, 2019 · 2 comments
Closed

Error when using calibration #23

1gen100 opened this issue Nov 6, 2019 · 2 comments

Comments

@1gen100
Copy link

1gen100 commented Nov 6, 2019

Getting error when running the calibration for pictures that I have taken.

./calibrate -w 11 -h 16 -n 10 -s 0.015 -d "../calib_imgs/1/" -i "left" -o "cam_left.yml" -e "jpg"

Starting Calibration
OpenCV Error: Assertion failed (nimages > 0) in calibrateCamera, file /tmp/binarydeb/ros-kinetic-opencv3-3.3.1/modules/calib3d/src/calibration.cpp, line 3334
terminate called after throwing an instance of 'cv::Exception'
what(): /tmp/binarydeb/ros-kinetic-opencv3-3.3.1/modules/calib3d/src/calibration.cpp:3334: error: (-215) nimages > 0 in function calibrateCamera

Aborted (core dumped)

I used this code to take images:
rosrun image_view image_view image:=/kinect2/hd/image_color_rect

Because i wasn't able to use Kincet v2 with the read function.

@1gen100
Copy link
Author

1gen100 commented Nov 13, 2019

What worked for me was to make a code to take images and resize to 640x360 and save as "jpg" just the same size and type as the test images and using a chessboard with the same size as the test: 6x9 24.23mm
in the code you need to -1 with both the weight and height of the chessboard just as in the lines down here.

left:
./calibrate -w 5 -h 8 -n 10 -s 0.02423 -d "../calib_imgs/1/" -i "left" -o "cam_left.yml" -e "jpg"
right:
./calibrate -w 5 -h 8 -n 10 -s 0.02423 -d "../calib_imgs/1/" -i "left" -o "cam_left.yml" -e "jpg"

But now I have trouble with the calibrate_stereo function:
OpenCV Error: Assertion failed (scn == 3 || scn == 4) in cvtColor, file /tmp/binarydeb/ros-kinetic-opencv3-3.3.1/modules/imgproc/src/color.cpp, line 11111
terminate called after throwing an instance of 'cv::Exception'
what(): /tmp/binarydeb/ros-kinetic-opencv3-3.3.1/modules/imgproc/src/color.cpp:11111: error: (-215) scn == 3 || scn == 4 in function cvtColor

@1gen100
Copy link
Author

1gen100 commented Nov 20, 2019

I found a solution. Here I had my left files in folder 1 and my right files in folder 2, solve it by changing the right folder to "2".
./calibrate_stereo -n 7 -u cam_left.yml -v cam_right.yml -L ../calib_imgs/1/ -R ../calib_imgs/2/ -l left -r right -o cam_stereo.yml -e jpg

Conlusion:

  • If the chessboard is 9x6 you should use 8 and 5 for the function. Look here
  • Have all your images in one folder.
  • and everthing should work fine ;)

@1gen100 1gen100 closed this as completed Nov 20, 2019
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