Motion Detection using OpenCV
Motion detection is the process of detecting a change in the position of an object relative to its surroundings or a change in the surroundings relative to an object. Motion detection can be achieved by either mechanical or electronic methods. When motion detection is accomplished by natural organisms, it is called motion perception.
In video surveillance, motion detection refers to the capability of the surveillance system to detect motion and capture the events. Motion detection is usually a software-based monitoring algorithm which, when it detects motions will signal the surveillance camera to begin capturing the event. Also called activity detection. An advanced motion detection surveillance system can analyze the type of motion to see if it warrants an alarm.
Requirements:
- Python3
- OpenCV (library)
- Numpy (library)
Main Logic :
Videos can be treated as stack of pictures called frames. Here i am comparing current frame(Image) to the last frame(Image) which should be static(No movements initially). We compare two images by comparing the intensity value of each pixels.
For see Example Video click here
For Code click here