A Python project that detects motion from videos using OpenCV.
This project uses simple computer vision techniques to detect motion in video streams. It's ideal for:
- Beginners learning OpenCV
- Building security camera simulations
- Real-time object tracking demos
motion-detection/
│
├── motion_detection.py # Main Python script
├── test.mp4 # Example video input
├── static.png # Optional image output
├── README.md # Project documentation
├── .gitignore # Files to exclude from Git
Install dependencies with:
pip install opencv-python imutils matplotlib numpy- Read video frame by frame
- Convert frames to grayscale
- Compare current and previous frames to detect movement
- Highlight detected movement with bounding boxes
Run the script with:
python motion_detection.py- By default, it uses the webcam.
- To use a video file, replace
cv2.VideoCapture(0)with your file path.
These files are ignored by Git:
static.png
test.mp4
test.png
Add screenshots or output images here, like:
MIT License
This project is free to use for learning and experimentation.
