Put pointcloud from ros into numpy

Hello everyone, I outputed the ptcloud as a numpy matrix(by ptcloud_np = np.array(ptcloud.get_data())). But the numpy matrix is (720,1280,4).
But when I open the camera with ros, How can I output the pointcloud into the numpy array with the same shape as the result from “ptcloud_np = np.array(ptcloud.get_data()” ?

Can you explain better what’s you problem?

This is my question. When I using camera with ros, I want to output the pointcloud data into numpy(720,1280,4).
Which is same as the numpy array made by
ptcloud_np = np.array(ptcloud.get_data()

“ptcloud_np = np.array(ptcloud.get_data()” is used to output the pointcloud as numpy array in the zed pytorch.

Then through the point cloud numpy obtained in ROS I can find the XYZ information of each pixel in the left image.

Solution:
https://answers.ros.org/question/344096/subscribe-pointcloud-and-convert-it-to-numpy-in-python/

Are you sure this is the right answer? After getting numpy, I found that its shape is (1, 3). This does not store information about all points in the point cloud at all.

That’s a guide, you must adapt the data types.