ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Do i need to calibrate my cameras everytime to use?

asked 2017-05-21 12:04:26 -0500

naveenT1010 gravatar image

updated 2017-05-21 12:05:31 -0500

Hi, I have two cameras, same make and model and I wanted to get a disparity map using these two as stereo cameras. What doubt I have is that do I need to calibrate my cameras every time I use them or is it just for one time setup. Also I wanted to know what difference does it make when I calibrate each camera alone and when I calibrate both simultaneously.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2017-05-21 18:18:32 -0500

Geoff gravatar image

You do not need to calibrate a camera every time you use it. The output of a camera calibration is saved in a file named after your camera in the ~/.ros/camera_info directory (for example, for a camera named elecom_ucam you would get a file named ~/.ros/camera_info/elecom_ucam.yaml). The name used for this file comes from the camera_name parameter passed to the camera driver nodes. Nodes that use the camera_info_manager and follow the camera driver conventions do this - see here for a list.

So you can specify a name for your cameras in the launch file, e.g.:

<node name="left_camera" pkg="usb_cam" type="usb_cam_node" output="screen">
  <param name="camera_name" value="stereo_cam_left"/>
  <param name="camera_frame_id" value="stereo_cam_left_link"/>
  <param name="video_device" value="/dev/video0"/>

<node name="right_camera" pkg="usb_cam" type="usb_cam_node" output="screen">
  <param name="camera_name" value="stereo_cam_right"/>
  <param name="camera_frame_id" value="stereo_cam_right_link"/>
  <param name="video_device" value="/dev/video01"/>

This will link the two camera names to the two devices. Then run the stereo calibration routine:

rosrun camera_calibration --size 8x6 --square 0.108 \
    left:=/left_camera/image_raw left_camera:=/left_camera \
    right:=/right_camera/image_raw right_camera:=/right_camera

When you commit the data it will save the camera information in ~/.ros/camera_info. This will be used automatically every time you start your camera nodes using the same camera names.

Calibrating both cameras simultaneously is not strictly necessary but if they are fixed together it is more convenient because you only need to go through the process once.

edit flag offensive delete link more


Okay thanks for clearing this out.

naveenT1010 gravatar image naveenT1010  ( 2017-05-21 19:16:43 -0500 )edit

answered 2017-05-22 01:33:35 -0500

NEngelhard gravatar image

What @Geoff told you is perfectly right from the software perspective. The other perspective is more hardware related. You didn't say anything about what kind of cameras you use, how you attached them or what level of accuracy you need.

Industrial stereo cameras are constantly adapting their relative pose to compensate for small relative movements due to temperature. If you just want to get experience with a stereo setup and do not care about accuracy, calibrating once could be sufficient, but your cameras will decalibrate and then the famous "but it was working better when I used it yesterday" will happen.

So you could now and then check you calibration, e.g. by detecting a pattern in the left image, project the features into the right image and verify that they are still close to their detection in the right image.

edit flag offensive delete link more


Actually I am using two Pointgrey GigE cameras for making a stereo setup. Does the fact that this setup inherently is not a stereo camera pose a problem if i want to get the disparity map? Like, although I have fixed the cameras, they sometimes suffer movements or slight change is orientation.

naveenT1010 gravatar image naveenT1010  ( 2017-05-22 09:24:47 -0500 )edit

Industrial cameras have at least good mounting possibilities. Screw them to a metal bar and you should be good to go. Simply set up the system, calibrate it and check it regularly. This will tell you if your mounting is good.

NEngelhard gravatar image NEngelhard  ( 2017-05-22 10:03:04 -0500 )edit

Question Tools



Asked: 2017-05-21 12:04:26 -0500

Seen: 574 times

Last updated: May 22 '17