https://github.com/kalebu/real-time-vehicle-dection-python
A python project that does real-time vehicle detection using a trained car-cascade Model
https://github.com/kalebu/real-time-vehicle-dection-python
article computervision data-science machine-learning object-detection python python-3 python-datascience python-tanzania pythonprojects vehicle-dection-python vehicle-detection
Last synced: 5 months ago
JSON representation
A python project that does real-time vehicle detection using a trained car-cascade Model
- Host: GitHub
- URL: https://github.com/kalebu/real-time-vehicle-dection-python
- Owner: Kalebu
- Created: 2020-05-04T09:41:34.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-06-15T09:54:39.000Z (over 2 years ago)
- Last Synced: 2025-05-01T09:56:27.923Z (5 months ago)
- Topics: article, computervision, data-science, machine-learning, object-detection, python, python-3, python-datascience, python-tanzania, pythonprojects, vehicle-dection-python, vehicle-detection
- Language: Python
- Homepage: https://kalebujordan.dev/real-time-vehicle-detection-using-python/
- Size: 2.77 MB
- Stars: 37
- Watchers: 3
- Forks: 40
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
# [Real-time-Vehicle-Dection-Python](https://kalebujordan.dev/real-time-vehicle-detection-using-python/)Hi guys, This repository consist of a source code of script to detect cars in a video/camera frame and then draw rectangaluar boxes around them.
The **ML algorithms** used for detecting cars and bounding boxes coordinates is a pretrained cascade model [Haarcascade car](https://github.com/Kalebu/Real-time-Vehicle-Dection-Python/blob/master/haarcascade_car.xml).
[](https://www.patreon.com/kalebujordan)
## Where is the full article ?
The full article for this project is originally published on [my blog](kalebujordan.dev) with an article with title [Real-time vehicle detection in python](https://kalebujordan.dev/real-time-vehicle-detection-using-python/)
## Getting started
Firstly we have to clone the project repository or download the zip of project and then extract it.
```bash
git clone https://github.com/Kalebu/Real-time-Vehicle-Dection-Python
cd Real-time-Vehicle-Dection-Python
Real-time-Vehicle-Dection-Python ->
```## Dependencies
Now once we have the project repo in our local directory, now lets install the dependecies required to run our script
```bash
pip install opencv-python
```## Sample video
The sample video we used in this project is [**cars.mp4**](https://github.com/Kalebu/Real-time-Vehicle-Dection-Python/blob/master/cars.mp4) which will come as you download or clone the repository, to load a different video with different filename, you might wanna change the source code a bit.
```python
def Simulator():
CarVideo = cv2.VideoCapture('cars.mp4') # change cars.mp4 to name of your vidoe
while CarVideo.isOpened():
ret, frame = CarVideo.read()
controlkey = cv2.waitKey(1)
if ret:
cars_frame = detect_cars(frame)
cv2.imshow('frame', cars_frame)
else:
break
if controlkey == ord('q'):
breakCarVideo.release()
cv2.destroyAllWindows()```
## **[
](./pictures/rocket.png) running our script**
Now you can launch your scripts;
```bash
python app.py
```If you use the provided sample video, your script is going to look as shown in the picture below;
## Issues ?
Are you facing any issue while trying to run the script, well then raise an issue and I will do my best fixing it as soon as I can
## Credits
All the credits to [kalebu](github.com/kalebu)