Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Visualize pointcloud2 without PCL

I have a stereo-camera and it provides rgb images as well as pointcloud2 data, to which I subscribe like this:

self.pointcloud_sub = rospy.Subscriber("/nerian_stereo/point_cloud", PointCloud2, self.pointcloud_cb) # get the pointcloud

now that I want to see the depth map via cloud, I think I need in my callback a way to interpret the data. Here is my starting point:

def pointcloud_cb(self, scan):
        points_list = []

        for data in pc2.read_points(scan, skip_nans=True):
            points_list.append([data[0], data[1], data[2], data[3]])

        print(points_list)

While this displays the output, it's far from what I want to do. Plus, I don't know how this data can be visualized without PCL. On rviz I can visualize the cloud nicely, opening up a window that does the same with the received data, would be really nice. Later on I can establish association with the RGB image it provides, with the depth map I see, and eventually fin the 3D locations of the objects I am interested in.

Does anyone have an idea?