load calibration file
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