# Inconsistency with setRegionOfInterest

**URL:** <https://community.stereolabs.com/t/inconsistency-with-setregionofinterest/8561>\
**Category:** C++\
**Created:** [April 8, 2025, 8:18pm UTC](https://community.stereolabs.com/t/inconsistency-with-setregionofinterest/8561 "2025-04-08T20:18:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![huck](https://community.stereolabs.com/letter_avatar_proxy/v4/letter/h/b5a626/32.png) [@huck](https://community.stereolabs.com/u/huck)\
**Post date:** [April 8, 2025, 8:18pm UTC](https://community.stereolabs.com/t/inconsistency-with-setregionofinterest/8561/1 "2025-04-08T20:18:33Z")

</div>

Hello!

I was testing the setRegionOfInterest functionality and came across some inconsistent results after setting the ROI mask. At first it looks like it stops tracking joints when one is found outside of the mask (as seen by moving my feet and hands in and out of the frame). However once I get far enough and my entire body is out of frame, once my hand/foot is in frame it starts tracking my entire skeleton Which seems a bit counter intuitive. I was wondering if this is intended behaviour.

I was using the example with the following code snippet added to [zed-sdk/body tracking/body tracking/cpp/src/main.cpp](https://github.com/stereolabs/zed-sdk/blob/master/body%20tracking/body%20tracking/cpp/src/main.cpp#L104)  
to line 104.

```c++
	sl::Mat mask(camera_config.resolution, sl::MAT_TYPE::U8_C4);
    auto rect = cv::Rect(400, 50, camera_config.resolution.width / 3.5, camera_config.resolution.height - 100);
	cv::Mat cvImage(camera_config.resolution.height, camera_config.resolution.width, CV_8UC4, mask.getPtr<sl::uchar1>(sl::MEM::CPU));
    cv::rectangle(cvImage, rect, cv::Scalar(255, 255, 255, 255), -1);
    zed.setRegionOfInterest(mask);

```

I can’t add attachments to this post, however I can provide a video of me recreating it if needed.

Thanks!

---

<div class="post-metadata">

**Author:** ![BenjaminV](https://community.stereolabs.com/user_avatar/community.stereolabs.com/benjaminv/32/3863_2.png) [@BenjaminV](https://community.stereolabs.com/u/BenjaminV)\
**Post date:** [April 17, 2025, 9:35am UTC](https://community.stereolabs.com/t/inconsistency-with-setregionofinterest/8561/2 "2025-04-17T09:35:54Z")

</div>

To keep everyone here updated.

The issue has been reproduced, and we are currently working on a fix.  
It will be included in the next patch of the ZED SDK (no ETA for now).

Best,

[Stereolabs](https://www.stereolabs.com/) Support
