How to get and use camera calibration file?
I am running on Lucid 32-bit from Electric debs. I have been able to run the mono calibration utility with a 1394 camera and get a successful calibration. How do I then get the actual camera calibration file that was saved to disk and use it in a launch file to get rectified images?
Steps To Reproduce:
Start camera1394 and cameracalibration with the following launch file:
<launch>
<group ns="stereo">
<node pkg="camera1394" type="camera1394_node" name="camera_left">
<rosparam file="$(find stereo_calibration)/cameras/left_flea2.yaml"/>
<remap from="camera" to="left"/>
</node>
</group>
<node pkg="camera_calibration" type="cameracalibrator.py" name="mono_calibration"
args="-size 9x6 -square 0.054 image:=/stereo/left/image_raw camera:=/stereo/left">
</node>
</launch>
and the following yaml file:
# ID number of camera. Use Coriander to find it.
guid: xxxxxxxxxxxxxxxx
# Mode describes the size and number of channels for the images.
video_mode: 1600x1200_mono8
# The frame_id MUST be part of your URDF to display stereo data correctly in Rviz.
frame_id: left_camera
# The location of the ROS calibration file.
camera_info_url: package://stereo_calibration/cameras/xxxxxxxxxxxxxxxx_mono.yaml
# Frames per second.
frame_rate: 30
# Try to reset the camera when opening.
reset_on_open: true
# Change from default 400Mbps Firewire.
iso_speed: 800
So far so good, as I get the utility to show up, all the bars go green, I can click 'Save' and 'Commit', and then exit out of the launch file.
There is a file created at /tmp/calibrationdata.tar.gz that I am able to open and see 74 images plus a file named ost.txt. Using the converter utility I am able to get a yaml file with the following contents:
image_width: 1600
image_height: 1200
camera_name: narrow_stereo/left
camera_matrix:
rows: 3
cols: 3
data: [2379.692159, 0, 810.664016, 0, 2364.724193, 565.047935, 0, 0, 1]
distortion_model: plumb_bob
distortion_coefficients:
rows: 1
cols: 5
data: [-0.125793, 0.149249, -0.000565, -0.000972, 0]
rectification_matrix:
rows: 3
cols: 3
data: [1, 0, 0, 0, 1, 0, 0, 0, 1]
projection_matrix:
rows: 3
cols: 4
data: [2348.257291, 0, 809.568039, 0, 0, 2344.569053, 563.818346, 0, 0, 0, 1, 0]
I modified the camera_name
field to be stereo/left
but it made no difference in the errors described below.
Errors: The output of running a launch file similar to above but with image_proc and two image viewers is:
[ERROR] [1323196102.210752328]: Unable to open camera calibration file [~/.ros/camera_info/camera.yaml]
[ERROR] [1323196102.427796451]: Unable to open camera calibration file [~/.ros/camera_info/00b09d0100a8f71b.yaml]
... logging to x.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
started roslaunch server http://localhost:58044/
SUMMARY
========
PARAMETERS
* /stereo/camera_left/frame_id
* /rosdistro
* /stereo/camera_left/frame_rate
* /stereo/camera_left/camera_info_url
* /stereo/camera_left/iso_speed
* /stereo/camera_left/guid
* /rosversion
* /stereo/camera_left/reset_on_open
* /stereo/camera_left/video_mode
NODES
/stereo/left/
left_image_proc (image_proc/image_proc)
/stereo/
camera_left (camera1394/camera1394_node)
left_raw (image_view/image_view)
left_rect (image_view/image_view)
auto-starting new master
process[master]: started with pid [30321]
ROS_MASTER_URI=http://localhost:11311
~/stereo_calibration/stereo_calibration ...