ROI with depth ? track bodies only within 3 meters for example

Hi there,
I saw in the doc that it is possible to crop a ROI on the image and even apply a mask to do the body tracking.
But is it possible to also define a Depth ROI.
Like track body only that is within 3 meters or between 2 and 3 meters.

My case is that, for a game, there will have spectators behind the player. I would like to exclude them.

Thanks for your help

Hi @robotpapier
Welcome to the Stereolabs community.

You can set the max_range when you initialize the BodyTrackingParameters structure.
You can also set minimum and maximum depth range when you initialize the camera with InitParameters in open

Hi @Myzhar .
Thanks for your reply.
That’s perfect.

So the body tracking process takes as its source the filtered/masked image right?
I mean not tracking all bodies on the complete image then excluding those out of depth range?

No, the Region of Interest is applied before each other processing.

Hi,
I am trying to put a filter on the detected bodies to only select the most centered and most close skeleton.

So I did a for loop in the getJsonSimple function,
this loop catch the index of the body that is the most centered(lowest abs(x)) and most close (lowest z) by comparing at each iteration.

So far everything seems fine.

The filter seems to work but sometimes , I guess when there is lots of people behind, the skeleton of inteest is jittering like it detects another skeleton which should not be there during 1 or 2 frame, causing a skeleton of interest not smooth.

Do you know how I can filter better? I don’t know what I am doing wrong.
Moreover, even though I restricted the depth of intereste to 2200mm, it sometimes detect over that distance.

here a screenshot of the camera.

In this photo I guess, the ramp of the stair is misleading the distance of the skeleton.

But instead of filtering afterwards, is there a way to not detect skeleton in the first place?
make a ROI ?

My actual filter exclude any skeleton which Math.abs(keypoint[0][‘x’]) is greater than 0.5.
But I still get jitters :confused:

My goal is to have the smoothest and most confident detection for someone standing in the circle on the floor.

Does anyone have a robust process for this purpose? maybe tweaking confidence detection (currently 90) or other parameters?

Try to use the Region of Interest feature combined with minimum and maximum depth parameters.

Can you give me a hint how to use the ROI features?

Here you can find an example:

and here is the documentation:
https://www.stereolabs.com/docs/api/classsl_1_1Camera.html#af2939e2ec0013be9f11dcaf11b73fe4c

1 Like