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

How to get pointcloud2 data from usb_cam or Pointgrey camera?

asked 2015-05-11 05:28:32 -0500

david059 gravatar image

Hello, experts~ I am a new in ROS. And recently, I am trying to get image and make it detected by the node ar_track_alvar. However, this ar node requires sensor_msgs/PointCloud2 data. Firstly I tried to use usb_cam_node and I got sensor_msgs/Image. The same situation happened using Pointgrey camera with its driver: pointgrey_camera_driver. After searching some files, I find that it might work if I can use openni to get the image, after all it is discribed in wiki: "Launch files to open an OpenNI device and load all nodelets to convert raw depth/RGB/IR streams to depth images, disparity images, and (registered) point clouds."here. And after I run the command: " roslaunch openni2_launch openni2.launch " it says there is no device. I really don't know how to make it out. Can anyone help me answer the following question: 1. Can pointgrey camera be directly used by openni launch file? 2. Can common USB camera be used by openni launch? 3. If the answer of both is negative, how can I get pointcloud2 data with what kind of device and with which driver? P.S. Here is what shell says after I run roslaunch openni2_launch openni2.launch

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2015-05-11 06:02:59 -0500

KDROS gravatar image

updated 2015-05-11 06:07:11 -0500

For using openni package and also for generating point cloud you should have Kinect or Asus Xtion ( Depth Sensor). OpenNI wont work with normal usb camera. usb_cam package is to capture rgb image using usb camera.

For generating pointcloud u can use either Kinect with freenect package or rgbdslam ( available for electric Older version of ROS)

If you are only interested in creating 3D, you can use lsd_slam or ORB slam, it will give nice 3d in real time but it wont publish any pointcloud message.

edit flag offensive delete link more


WOW! So quick! Thank you very much for your guidance! So now I understand what can be used for OpenNI and what cannot. But can I take it that the pointcloud can just only be generated by OpenNI which means I have to have devices you mentioned? Is there any other way I can get pointcloud with uabcam?

david059 gravatar image david059  ( 2015-05-11 06:22:35 -0500 )edit

Yup I mentioned, lsd_slam and ORB_Slam you can get good pointcloud, but for very good pointcloud either use lsd_slam with global shutter camera with fish eye lens or Kinect/Asus Xiton with freenect/openNI2 package.

KDROS gravatar image KDROS  ( 2015-05-11 06:32:49 -0500 )edit

I think you just really did me a great favor! Even though I can't find LSD_SLAM nor ORB_SLAM in , I find them in github! I will try them right now and I hope this time I can make it. Thank you, KDROS!

david059 gravatar image david059  ( 2015-05-11 07:00:50 -0500 )edit

Thanx, Yup It is not available in ROS, check this links lsd_slam. You can ask if you will be in trouble.

KDROS gravatar image KDROS  ( 2015-05-11 11:21:23 -0500 )edit

Hey KDROS, after reading about what it says in github, I realize the problem you mentioned , LSD_SLAM indeed can not be used for live-pointcloud use in ROS. ButI think I find another way to get PointCloud2 data. By using image_proc

david059 gravatar image david059  ( 2015-05-12 10:40:36 -0500 )edit

I will talk in more detail in my answer below

david059 gravatar image david059  ( 2015-05-12 10:42:48 -0500 )edit

answered 2015-05-12 10:55:28 -0500

david059 gravatar image

To obtain sensor_msgs/PointCloud or sensor_msgs/PointCloud2 data, I think there is an easy way to realize it. No matter what your camera_driver is, there will always have Image_raw data. I use PointGrey carema and usb camera, both drivers of them can get raw image whose format is sensor_msgs/Image. Next use image_proc we can get Image_rect [Image] which is the data format needed in the next step. I find depth_image_proc can produce PoindCloud or PointCloud2 data by using Image_rect. Here: . I think this is a way worthy of trying, even though I don't know what kind of image will finally get. I'm trying now, and I will update this question informing any one who see this question. Welcome everyone to come to discuss.

edit flag offensive delete link more


Flow is good.. I will also try this, its very cheaper approach. Thanx. But till now I am using lsd_slam and kinect and getting good result.

KDROS gravatar image KDROS  ( 2015-05-12 11:22:32 -0500 )edit

Is it working fine ? In my case am getting error manager arg need to be set, I rectified this by giving true.. and there is no node/launch file for depth_image_proc. Tell me the detail execution process, it sounds interesting. I was using this package earlier but that time also i was unable to solve

KDROS gravatar image KDROS  ( 2015-05-13 00:59:37 -0500 )edit

I just get it through, you have to write a launch file according to the nodelet_plugins.xml file in depth_image_proc. You have to run a nodelet and here is the tutorial, I can get some thing in RVIZ, but still some trouble in ar_track

david059 gravatar image david059  ( 2015-05-13 01:30:27 -0500 )edit

I run image_proc, it is running successfully but its not publishing any topic. are you getting this? did you change any thing in launch file except manager arg?

KDROS gravatar image KDROS  ( 2015-05-13 03:59:41 -0500 )edit

if you are running a node, run this ROS_NAMESPACE=my_camera rosrun image_proc image_proc. my_camera is the relative name provided by your camera driver there will have topic shown in Nodes section.

david059 gravatar image david059  ( 2015-05-13 10:35:35 -0500 )edit

If you roslaunch a launch file you have to rectify the original launch file, assign specific arg value like args="load image_proc/debayer $(arg manager) $(arg bond)" you need replace $(arg manager) with standalone_nodelet, like tutorial in the [](

david059 gravatar image david059  ( 2015-05-13 10:38:46 -0500 )edit

Main benefit of lsd_slam over this is that it fuses all pointcloud (like PCL) but in image_proc it is just publishing pointcloud for each image. which is easily doable by Kinect.

KDROS gravatar image KDROS  ( 2015-05-14 00:45:10 -0500 )edit

Question Tools



Asked: 2015-05-11 05:28:32 -0500

Seen: 1,698 times

Last updated: May 12 '15