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

load calibration file

asked 2012-12-26 12:29:36 -0600

dinamex gravatar image

updated 2012-12-27 02:14:41 -0600

Hi there,

I would like to calibrate (extrinsically) a Webcam to my Kinect. For that I need the rectified image of the webcam (usb_cam/image_rect). To get that I calibrated the camera like this tutorial and got a ost.txt. I converted this txt file to yaml and saved it. I use following commands the get the rectified image to run

$ roslaunch usb_cam high.launch

In another tab:

$ ROS_NAMESPACE=usb_cam rosrun image_proc image_proc

And then to receive the rectified image

$ rosrun image_view image_view image:=/usb_cam/image_rect

But when I subscribe to the rectified image I just get

[ERROR] [1356567364.021643621]: Rectified topic '/usb_cam/image_rect' requested but camera publishing '/usb_cam/camera_info' is uncalibrated

My launchfile looks like this:

<launch>
    <node name="usb_cam" pkg="usb_cam" type="usb_cam_node" output="screen">
       <param name="video_device" value="/dev/video0" />
        <param name="image_width" value="1920" /> #max: 2304
        <param name="image_height" value="1080" /> #max: 1536
        <param name="pixel_format" value="mjpeg" />
        <param name="camera_frame_id" value="webcam" />
        <param name="camera_info_url" type="string" value="file://$(find usb_cam)/usb_cam.yaml" />

    </node>
</launch>

My calibration file like this:

image_width: 1920
image_height: 1080
camera_name: usb_cam
camera_matrix:
  rows: 3
  cols: 3
  data: [1367.163672, 0, 960.12046, 0, 1387.606605, 519.231255, 0, 0, 1]
distortion_model: plumb_bob
distortion_coefficients:
  rows: 1
  cols: 5
  data: [0.094896, -0.140698, -0.000646, 0.002101, 0]
rectification_matrix:
  rows: 3
  cols: 3
  data: [1, 0, 0, 0, 1, 0, 0, 0, 1]
projection_matrix:
  rows: 3
  cols: 4
  data: [1384.273193, 0, 963.928625, 0, 0, 1410.329346, 518.011368, 0, 0, 0, 1, 0]

EDIT 1:

I saw that the usb_cam package doesn't use the Camera_Info_Manager. Could that be the reason why the calibration file has no effect? I tried now to insert the calibration parameter directly in the launch file like this. But still no changes....

<param name="D" type="string" value="-0.0834232 0.120545 -0.0023918 0.0175383 0 "/>
<param name="K" type="string" value="578.252 0 350.204 0 575.115 207.606 0 0 1 "/>
<param name="R" type="string" value="1 0 0 0 1 0 0 0 1 "/>
<param name="P" type="string" value="578.252 0 350.204 0 0 575.115 207.606 0 0 0 1 0 "/>

but still without a change. This is the output for $ rostopic echo /usb_cam/camera_info

 header: 
  seq: 204
  stamp: 
    secs: 1356617114
    nsecs: 959397246
  frame_id: usb_cam
height: 240
width: 320
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
edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
0

answered 2012-12-28 03:07:00 -0600

dinamex gravatar image

I used the the usb_cam repository of ccny which is basically the same but with a working CameraInfoManager.

edit flag offensive delete link more

Comments

Dead Link.

Mehdi. gravatar image Mehdi.  ( 2015-08-10 06:11:36 -0600 )edit
2

answered 2012-12-26 23:11:34 -0600

Chad Rockey gravatar image

I'm not sure that your camera info url is valid: http://www.ros.org/doc/api/camera_info_manager/html/classcamera__info__manager_1_1CameraInfoManager.html#_details

Try something like:

package://ros_package_name/calibrations/camera3.yaml

For you:

package://usb_cam/usb_cam.yaml

Also, to see if the published topic matches your calibration file.

rostopic echo /usb_cam/camera_info
edit flag offensive delete link more

Comments

I tried this after this post without any change on the behavior.

dinamex gravatar image dinamex  ( 2012-12-27 02:03:26 -0600 )edit
0

answered 2013-02-17 07:31:53 -0600

p2004r gravatar image

updated 2013-02-18 02:33:37 -0600

I used the the usb_cam repository of ccny which is basically the same but with a working CameraInfoManager.

This version does not compile under groovy ROS, Ubuntu 32 bit. You have 64 bit ubuntu?

I tried now to insert the calibration parameter directly in the launch file like this. But still no changes....

the correct format:

<rosparam param="D">[1, 2, 3, 4, 5]</rosparam> ....

but there is a problem with "distortion_model" --- it is empty. usb_cam not provide support for him :(, and image_proc not work on /camera/image_rect

edit flag offensive delete link more

Comments

I use ubuntu 32 bit server edition on a ARM board with ROS electric. I compiled everything from source and it worked without issues.

dinamex gravatar image dinamex  ( 2013-02-17 09:53:49 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2012-12-26 12:29:36 -0600

Seen: 7,358 times

Last updated: Feb 18 '13