I developed a footfall detection system using Python and YOLOv8 to monitor and record the number of people entering and exiting a specific area in real time. This system utilizes object detection tracking and geometric algorithms to determine movement direction across a predefined line. The data is stored in a database for further analysis.
- Real-time monitoring of foot traffic
- Object detection using YOLOv8
- Direction determination using geometric algorithms
- Data storage in SQLite3 for further analysis
- CCTV camera with RTSP streaming
- Computer with GPU (optional for better performance)
- Python 3.x
- OpenCV
- NumPy
- SQLite3
- YOLOv8 (ultralytics package)
- Configuration file (configurations.json)
- Clone the repository:
git clone https://github.com/your-username/footfall-detection-system.git cd footfall-detection-system - Install the required packages:
pip install -r requirements.txt
- Set up the configuration file:
- Create a
configurations.jsonfile based on the provided template and update it with your specific settings.
- Create a
- Run the main script to start the footfall detection system:
python CCTV_IN_OUT.py
- The system will start processing the video stream from the CCTV camera and record the number of people entering and exiting the area.
To detect line crossing, we use the line equation ax + by + c = 0. The sign of this equation indicates a point's position relative to the line. A change in sign between frames indicates crossing.
We calculate the dot product between the user-defined direction vector and the object's movement vector. The cosine of the angle between these vectors determines if the movement aligns with the defined direction.
Contributions are welcome! Please read the contribution guidelines first.
This project is licensed under the MIT License - see the LICENSE file for details.