# Object Detection example drawing 2D mask over image

**URL:** <https://community.stereolabs.com/t/object-detection-example-drawing-2d-mask-over-image/673>\
**Category:** Python\
**Tags:** python, jetson\
**Created:** [November 15, 2021, 9:34pm UTC](https://community.stereolabs.com/t/object-detection-example-drawing-2d-mask-over-image/673 "2021-11-15T21:34:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChealsieBains01](https://community.stereolabs.com/user_avatar/community.stereolabs.com/chealsiebains01/32/278_2.png) [@ChealsieBains01](https://community.stereolabs.com/u/ChealsieBains01)\
**Post date:** [November 15, 2021, 9:34pm UTC](https://community.stereolabs.com/t/object-detection-example-drawing-2d-mask-over-image/673/1 "2021-11-15T21:34:37Z")

</div>

I’m working with a Jetson NX and I want to have live time object detection using my Zed Mini. I have the examples and tutorials working, but I can’t find any example using the mask as seen in the object detection documentation. I was wondering if anyone could direct be to a 2D example using opencv and a mask instead of a bounding box over the object.

---

<div class="post-metadata">

**Author:** ![quythao.truong](https://community.stereolabs.com/letter_avatar_proxy/v4/letter/q/c68b51/32.png) [@quythao.truong](https://community.stereolabs.com/u/quythao.truong)\
**Post date:** [November 16, 2021, 1:06pm UTC](https://community.stereolabs.com/t/object-detection-example-drawing-2d-mask-over-image/673/2 "2021-11-16T13:06:53Z")

</div>

Hi @ChealsieBains01,

There is unfortunately no example on our github showing how to draw the 2D mask over a detected object yet, but we’ll log your request and will add an example online as soon as possible.  
In the meantime, I attached a small python script showing you how it can be done in Python.

For information, in the C++ sample, you can change [L.99](https://github.com/stereolabs/zed-examples/blob/b0ad7a91de4b64dbe3296a5bb5ae802ec1913a20/object%20detection/birds%20eye%20viewer/cpp/src/main.cpp#L99) to `true` to draw the 2D mask over detected objects. This can also help you understand how it works.

Hope this helps !

[ZED\_Mask.py](https://community.stereolabs.com/uploads/short-url/uSnzo76GTwd4XsRdWGQeGQuhuxT.py) (5.5 KB)
