https://github.com/duyet/opencv-car-detection
OpenCV Python program for Vehicle detection
https://github.com/duyet/opencv-car-detection
Last synced: about 1 year ago
JSON representation
OpenCV Python program for Vehicle detection
- Host: GitHub
- URL: https://github.com/duyet/opencv-car-detection
- Owner: duyet
- License: mit
- Created: 2017-09-19T14:31:32.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-01-01T17:33:18.000Z (over 2 years ago)
- Last Synced: 2025-03-28T02:45:27.136Z (about 1 year ago)
- Language: Jupyter Notebook
- Size: 3.56 MB
- Stars: 28
- Watchers: 4
- Forks: 52
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# opencv-car-detection
OpenCV Python program for Vehicle detection
```python
import cv2
from matplotlib import pyplot as plt
car_cascade = cv2.CascadeClassifier('cars.xml')
img = cv2.imread('car3.jpg', 1)
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
# Detect cars
cars = car_cascade.detectMultiScale(gray, 1.1, 1)
# Draw border
for (x, y, w, h) in cars:
cv2.rectangle(img, (x,y), (x+w,y+h), (0,0,255), 2)
ncars = ncars + 1
# Show image
plt.figure(figsize=(10,20))
plt.imshow(img)
```
## Demo

## Result
