Ask Your Question

Motion Detection with OpenCV (C++)

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

yohanrw gravatar image

updated 2020-11-30 03:02:54 -0600

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 -0600

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

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 -0600 )edit

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

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 -0600

keltik gravatar image

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

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 -0600

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

Question Tools



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

Seen: 54,035 times

Last updated: Nov 23 '13