Ask Your Question

How to use lsd_slam with usb camera?

asked 2015-07-04 02:13:32 -0500

jossy gravatar image

updated 2015-07-04 02:25:05 -0500

I install lsd_slam from here. I run succesfully lsd_slam with .bag files from taken here. I want to try lsd_Slam with usb camera or image sequence. To do it, I run below commands :

rosrun lsd_slam_viewer viewer
rosrun lsd_slam_core live_slam  /image:=/usb_cam/image_raw _calib:=pinhole_example_calib.cfg
roslaunch slam.launch


<!-- Activate the color webcam. -->
<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="640" />
    <param name="image_height" value="480" />
    <param name="pixel_format" value="yuyv" />
    <param name="camera_frame_id" value="usb_cam" />
    <param name="io_method" value="mmap" />
<!-- Convert the color webcam's output to mono. -->
<node name="to_mono_node1" pkg="image_proc" type="image_proc" ns="usb_cam" />
<!-- Display the mono stream. -->
<node name="image_view" pkg="image_view" type="image_view" respawn="false" output="screen">
    <remap from="image" to="/usb_cam/image_mono" />
    <param name="autosize" value="true" />

Error is :

Input resolution: 752 480
In: 0.527334 0.827306 0.473568 0.499436 0.000000
Output resolution: 752 480
Prepped Warp matrices
Started  constraint search thread!
Started mapping thread!
Started optimization thread 
UndistorterPTAM: input image size differs from expected input size! Not undistorting.
Doing Random initialization!
Segmentation fault (core dumped)

I use ros-indigo, ubuntu 14.04. How can I run lsd_slam with images or usb camera frames?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-07-04 04:41:37 -0500

The error is complaining about your input image size.

Modify your "pinhole_example_calib.cfg", and don't forget to change the camera parameters in the first line. You can get those parameters by calibrating your camera with ptam's tool.

0.527334 0.827306 0.473568 0.499436 0
640 480 
640 480
edit flag offensive delete link more


ptam's tool uses catkin, but lsd_slam uses rosbuild. If I use rosbuild_ws/package_dir$ rosrun camera_calibration --size 8x5 --square 0.030 image:=/usb_cam/image_raw --no-service-check , isn't it sufficient calibration task?

jossy gravatar image jossy  ( 2015-07-04 04:47:16 -0500 )edit

Yeah, it should be sufficient. But the question is how to link these parameters.

Po-Jen Lai gravatar image Po-Jen Lai  ( 2015-07-04 05:16:04 -0500 )edit

Thanks your help. But this link has a only question. It hasn't an answer.

jossy gravatar image jossy  ( 2015-07-06 00:33:00 -0500 )edit

Yes, because I am also trying to figure out how to interpret these parameters...maybe by tracing the code: But for now I don't have much time on this project.

Po-Jen Lai gravatar image Po-Jen Lai  ( 2015-07-06 01:11:14 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-07-04 02:13:32 -0500

Seen: 980 times

Last updated: Jul 04 '15