Convert pointcloud2 msg into numpy array
Here, I need to convert the data of pointcloud2 msg into numpy array. What should I do?
At the same time, I noticed that the existing method which named ros-numpy can transform pointcloud2 msg into a simple numpy array. For example, the pointcloud2 information obtained from an image with a resolution of (1280,720) can be converted into a matrix with a shape of (921600, 3). But the array's shape I want is (720, 1280, 3). With that shape, I can find the corresponding position information of pixels in the RGB image.
Really, please. In my opinion, the data format of pointcloud2 brings great trouble to object detection methods. I hope my problem can be solved well.
Asked by kankanzheli on 2022-03-06 09:04:25 UTC
Comments
In fact, I used this way. The shape of the numpy array obtained from the point cloud obtained from the binocular camera with a resolution of (1280,720) after being processed by ros-numpy tool is (921600, 3). I use the reshape tool of numpy to directly convert the shape of numpy array output here into (720,1280, 3). Is the data obtained in this way correct?
Asked by kankanzheli on 2022-03-06 09:24:47 UTC