eric-wieser/ros_numpy

transform pointcloud2 to numpy array with shape

kankanzheli opened this issue · 1 comments

Before I use ros, I transform the pointcloud into numpy with shape (720,1280,4). The 4 mean for information: xyz location information and RGB information in one float32 number.

Now I open the camera with ROS. It output the pointcloud by pointcloud2 message. How can I transform the pointcloud2 msg in to the numpy array with shape (720,1280,3)? 3 is the xyz location information.

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 your 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?