0
$\begingroup$

Rosanswers logo

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.

    Get the 9 , 10, 11 and 12 elements from the 32 elements matrix for each pixel

    Convert to binary each element (9,10,11,12) Concatenate the binary representations (for each elements).

    Invert all the concatenated representation (because is not a big endian)

    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 http://s30.postimg.org/3v05hckmp/original.jpg

Z Matriz Z Matriz http://s22.postimg.org/x49816t69/image.jpg


Originally posted by Wilianson on ROS Answers with karma: 21 on 2015-05-20

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.)


Originally posted by tfoote with karma: 58457 on 2015-05-21

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by Wilianson on 2015-05-22:
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

Comment by Wilianson on 2015-05-22:
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')

Comment by tfoote on 2015-05-22:
Please accept the answer so others know your problem is solved.

Comment by Wilianson on 2015-05-22:
Done! Thanks :D

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.