This Python script detects motion in a specified region of interest (ROI) from a webcam feed using OpenCV. When motion is detected, it captures a frame and sends an alert with a photo via the Telegram Bot API to a specified chat ID. This system is useful for security applications where immediate alerts are needed upon unauthorized motion detection.
- Motion Detection: Monitors a defined ROI for changes using background subtraction with OpenCV.
- Alert Notification: Sends a photo alert to a Telegram chat using the Telegram Bot API upon detecting motion.
- Adjustable Parameters: Allows customization of ROI coordinates, background subtraction method, minimum contour area, and alert interval.
- Real-time Feedback: Displays the video feed with overlaid ROI and detected contours for visual monitoring.
- Error Handling: Catches exceptions during photo capture and alert sending to ensure robust operation.
git clone https://github.com/whitehatboy005/Motion-Detection-Alert-System
cd Motion-Detection-Alert-System
pip install -r requirements.txt
notepad config.env
python alert.py
To get Chat ID visit @GetMyChatID_Bot Now you will copy the chat Id and config it.
To access the bot @SecurityAlertBot and activate it.