Tracking Multiple People w/ Portenta H7

title. I’m very new to CV, how would I go about doing this? the most important parameter for my purpose is whether a person is getting closer/ moving quickly.
I realize I need to utilize the built-in person detection network, but I just can’t figure out how to find moving blobs to feed the person detection network as ROIs.

Would appreciate help thx

Hi, our person detector network just finds one person. You can use it to detect where people are in regions of the image. However, this is not the same as tracking people in the whole image. We cannot do that now. However, it may be possible in the future.

Okay. How about just narrowing down a person’s rectangle, from the entire image to a smaller rectangle?
Also, does it help if people are the only thing moving in the picture?

Also, can you somehow get just rectangles of moving things in the frame?


The built in person detection algorithm will just say if there are people in the image or not. The image can be any region of interest in the image. You run the network on different regions of interest in the image which will allow you to detect if people are in different regions of the image.

It doesn’t give you rectangles around people. It just classifies a given rectangle in an image.

Is there any way though I can find rectangles of moving things?

Yes, through frame differencing which will give you a difference blob.

Question, do you actually need to track the rectangels?

Not necessarily, I just need to figure out the relative velocity to the sensor.

Ah, yeah, this isn’t particularly easy with our current abilities.

If you do frame differencing with a background image you can use find_blobs() to do blob tracking to track all the difference blobs in the background. This doesn’t discern between people or not. But, it will tell you where movement is and give you rectangles around that.

Thanks, it is working well.
How can I make this more dynamic now (I mean moving around the sensor), since frame differencing is limited to a pretty static sensor?
I was thinking about implementing that using the gyro and cutting the image accordingly, but Image.difference doesn’t have an ROI parameter.

Hi, see the advanced frame differencing script. You can periodically update the background.

E.g. you can do a difference every frame if you want which would only detection motion. Or every two frames. If you have the H7 Plus there’s enough RAM onboard to do a very explicit image queue for this.