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

Doubt about Interpreting PointCloud2 data [closed]

asked 2015-05-20 10:03:40 -0500

Wilianson gravatar image

updated 2016-06-10 21:17:30 -0500

130s gravatar image
Hi, I am doing a research about sensor fusion, and I need to reconstruct a depth image, only with the contain of the topic: depth_registered/points. I already know that is a PointCloud2 type, and it has associated a PointField in order to interpret the data. I am following more or less this algorithm to get the Z coordinate it is also the same thing to get X, Y and RGB just moving the offsets, which are provide from the pointField information.
  1. Get the 9 , 10, 11 and 12 elements from the 32 elements matrix for each pixel

  2. Convert to binary each element (9,10,11,12)
  3. Concatenate the binary representations (for each elements).
  4. Invert all the concatenated representation (because is not a big endian)

  5. Convert the inverted representation in float32 value.

Well I have some results for my research and I am worried because making this algorithm I have some result for the Z matrix and the has to much noise (I think) I attached this result to show you my results.

 One of the restrictions of my research is that I am not able to use the switch between this topic and PCL (pcl_conversions ), I am just using a file which contains all the data (the data field for the PointCloud2 topic ) of the topic in each moment and working with it in Matlab.
I have attached the original image reconstruction (taking the 19, 18 and 17 for RGB ) from the 32 elements and the Z graphic for my Z result where each color represents an depth value .

Original Image Original Image

Z Matriz Z Matriz

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Wilianson
close date 2015-05-22 11:55:28.427967

1 Answer

Sort by » oldest newest most voted
1

answered 2015-05-21 20:23:54 -0500

tfoote gravatar image

Your depth image does look like you're not getting the depth information correctly. You should make sure to evaluate your source data to get the encoding from the message. It has all the information you need to compute the correct offsets and endianness. (Unless you're on very uncommon hardware I would be surprised if you need to convert endianess.)

edit flag offensive delete link more

Comments

Thank you so much for your answer, this answer made me think about my interpretation and that was wrong, now I have this new Z matrix, and I already great. Thanks :D

Wilianson gravatar image Wilianson  ( 2015-05-22 10:57:46 -0500 )edit

In matlab they have this way to convert 8 bit numbers which are in an array (data) into float 32: x = typecast(uint8([data(1),data(2),data(3),data(4)]), 'single')

Wilianson gravatar image Wilianson  ( 2015-05-22 10:58:53 -0500 )edit
1

Please accept the answer so others know your problem is solved.

tfoote gravatar image tfoote  ( 2015-05-22 11:30:47 -0500 )edit

Done! Thanks :D

Wilianson gravatar image Wilianson  ( 2015-05-22 11:57:33 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2015-05-20 10:03:40 -0500

Seen: 709 times

Last updated: Jun 10 '16