I am trying to follow the ROS monocular camera calibration for a USB camera I have, but the calibration routine fails when I try to run it. I was expecting to see an image like the one below, but I get a segmentation fault instead.

enter image description here

These are the commands I used to try to start the calibration routine:

mona@Mona:~$ roscore
mona@Mona:~/catkin_ws/src/usb_cam$  rosrun usb_cam usb_cam_node
mona@Mona:~/catkin_ws/src/usb_cam$ rosrun rviz rviz
mona@Mona:~/catkin_ws/src/usb_cam$ rosrun camera_calibration cameracalibrator.py --size 8x6 --square 0.108 image:=/camera/image_raw camera:=/camera

But this is the output I get:

('Waiting for service', '/camera/set_camera_info', '...')
Service not found
Segmentation fault (core dumped)

What am I missing? How should I get it to work? When I list the ROS topics, I get:

$ rostopic list
  • $\begingroup$ Just for your information, holding the calibration target like that is not a good idea. It will introduce unnecessary errors in your calibration result. $\endgroup$ – C.O Park Aug 5 '18 at 4:30

Based on rostopic list I realized the correct name of camera: /usb_cam instead of /camera so the command changed to

$ rosrun camera_calibration cameracalibrator.py --size 8x6 --square 0.108 image:=/usb_cam/image_raw camera:=/usb_cam
('Waiting for service', '/usb_cam/set_camera_info', '...')

Using the /usb_cam name, I was able to connect to the camera and get video:

enter image description here

You might notice that CALIBRATE button is grayed out so you would need to move in various direction (back and forth/right and left) so it becomes green. Eventually you will see the following (pretty much like calibrating a parrot drone):

enter image description here

Now go ahead and press the calibrate button and you are good to go.

For example, I am interested in the fx, fy, cx, cy that are presented in camera matrix. There are output on screen after you click on CALIBRATE button:

enter image description here

  • 1
    $\begingroup$ I edited both your question and answer for clarity. Thanks for the feedback, and I'm happy you solved your problem! Please do try to remember to come back and accept the answer. It's a good question, good answer, so I upvoted both! Congrats again on solving the problem :) $\endgroup$ – Chuck Aug 2 '18 at 18:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.