Ask Your Question

Only depth info from kinect

asked 2011-09-08 07:36:08 -0500

adesh gravatar image

Hi I am using openni_kinect with Diamondback on Ubuntu 10.04. Does anyone know if there is a way to capture just depth data for further analysis ?

From the RGBDSLAM tutorials, after running 'roslaunch rgbdslam kinect+rgbdslam.launch ' I could save point cloud data from the rviz screen as a .ply file (which has x,y,z,r,g,b entries for all points) to see it in something like Meshlab. The problem in this is that the file is really large (10-15 MB) and it is difficult to segregate and analyze just x,y,z data from this.

By the way, what I am trying to do is capture the depth info around at certain frequency and estimate the dynamics of the environment progressively from all the frames captured. Any help is really appreciated


edit retag flag offensive close merge delete

4 Answers

Sort by ยป oldest newest most voted

answered 2011-09-08 13:03:53 -0500

tfoote gravatar image

To record data in ROS you should use rosbag

edit flag offensive delete link more

answered 2011-09-08 08:49:12 -0500

adesh gravatar image

Hi dornhege, can you elaborate a little bit ? I am new to the ROS community. Let me explain with specific example what I am looking for . On 'openni_camera' page in ROS documentation, I tried the OpenNI demo part. When I launch rviz (topic = /camera/depth/points), I can see kinect showing a heatmap kind of an image of whatever it sees. I want to be able to save this in a file which can give me x, y, z info of all the points captured.

edit flag offensive delete link more


Please use comments or edit your original post to clarify. The "answer" as you have given is ordered by usefulness rather than time.
tfoote gravatar image tfoote  ( 2011-09-08 13:03:11 -0500 )edit

answered 2011-09-16 00:14:16 -0500

Marco gravatar image

To get raw XYZ data from the pointcloud2 rosmsg, I used the pcl library to convert the complicated pointcloud2 format to something easier. Below a code snippet to read the xyz data, you can then write it to whatever file you want using your favorite filewriting commands.

pcl::PointCloud< pcl::PointXYZ > PointCloudXYZ;
std::cout << "width is " << PointCloudXYZ.width << std::endl;
std::cout << "height is " << PointCloudXYZ.height << std::endl;
int cloudsize = (PointCloudXYZ.width) * (PointCloudXYZ.height);
for (int i=0; i< cloudsize; i++){
std::cout << "(x,y,z) = " << PointCloudXYZ.points[i] << std::endl;

cloud_t here points to the rosmsg you want to read the pointcloud from. You can find more information about this in the pcl conversions files (which also uses cloud_t) or I can look into my code for you next week.

edit flag offensive delete link more

answered 2011-09-08 08:07:26 -0500

dornhege gravatar image

You can just record the depth image directly. It is published.

Is that what you are looking for?

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools


Asked: 2011-09-08 07:36:08 -0500

Seen: 562 times

Last updated: Sep 16 '11