# Extract point cloud data of particular detection and removing background point cloud

**URL:** <https://community.stereolabs.com/t/extract-point-cloud-data-of-particular-detection-and-removing-background-point-cloud/2450>\
**Category:** Python\
**Tags:** python, depth\
**Created:** [April 12, 2023, 8:30pm UTC](https://community.stereolabs.com/t/extract-point-cloud-data-of-particular-detection-and-removing-background-point-cloud/2450 "2023-04-12T20:30:02Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![varunk12](https://community.stereolabs.com/letter_avatar_proxy/v4/letter/v/ec9cab/32.png) [@varunk12](https://community.stereolabs.com/u/varunk12)\
**Post date:** [April 12, 2023, 8:30pm UTC](https://community.stereolabs.com/t/extract-point-cloud-data-of-particular-detection-and-removing-background-point-cloud/2450/1 "2023-04-12T20:30:02Z")

</div>

I am working on a project with a ZED2 camera. I need help with using mediapipe library hand detection module with ZED2 to extract all points that I get using depth estimation just for the hands and visualize it. can you tell me how can I extract the hand point cloud remove all background point clouds and merge mediapipe hand detection with the ZED2 camera?

---

<div class="post-metadata">

**Author:** ![alassagne](https://community.stereolabs.com/user_avatar/community.stereolabs.com/alassagne/32/2428_2.png) [@alassagne](https://community.stereolabs.com/u/alassagne)\
**Post date:** [April 13, 2023, 11:38am UTC](https://community.stereolabs.com/t/extract-point-cloud-data-of-particular-detection-and-removing-background-point-cloud/2450/2 "2023-04-13T11:38:16Z")

</div>

Hello,

I can’t write this code for you. You should check out our Body tracking tutorial : [zed-sdk/body tracking/body tracking at master · stereolabs/zed-sdk · GitHub](https://github.com/stereolabs/zed-sdk/tree/master/body%20tracking/body%20tracking)  
Using the `mask` attribute of the `BodyData` object will give you the pixels involved in a body tracking detection.  
Make sure you use `BODY_FORMAT_70` to get the detailled hands.

---

<div class="post-metadata">

**Author:** ![varunk12](https://community.stereolabs.com/letter_avatar_proxy/v4/letter/v/ec9cab/32.png) [@varunk12](https://community.stereolabs.com/u/varunk12)\
**Post date:** [April 13, 2023, 11:41am UTC](https://community.stereolabs.com/t/extract-point-cloud-data-of-particular-detection-and-removing-background-point-cloud/2450/3 "2023-04-13T11:41:37Z")

</div>

Thank You for the help. can you also help me with my another question :  
How to extract depth values for particular [x ,y] coordinate depth\_value = depth\_map\_np[y][x]. please look at the post.

---

<div class="post-metadata">

**Author:** ![alassagne](https://community.stereolabs.com/user_avatar/community.stereolabs.com/alassagne/32/2428_2.png) [@alassagne](https://community.stereolabs.com/u/alassagne)\
**Post date:** [April 13, 2023, 11:43am UTC](https://community.stereolabs.com/t/extract-point-cloud-data-of-particular-detection-and-removing-background-point-cloud/2450/4 "2023-04-13T11:43:28Z")

</div>

The numpy array contains these values. Check this tutorial [zed-sdk/image\_capture.py at master · stereolabs/zed-sdk · GitHub](https://github.com/stereolabs/zed-sdk/blob/master/tutorials/tutorial%202%20-%20image%20capture/python/image_capture.py) which does what you need.

---

<div class="post-metadata">

**Author:** ![varunk12](https://community.stereolabs.com/letter_avatar_proxy/v4/letter/v/ec9cab/32.png) [@varunk12](https://community.stereolabs.com/u/varunk12)\
**Post date:** [April 13, 2023, 11:45am UTC](https://community.stereolabs.com/t/extract-point-cloud-data-of-particular-detection-and-removing-background-point-cloud/2450/5 "2023-04-13T11:45:15Z")

</div>

i am getting this output:  
Depth at (1609,804): [3.0693591e-01 1.2300891e-01 5.0059068e-01 -2.3553920e+38] meters  
need to understand the values and need a z-axis.

---

<div class="post-metadata">

**Author:** ![SL-PY](https://community.stereolabs.com/user_avatar/community.stereolabs.com/sl-py/32/3_2.png) [@SL-PY](https://community.stereolabs.com/u/SL-PY)\
**Post date:** [April 14, 2023, 11:59am UTC](https://community.stereolabs.com/t/extract-point-cloud-data-of-particular-detection-and-removing-background-point-cloud/2450/6 "2023-04-14T11:59:13Z")

</div>

how do you get thoses values ?  
To get the depth values you shoudl retrieve the MEASURE::DEPTH which is a one channel matrix containing Z values.  
It looks like you display Point Cloud values from this sample:

> <https://github.com/stereolabs/zed-sdk/blob/master/tutorials/tutorial%203%20-%20depth%20sensing/python/depth_sensing.py#L70>

In this case the Depth (Z) is the 3rd value. Its unit depends the InitParameters you set.
