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

How to calibrate dual (stereo) camera and obtain data?

asked 2016-07-14 20:42:58 -0500

QCBKoala gravatar image


My knowledge of ROS/Linux is limited, so I'm hoping someone could kindly help me.

I am using Virtual Box running Linux 14.04, and ROS Indigo.

I am trying to use a dual camera setup in order to obtain stereo vision via ROS. The cameras are on this USB module that I can access, and when I try to open it in Windows, I see the cameras as two different devices. I can also see them as two video devices on my VM.

ls /dev/video*

/dev/video0 /dev/video1

However, both cheese nor GTK UVC video viewer was unable to open the device. Cheese says "There was an error playing video from the webcam" even though I can see the device being selected in its Preferences. GTK UVC just captures blackness.

I also tried to use cv_camera but that did not give me a launch file to use. So I tried libuvc_camera but that also didn't give me a launch file.

I basically did these and not sure how to go from there, without a launch file:

sudo apt-get install ros-indigo-cv-camera

sudo apt-get install ros-indigo-libuvc-camera

I don't know how to get them to work. I then tried to do the same with the usb_camera package, which has a launch file:

roslaunch usb_cam usb_cam-test.launch

But when I used the launch, I get these errors:

setting /run_id to e42f368a-4a2b-11e6-a2c1-08002755c1aa

process[rosout-1]: started with pid [11222]

started core service [/rosout]

process[usb_cam-2]: started with pid [11236]

process[image_view-3]: started with pid [11240]

[ INFO] [1468546306.052415844]: Using transport "raw"

[ INFO] [1468546306.480381780]: using default calibration URL

[ INFO] [1468546306.480561586]: camera calibration URL: file:///home/max/.ros/camera_info/head_camera.yaml

[ INFO] [1468546306.480649985]: Unable to open camera calibration file [/home/max/.ros/camera_info/head_camera.yaml]

[ WARN] [1468546306.480709246]: Camera calibration file /home/max/.ros/camera_info/head_camera.yaml not found.

[ INFO] [1468546306.480765315]: Starting 'head_camera' (/dev/video0) at 640x480 via mmap (yuyv) at 30 FPS

[ERROR] [1468546306.742666755]: VIDIOC_STREAMON error 5, Input/output error

[usb_cam-2] process has died [pid 11236, exit code 1, cmd /opt/ros/indigo/lib/usb_cam/usb_cam_node __name:=usb_cam __log:=/home/max/.ros/log/e42f368a-4a2b-11e6-a2c1-08002755c1aa/usb_cam-2.log]. log file: /home/max/.ros/log/e42f368a-4a2b-11e6-a2c1-08002755c1aa/usb_cam-2*.log

Basically 1) I don't know if my webcam is actually connected and 2) I don't know how to use the packages that might help me extract the camera data (let alone stereo data). I know I need to do camera calibration at some point, but I thought libuvc_camera is the best option for that.

I'm very stuck, so any help is appreciated. Thank you.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-08-02 01:55:16 -0500

ponsheng gravatar image

Hi, I'm doing the same thing as yours. I have successfully use ucv_camera as camera driver with a launch file below:

mono.launch (use to open one camera)

    <group ns="camera">
        <node pkg="uvc_camera" type="uvc_camera_node" name="mycam">
            <!-- Parameters used to find the camera -->
            <param name="device" value="/dev/video0"/>

stereo.laumch (open two camera)

      <group ns="stereo">
           <node pkg="uvc_camera" type="uvc_stereo_node" name="mycam">
           <!-- Parameters used to find the camera -->
           <param name="left/device" value="/dev/video0"/>
           <param name="right/device" value="/dev/video1"/>
           <param name="width" value="640" />
           <param name="height" value="480" />

You can set other parameter as well.

And use image_view to check if driver works.

Hope this hlep you.

edit flag offensive delete link more


It seems to have worked, with some modifications and in combination with another package. Thanks :)

And I spent all day today trying to extract depth data using the stereo images - with little success. If this is similar to what you're doing, do you think we can share notes? Thanks!

QCBKoala gravatar image QCBKoala  ( 2016-08-02 20:52:54 -0500 )edit

Question Tools


Asked: 2016-07-14 20:42:58 -0500

Seen: 1,840 times

Last updated: Aug 02 '16