Filter point cloud

I would like to filter the point cloud generated by the ZED2.
I saw that i can retrieve all from .get_data(), however it outputs me an np.array of (1080, 1920, 4).
Can someone explain to me how it works ? Is it an image ?
Also if i filter the point cloud, how can i get the associated pixel afterwards ? how are the point cloud registered to the pixels ?
Before it was possible to do get_value(x,y) but once i filter the point cloud ill have a np.array object. how can I link the pixel ?

Thank you

Hi @an99990,

Calling mat.get_data() will output you an array that has your resolution size (in your case 1080x1920). Each element of the array contains 4 values. Depending on the sl.MEASURE you chose when retrieving your point cloud, your 4 values will either correspond to [X,Y,Z,color] or [X,Y,Z,none].
You can check the API Doc for the details on the existing sl.MEASURE and this post to see how to interpret color info.

If you want to get X,Y,Z coordinates at pixel (i,j), you will need to do something like :

pc_data = mat.get_data()
x = pc_data[i,j,0]
y = pc_data[i,j,1]
z = pc_data[i,j,2]

If you filter your point cloud by removing values from your initial array and end up with an array of different size, you indeed won’t be able to link an array value to the pixel coordinates it corresponds to.
Instead of removing the unwanted values when filtering you can for example set the unwanted values to another value in order to keep the same array size

Hope this helped

Hi @quythao.truong, that was a really clear answer.

I would also like to filter the point cloud so I can use ICP afterwards to calculate the camera pose.
Do you have any suggestion on which value I should replace the undesired point cloud?
Should I just give the (1080, 1920, 4) without color channel to the ICP algorithm ?
thank you