Skip to the content.

🎥 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


🛠️ Requirements


📦 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.