# The mask information of the target object

**URL:** <https://community.stereolabs.com/t/the-mask-information-of-the-target-object/4253>\
**Category:** Python\
**Tags:** python\
**Created:** [December 29, 2023, 3:13am UTC](https://community.stereolabs.com/t/the-mask-information-of-the-target-object/4253 "2023-12-29T03:13:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![NineSeven](https://community.stereolabs.com/user_avatar/community.stereolabs.com/nineseven/32/1976_2.png) [@NineSeven](https://community.stereolabs.com/u/NineSeven)\
**Post date:** [December 29, 2023, 3:13am UTC](https://community.stereolabs.com/t/the-mask-information-of-the-target-object/4253/1 "2023-12-29T03:13:02Z")

</div>

I would like to know, I’m using python, how can I get the mask information of the target object?

---

<div class="post-metadata">

**Author:** ![JPlou](https://community.stereolabs.com/user_avatar/community.stereolabs.com/jplou/32/1012_2.png) [@JPlou](https://community.stereolabs.com/u/JPlou)\
**Post date:** [January 2, 2024, 9:23am UTC](https://community.stereolabs.com/t/the-mask-information-of-the-target-object/4253/2 "2024-01-02T09:23:34Z")

</div>

Hi,

You first need to set the **enable\_segmentation** parameter to **true** in the ObjectDetectionParamters structure.

Then, the mask is accessible as a Mat in the ObjectData data structure after calling the **retrieve\_objects** function : [https://www.stereolabs.com/docs/api/python/classpyzed\_1\_1sl\_1\_1ObjectData.html#aff25fe6cafaf46730a2b278426aaafbb](https://www.stereolabs.com/docs/api/python/classpyzed_1_1sl_1_1ObjectData.html#aff25fe6cafaf46730a2b278426aaafbb)

Jean-Loup MACARIT  
R&D Engineer  
Stereolabs Support

---

<div class="post-metadata">

**Author:** ![NineSeven](https://community.stereolabs.com/user_avatar/community.stereolabs.com/nineseven/32/1976_2.png) [@NineSeven](https://community.stereolabs.com/u/NineSeven)\
**Post date:** [January 8, 2024, 1:23am UTC](https://community.stereolabs.com/t/the-mask-information-of-the-target-object/4253/3 "2024-01-08T01:23:35Z")

</div>

I’m using the ZED SDK 4.0 and I’m getting an issue like this: ‘pyzed.sl. CameraInformation’ object has no attribute ‘camera\_resolution’

---

<div class="post-metadata">

**Author:** ![JPlou](https://community.stereolabs.com/user_avatar/community.stereolabs.com/jplou/32/1012_2.png) [@JPlou](https://community.stereolabs.com/u/JPlou)\
**Post date:** [January 8, 2024, 12:51pm UTC](https://community.stereolabs.com/t/the-mask-information-of-the-target-object/4253/4 "2024-01-08T12:51:31Z")

</div>

Hi @NineSeven,

Without the code, it’s difficult to give an exact answer, but I suppose you’re trying to access camera\_resolution through CameraInformation, but it’s an attribute of [InitParameters](https://www.stereolabs.com/docs/api/python/classpyzed_1_1sl_1_1InitParameters.html#a83d09fa560e127b0498b7427658bab5e) so it gives an error.

Please post a complete code sample if you want me to take a deeper look 🙂

---

<div class="post-metadata">

**Author:** ![NineSeven](https://community.stereolabs.com/user_avatar/community.stereolabs.com/nineseven/32/1976_2.png) [@NineSeven](https://community.stereolabs.com/u/NineSeven)\
**Post date:** [January 9, 2024, 8:14am UTC](https://community.stereolabs.com/t/the-mask-information-of-the-target-object/4253/5 "2024-01-09T08:14:42Z")

</div>

I’ve solved the problem I mentioned above, and now I’m having a problem, I’m trying to combine a custom detector and a mask display, how do I do it?  
[detector test.py](https://community.stereolabs.com/uploads/short-url/tYUyohJGtbOspGvs3LxjLaTwHyp.py) (8.5 KB)

---

<div class="post-metadata">

**Author:** ![JPlou](https://community.stereolabs.com/user_avatar/community.stereolabs.com/jplou/32/1012_2.png) [@JPlou](https://community.stereolabs.com/u/JPlou)\
**Post date:** [January 9, 2024, 1:11pm UTC](https://community.stereolabs.com/t/the-mask-information-of-the-target-object/4253/6 "2024-01-09T13:11:06Z")

</div>

Hi @NineSeven,

The custom detector should output masks, and you can display them with the tool of your choice.  
It was actually discussed in this topic: [Image segmentation using yolov8 with zed 2i python - #2 by JPlou](https://community.stereolabs.com/t/image-segmentation-using-yolov8-with-zed-2i-python/3565/2)

I hope this helps!
