A real-time moving object detection system using Python and OpenCV. The application captures a live webcam feed, detects any motion by comparing frames, and highlights moving objects with a bounding box — displaying a real-time status on screen.
The system shows "Normal" when the scene is still and "Moving Object Detected" with a green bounding box when motion is found.
[Live Camera Feed]
→ Frame 1 captured as background reference
→ Each new frame compared to background
→ Motion area highlighted with green rectangle
→ Status label updated in real-time
- Background Reference — Captures the first frame as a static background
- Grayscale + Blur — Converts each frame to grayscale and applies Gaussian Blur to reduce noise
- Frame Differencing — Finds the absolute difference between the background and current frame
- Thresholding — Applies a binary threshold to isolate motion regions
- Contour Detection — Detects contours of moving regions and draws bounding boxes
| Tool | Purpose |
|---|---|
| Python 3.x | Core programming language |
| OpenCV | Real-time image & video processing |
| imutils | Frame resizing and contour utilities |
# Clone the repository
git clone https://github.com/arunkumararavindhakshan05-sudo/Moving_object_detection_using_opencv.git
cd Moving_object_detection_using_opencv
# Install dependencies
pip install opencv-python imutilspython cameraTest.pyControls:
- Press
Q— Quit the camera feed
Moving_object_detection_using_opencv/
│
├── cameraTest.py # Main script
├── .gitignore
└── README.md
- Add sensitivity/threshold configuration via command-line arguments
- Save video recording when motion is detected
- Send email/SMS alert on detection
- Multi-camera support