How to use a calibrated camera in ROS
In my previous tutorial I showed you how to calibrate a camera with ROS. In this tutorial, I’m gonna show you how to rectify the images from coming from your camera. First, open your text editor and paste the following text into it:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
<!-- Example of run: roslaunch usb_cam_stream_publisher.launch video_device:=/dev/video0 image_width:=640 image_height:=480 --> <launch> <arg name="video_device" default="/dev/video0" /> <arg name="image_width" default="640" /> <arg name="image_height" default="480" /> <arg name="image_topic_name" default="/usb_cam/image_raw" /> <arg name="camera_info_topic_name" default="/usb_cam/camera_info" /> <node name="usb_cam" pkg="usb_cam" type="usb_cam_node" output="screen" > <param name="video_device" value="$(arg video_device)" /> <param name="image_width" value="$(arg image_width)" /> <param name="image_height" value="$(arg image_height)"/> <param name="pixel_format" value="mjpeg" /> <param name="io_method" value="mmap"/> <!-- update these line accroding to your setting, here are some examples:--> <!-- <param name="camera_info_url" value="package://your_cameras/info/camera.yaml"/> --> <!-- <param name="camera_info_url" value="file:///home/behnam/.ros/camera_info/head_camera.yaml"/> --> <param name="camera_info_url" value="file://${ROS_HOME}/camera_info/head_camera.yaml"/> <remap from="/usb_cam/camera_info" to="$(arg camera_info_topic_name)"/> <remap from="/usb_cam/image_raw" to="$(arg image_topic_name)"/> </node> </launch> |
make the necessary changes and save it under usb_cam_stream_publisher.launch Now run it:
1 |
roslaunch usb_cam_stream_publisher.launch |
Open […]
How to use a calibrated camera in ROS Read More »