This Python script allows you to count and track objects in a video stream. It can be used for various applications, such as object counting in surveillance videos or monitoring objects on a conveyor belt.
- Real-time object counting and tracking in video streams.
- Object tracking using Kalman filters for smooth and accurate tracking.
- Object counting based on the number of unique tracked objects.
- Adjustable parameters for object tracking and filtering.
- Visualization of object tracking and bounding boxes in the video.
- Python 3.x
- OpenCV (
cv2
) - NumPy
- SciPy
motpy
(Multi-Object Tracking for Python)
-
Clone this repository or download the script
-
Install the required dependencies:
pip install opencv-python numpy scipy motpy
-
Specify the path to your video file in the
video_path
variable within the script. -
Run the script:
python object_counter.py
- Press 'q' to exit the video window when you're done.
You can customize the script by adjusting parameters such as threshold values, object tracking settings, and more. Refer to the script comments for configuration details.
Contributions are welcome! If you have any ideas for improvements or find any issues, please open an issue or submit a pull request.
- This script uses the
motpy
library for multi-object tracking. Visit motpy on GitHub for more information.
- This script is designed for educational purposes and can be a starting point for more advanced object counting and tracking projects.