Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

using calibrationdata file in a launch file

I calibrated my 2 usb cameras (using usb_cam driver) with the camera_calibration tool in stereo vision. As a result I got a /tmp/calibrationdata.tar.gz file. Since I couldn't use the commit function of the calibration tool, all I have is this file. How can I use it?

What I tried:

  • extracted the ost.txt file from the calibrationdata.tar.gz
  • converted it to yaml format using the camera_calibration_parsers tool (2x for left and right camera)
  • in the camera launch file included the following line for both left and right camera:

<param name="left/camera_info_url" type="string" value="file://left_camera_calibration.yaml" />

The camera launch file is as follows:

<launch>
  <group ns="stereo">
    <node name="left" pkg="usb_cam" type="usb_cam_node" output="screen" >
        <param name="video_device" value="/dev/video1" />
        <param name="image_width" value="640" />
        <param name="image_height" value="480" />
        <param name="pixel_format" value="mjpeg" />
        <param name="camera_frame_id" value="left" />
        <param name="io_method" value="mmap"/>      
        <rosparam file="example-left.yaml"/>    
        <param name="left/camera_info_url" type="string" value="file://left_camera_calibration.yaml" />
    </node>

    <node name="right" pkg="usb_cam" type="usb_cam_node" output="screen" >
        <param name="video_device" value="/dev/video2" />
        <param name="image_width" value="640" />
        <param name="image_height" value="480" />
        <param name="pixel_format" value="mjpeg" />
        <param name="camera_frame_id" value="right" />
        <param name="io_method" value="mmap"/>          
        <rosparam file="example-right.yaml"/>   
        <param name="right/camera_info_url" type="string" value="file://right_camera_calibration.yaml" />
    </node>
  </group>  
</launch>

The left.yaml and right.caml files are in the same directory as the launch file, and they looks like this:

image_width: 640
image_height: 480
camera_name: narrow_stereo/left
camera_matrix:
  rows: 3
  cols: 3
  data: [788.542495, 0, 327.486858, 0, 791.888555, 225.27738, 0, 0, 1]
distortion_model: plumb_bob
distortion_coefficients:
  rows: 1
  cols: 5
  data: [0.145671, -0.706881, 0.00285, -0.00085, 0]
rectification_matrix:
  rows: 3
  cols: 3
  data: [0.996588, -0.063317, -0.052951, 0.06356, 0.997974, 0.002905, 0.05266, -0.006261, 0.998593]
projection_matrix:
  rows: 3
  cols: 4
  data: [1224.680474, 0, 566.859081, 0, 0, 1224.680474, 246.882917, 0, 0, 0, 1, 0]

I have the following topics:

/rosout
/rosout_agg
/stereo/left/camera_info
/stereo/left/image_raw
/stereo/left/image_raw/compressed
/stereo/left/image_raw/compressed/parameter_descriptions
/stereo/left/image_raw/compressed/parameter_updates
/stereo/left/image_raw/compressedDepth
/stereo/left/image_raw/compressedDepth/parameter_descriptions
/stereo/left/image_raw/compressedDepth/parameter_updates
/stereo/left/image_raw/theora
/stereo/left/image_raw/theora/parameter_descriptions
/stereo/left/image_raw/theora/parameter_updates
/stereo/right/camera_info
/stereo/right/image_raw
/stereo/right/image_raw/compressed
/stereo/right/image_raw/compressed/parameter_descriptions
/stereo/right/image_raw/compressed/parameter_updates
/stereo/right/image_raw/compressedDepth
/stereo/right/image_raw/compressedDepth/parameter_descriptions
/stereo/right/image_raw/compressedDepth/parameter_updates
/stereo/right/image_raw/theora
/stereo/right/image_raw/theora/parameter_descriptions
/stereo/right/image_raw/theora/parameter_updates

Here I am stucked. I want to use Any idea?

using calibrationdata calibrationdata.tar.gz file in a launch file

I calibrated my 2 usb cameras (using usb_cam driver) with the camera_calibration tool in stereo vision. As a result I got a /tmp/calibrationdata.tar.gz file. Since I couldn't use the commit function of the calibration tool, all I have is this file. How can I use it?

What I tried:

  • extracted the ost.txt file from the calibrationdata.tar.gz
  • converted it to yaml format using the camera_calibration_parsers tool (2x for left and right camera)
  • in the camera launch file included the following line for both left and right camera:

<param name="left/camera_info_url" type="string" value="file://left_camera_calibration.yaml" />

The camera launch file is as follows:

<launch>
  <group ns="stereo">
    <node name="left" pkg="usb_cam" type="usb_cam_node" output="screen" >
        <param name="video_device" value="/dev/video1" />
        <param name="image_width" value="640" />
        <param name="image_height" value="480" />
        <param name="pixel_format" value="mjpeg" />
        <param name="camera_frame_id" value="left" />
        <param name="io_method" value="mmap"/>      
        <rosparam file="example-left.yaml"/>    
        <param name="left/camera_info_url" type="string" value="file://left_camera_calibration.yaml" />
    </node>

    <node name="right" pkg="usb_cam" type="usb_cam_node" output="screen" >
        <param name="video_device" value="/dev/video2" />
        <param name="image_width" value="640" />
        <param name="image_height" value="480" />
        <param name="pixel_format" value="mjpeg" />
        <param name="camera_frame_id" value="right" />
        <param name="io_method" value="mmap"/>          
        <rosparam file="example-right.yaml"/>   
        <param name="right/camera_info_url" type="string" value="file://right_camera_calibration.yaml" />
    </node>
  </group>  
</launch>

The left.yaml and right.caml right.yaml files are in the same directory as the launch file, and they looks like this:

image_width: 640
image_height: 480
camera_name: narrow_stereo/left
camera_matrix:
  rows: 3
  cols: 3
  data: [788.542495, 0, 327.486858, 0, 791.888555, 225.27738, 0, 0, 1]
distortion_model: plumb_bob
distortion_coefficients:
  rows: 1
  cols: 5
  data: [0.145671, -0.706881, 0.00285, -0.00085, 0]
rectification_matrix:
  rows: 3
  cols: 3
  data: [0.996588, -0.063317, -0.052951, 0.06356, 0.997974, 0.002905, 0.05266, -0.006261, 0.998593]
projection_matrix:
  rows: 3
  cols: 4
  data: [1224.680474, 0, 566.859081, 0, 0, 1224.680474, 246.882917, 0, 0, 0, 1, 0]

I have the following topics:

/rosout
/rosout_agg
/stereo/left/camera_info
/stereo/left/image_raw
/stereo/left/image_raw/compressed
/stereo/left/image_raw/compressed/parameter_descriptions
/stereo/left/image_raw/compressed/parameter_updates
/stereo/left/image_raw/compressedDepth
/stereo/left/image_raw/compressedDepth/parameter_descriptions
/stereo/left/image_raw/compressedDepth/parameter_updates
/stereo/left/image_raw/theora
/stereo/left/image_raw/theora/parameter_descriptions
/stereo/left/image_raw/theora/parameter_updates
/stereo/right/camera_info
/stereo/right/image_raw
/stereo/right/image_raw/compressed
/stereo/right/image_raw/compressed/parameter_descriptions
/stereo/right/image_raw/compressed/parameter_updates
/stereo/right/image_raw/compressedDepth
/stereo/right/image_raw/compressedDepth/parameter_descriptions
/stereo/right/image_raw/compressedDepth/parameter_updates
/stereo/right/image_raw/theora
/stereo/right/image_raw/theora/parameter_descriptions
/stereo/right/image_raw/theora/parameter_updates

Here I am stucked. I want to use Any idea?

click to hide/show revision 3
included the content of camera_info

using calibrationdata.tar.gz file in a launch file

I calibrated my 2 usb cameras (using usb_cam driver) with the camera_calibration tool in stereo vision. As a result I got a /tmp/calibrationdata.tar.gz file. Since I couldn't use the commit function of the calibration tool, all I have is this file. How can I use it?

What I tried:

  • extracted the ost.txt file from the calibrationdata.tar.gz
  • converted it to yaml format using the camera_calibration_parsers tool (2x for left and right camera)
  • in the camera launch file included the following line for both left and right camera:

<param name="left/camera_info_url" type="string" value="file://left_camera_calibration.yaml" />

The camera launch file is as follows:

<launch>
  <group ns="stereo">
    <node name="left" pkg="usb_cam" type="usb_cam_node" output="screen" >
        <param name="video_device" value="/dev/video1" />
        <param name="image_width" value="640" />
        <param name="image_height" value="480" />
        <param name="pixel_format" value="mjpeg" />
        <param name="camera_frame_id" value="left" />
        <param name="io_method" value="mmap"/>      
        <rosparam file="example-left.yaml"/>    
        <param name="left/camera_info_url" type="string" value="file://left_camera_calibration.yaml" />
    </node>

    <node name="right" pkg="usb_cam" type="usb_cam_node" output="screen" >
        <param name="video_device" value="/dev/video2" />
        <param name="image_width" value="640" />
        <param name="image_height" value="480" />
        <param name="pixel_format" value="mjpeg" />
        <param name="camera_frame_id" value="right" />
        <param name="io_method" value="mmap"/>          
        <rosparam file="example-right.yaml"/>   
        <param name="right/camera_info_url" type="string" value="file://right_camera_calibration.yaml" />
    </node>
  </group>  
</launch>

The left.yaml and right.yaml files are in the same directory as the launch file, and they looks like this:

image_width: 640
image_height: 480
camera_name: narrow_stereo/left
camera_matrix:
  rows: 3
  cols: 3
  data: [788.542495, 0, 327.486858, 0, 791.888555, 225.27738, 0, 0, 1]
distortion_model: plumb_bob
distortion_coefficients:
  rows: 1
  cols: 5
  data: [0.145671, -0.706881, 0.00285, -0.00085, 0]
rectification_matrix:
  rows: 3
  cols: 3
  data: [0.996588, -0.063317, -0.052951, 0.06356, 0.997974, 0.002905, 0.05266, -0.006261, 0.998593]
projection_matrix:
  rows: 3
  cols: 4
  data: [1224.680474, 0, 566.859081, 0, 0, 1224.680474, 246.882917, 0, 0, 0, 1, 0]

I have the following topics:

/rosout
/rosout_agg
/stereo/left/camera_info
/stereo/left/image_raw
/stereo/left/image_raw/compressed
/stereo/left/image_raw/compressed/parameter_descriptions
/stereo/left/image_raw/compressed/parameter_updates
/stereo/left/image_raw/compressedDepth
/stereo/left/image_raw/compressedDepth/parameter_descriptions
/stereo/left/image_raw/compressedDepth/parameter_updates
/stereo/left/image_raw/theora
/stereo/left/image_raw/theora/parameter_descriptions
/stereo/left/image_raw/theora/parameter_updates
/stereo/right/camera_info
/stereo/right/image_raw
/stereo/right/image_raw/compressed
/stereo/right/image_raw/compressed/parameter_descriptions
/stereo/right/image_raw/compressed/parameter_updates
/stereo/right/image_raw/compressedDepth
/stereo/right/image_raw/compressedDepth/parameter_descriptions
/stereo/right/image_raw/compressedDepth/parameter_updates
/stereo/right/image_raw/theora
/stereo/right/image_raw/theora/parameter_descriptions
/stereo/right/image_raw/theora/parameter_updates

The camera_info streams messages like this:

---
header: 
  seq: 43435
  stamp: 
    secs: 1368651668
    nsecs: 147961861
  frame_id: left
height: 480
width: 640
distortion_model: ''
D: []
K: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
R: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
P: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
binning_x: 0
binning_y: 0
roi: 
  x_offset: 0
  y_offset: 0
  height: 0
  width: 0
  do_rectify: False
---

Without the calibration parameters. What is wrong? Here I am stucked. I want to use Any idea?