Detect motion direction

Discussion related to "under the hood" OpenMV topics.
bob63
Posts: 27
Joined: Sun Aug 07, 2016 8:41 am

Detect motion direction

Postby bob63 » Sun Aug 07, 2016 8:50 am

Hi,
I would like to know if OpenMV can be the right device for a my project.
I need detect the direction of someone/something that transit under a door without have any marker or pre defined shape.
The OpenMV could be the right device for this scope and in which way I could implement ?
Comparing more pictures is able "easily" to define the direction?
Thanks.
User avatar
iabdalkader
Posts: 1227
Joined: Sun May 24, 2015 3:53 pm

Re: Detect motion direction

Postby iabdalkader » Sun Aug 07, 2016 8:58 am

Yes, you could use optical flow for that, you won't need to implement anything it's already implemented.
bob63
Posts: 27
Joined: Sun Aug 07, 2016 8:41 am

Re: Detect motion direction

Postby bob63 » Tue Aug 09, 2016 3:47 pm

oK, perfect !
I've placed my order yesterday .
Thanks again.
User avatar
kwagyeman
Posts: 4538
Joined: Sun May 24, 2015 2:10 pm

Re: Detect motion direction

Postby kwagyeman » Tue Aug 09, 2016 8:16 pm

Can you let me know exactly what you want to do? I'll be able to give a better explanation of the steps you have to take then.
Nyamekye,
bob63
Posts: 27
Joined: Sun Aug 07, 2016 8:41 am

Re: Detect motion direction

Postby bob63 » Fri Sep 09, 2016 4:25 pm

I want place the openmv camora on the top of a door to count how many person pass under the door from left to right and viceversa and count the transit in both direction. I've tryed the example available but not really understood how works an how decode the output for my scope.
Thanks.
User avatar
kwagyeman
Posts: 4538
Joined: Sun May 24, 2015 2:10 pm

Re: Detect motion direction

Postby kwagyeman » Fri Sep 09, 2016 7:14 pm

Okay, so, is the room in a controlled environment and is the lighting constant? If so, it will actually be better to use color tracking for anything that isn't the color of the hallway. The camera will then tell you about all the color blobs moving around in the hallway.

Each blob will give you a bounding rectangle along with centroid information. From that you can track the direction of travel. This will only easily work for one person at a time though. Is that okay?
Nyamekye,
bob63
Posts: 27
Joined: Sun Aug 07, 2016 8:41 am

Re: Detect motion direction

Postby bob63 » Sat Sep 10, 2016 3:48 am

Hi,
unfortuantely I can't assume that the light will be always costant because during the day the light in the rooms could change. My idea was catch periodically the picture of the floor having so a reference and then compare this picture with frames taken when someone pass trought the door to understand the direction . The Optical Flow looks good if I understand how interpreter the output data.
Thanks. Roberto.
User avatar
kwagyeman
Posts: 4538
Joined: Sun May 24, 2015 2:10 pm

Re: Detect motion direction

Postby kwagyeman » Sat Sep 10, 2016 10:56 am

Okay, then you'll want to do combined frame differencing with blob detection.

Optical flow is really for just using the Cam like a mouse.

So, see the advanced frame differencing script. Is in the examples folders. Anyway, after you have the difference frame you can use the find_blobs function on the image (looking for any color that ins't black) to find all the changes in the image. Then you can track the movement of those blobs.

The hard part will be getting direction information from movement. Doing it for one blob is not so hard. Multiple blobs will be a challenge.
Nyamekye,
bob63
Posts: 27
Joined: Sun Aug 07, 2016 8:41 am

Re: Detect motion direction

Postby bob63 » Sun Sep 11, 2016 6:13 am

Trying to test the basic and advanced frame differencing scripts I got this error msg IMPORT ERROR : no module named 'os' .
I'm using a 4 gb sd , that I normally use on the PyBoard without problems.
Thanks Roberto.
User avatar
kwagyeman
Posts: 4538
Joined: Sun May 24, 2015 2:10 pm

Re: Detect motion direction

Postby kwagyeman » Sun Sep 11, 2016 12:11 pm

Hi, you need to update your firmware. We released a new version of the Ide that hasn't the newest firmware that fixes this issue. When Ibrahim updated the MicroPyhton version to v1.8 the os module was not included.
Nyamekye,

Return to “Technical Discussion”

Who is online

Users browsing this forum: No registered users and 1 guest