Ask Your Question

Motion Detection with OpenCV (C++)

asked 2013-06-08 12:53:30 -0500

yohanrw gravatar image

updated 2015-11-11 07:30:40 -0500

I am asked to write a code which can detect ANY moving object using OpenCV. It will be used in in-door system. And it is real time, input will be taken from a camera, and system need to detect the moving stuff real time. According to my knowledge this is motion detection. I am not considering about unwanted movements like waving of a flag or curtain. When an important motion is detected, the system will raise an alarm.

I know this is possible with opencv, because I saw the following video

But, I do not have resources to learn how to. Official OpenCV tutorials do not contain any data about this.

Please provide me advice, links, learning resources or steps I need to follow.

edit retag flag offensive close merge delete

4 answers

Sort by ยป oldest newest most voted

answered 2013-06-10 03:44:42 -0500

updated 2013-06-10 03:52:11 -0500

You can do object detection using background Subtraction(object detection using background subtraction)

Check this library:

Tutorial: motion detection using BackgroundSubtractorMOG2 :

edit flag offensive delete link more


awesome! I was wondering whether that "drawing rectangles" around moving objects is possible. It seems to be :) Anyway, sorry for my delay of reply, I was waiting for an email notification. No email notifications here?

yohanrw gravatar imageyohanrw ( 2013-06-12 00:44:22 -0500 )edit

answered 2013-06-10 01:20:43 -0500

jigarsen18 gravatar image

i think you have to start with Learning OpenCV Book - Read it. Here you can get the step by step method to use OpenCV.

yes first you have to link the library of openCv to visual studio. See the link steps to confi. opencv.

edit flag offensive delete link more

answered 2013-06-10 00:47:06 -0500

keltik gravatar image

updated 2013-06-10 00:49:56 -0500

You can check out this resource: .

Although its made for python, i guess it is possible to understand the general technique and adapt to some other language.

As long as your background is fixed, you can track any object with it.

edit flag offensive delete link more

answered 2013-11-23 12:31:54 -0500

I did this bit in motion detection.. Go through if any one's interested.. Feel free to use if you want..

edit flag offensive delete link more
Login/Signup to Answer

Question Tools



Asked: 2013-06-08 12:53:30 -0500

Seen: 48,523 times

Last updated: Nov 23 '13