Non Rectangular ROI - Motion Detection

Discussion related to "under the hood" OpenMV topics.
User avatar
Posts: 12
Joined: Tue Jul 11, 2017 5:42 pm

Non Rectangular ROI - Motion Detection

Postby rommel » Tue Jul 11, 2017 5:55 pm

I am implementing motion detection for a configurable roi. I noticed that they are of the format (x,y,w,h).

1. Is it possible to have an roi that is not specifically rectangular? Maybe a trapezoid? A triangle? etc.

2. I get an error when I run the snapshot_on_movement example, does the "temp" drive get created on the OpenMV on board storage or do I need an SD card or etc?

3. With image.statistics(), is there docs on the definitions of the return of this function? The example code explains array index 5 is for lighting color channel, what are the rest?

4. Since I am doing simple motion detection, is there any benefit to disabling any other sensor auto functions?

Thank you! :D :ugeek:
User avatar
Posts: 4287
Joined: Sun May 24, 2015 2:10 pm

Re: Non Rectangular ROI - Motion Detection

Postby kwagyeman » Tue Jul 11, 2017 6:21 pm

1. You can use an image mask to zero pixels. As in, create a bmp file and do b_and() of the difference frame with the mask file. This lets you pixel select the ROIs.

2. You need an SD card.

3. See the new API. I redid the method such that it returns an object with named parameters. I.e. you can do .mean() to get the mean. Read the documentation on the image library.
User avatar
Posts: 1198
Joined: Sun May 24, 2015 3:53 pm

Re: Non Rectangular ROI - Motion Detection

Postby iabdalkader » Tue Jul 11, 2017 9:26 pm

There's an undocumented mask_ellipse() function but it's fixed (you can't change the size of the ellipse) and only works on grayscale. And'ing with another image is much more flexible, but it will be slower (unless loaded in memory).

Return to “Technical Discussion”

Who is online

Users browsing this forum: No registered users and 5 guests