This Python script utilizes OpenCV to perform real-time motion detection using a webcam feed. It captures video frames, compares them to the initial frame, and highlights moving objects with bounding rectangles. This is a straightforward tool for motion detection, making it a great starting point for various projects.
- Real-time motion detection using your webcam.
- Moving objects are marked with bounding rectangles.
- Easy to use and customizable.
You'll need to have the following installed to run this code:
- Python
- OpenCV
- imutils
You can install the required packages using pip:
pip install opencv-python imutils
- Clone this repository to your local machine.
- Run the Python script.
- To exit the application, press 'ESC'.
You can customize the code by adjusting the area variable to change the minimum object size needed to classify it as moving. Feel free to modify and expand upon this code to suit your specific project requirements.
This script was inspired by the need for a simple motion detection tool using OpenCV.
Feel free to use, modify, and improve this code as needed for your own projects. If you have any questions or suggestions, please don't hesitate to reach out.