Skip to content

iamdevdhanush/Motion-Detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 

Repository files navigation

πŸŽ₯ Motion Detection Using OpenCV πŸ•΅οΈβ€β™‚οΈ

This project demonstrates a basic motion detection system using OpenCV and Python. It captures video from a camera, processes the frames to detect moving objects, and highlights detected motion areas in real-time. πŸš€


✨ Features

  • πŸ“Ή Capture video feed from the webcam.
  • 🎨 Convert frames to grayscale and apply Gaussian blur for noise reduction.
  • πŸ” Detect motion by comparing the current frame with the first frame.
  • πŸ”² Highlight moving objects with bounding rectangles.
  • πŸ“ Display status text indicating whether motion is detected.
  • ❌ Press q to quit the application.

πŸ› οΈ Requirements

  • Python 3.x 🐍
  • OpenCV (cv2) πŸ–ΌοΈ
  • Imutils πŸ”§
  • Time module (standard Python library) ⏰

πŸ“¦ Installation

Install required libraries using pip:

pip install opencv-python imutils

▢️ Usage

Run the script to start the motion detection:

python motion_detection.py

βš™οΈ How It Works

πŸ₯‡ The first frame is captured and used as a reference.

πŸ–€ Each new frame is converted to grayscale and blurred.

βž– The absolute difference between the current frame and the reference frame is calculated.

⚫ Thresholding and dilation are applied to highlight differences.

πŸ”Ž Contours are detected in the thresholded image.

βœ… If contours exceed a minimum area, bounding boxes are drawn, and motion is detected.

πŸ“Ί The video feed with detected motion highlighted is displayed.

About

Motion Detection system using open cv

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages