Skip to content

Commit d2099e1

Browse files
committed
Added Pedestrain detection funtionality
1 parent e7070b1 commit d2099e1

File tree

2 files changed

+17041
-3
lines changed

2 files changed

+17041
-3
lines changed

app.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
import cv2
22

33
cars_cascade = cv2.CascadeClassifier('haarcascade_car.xml')
4+
body_cascade = cv2.CascadeClassifier('fullbody.xml')
45

5-
def detect_cars(frame):
6+
7+
def detect_cars_and_pedestrain(frame):
68
cars = cars_cascade.detectMultiScale(frame, 1.15, 4)
9+
pedistrain = body_casccade.detectMultiSclae(frame, 1.15, 4)
710
for (x, y, w, h) in cars:
8-
cv2.rectangle(frame, (x, y), (x+w,y+h), color=(0, 255, 0), thickness=2)
11+
cv2.rectangle(frame, (x+1, y+1), (x+w,y+h), color=(255, 0, 0), thickness=2)
12+
cv2.rectangle(frame, (x, y), (x+w, y_h), color=(0, 255, 0), thickness=2)
13+
14+
for(x, y, w, h) in pedistrain:
15+
cv2.rectangle(frame, (x, y), (x+w, y+h), color=(0, 255, 255), thickness=2)
16+
917
return frame
1018

1119
def Simulator():
@@ -25,4 +33,4 @@ def Simulator():
2533
cv2.destroyAllWindows()
2634

2735
if __name__ == '__main__':
28-
Simulator()
36+
Simulator()

0 commit comments

Comments
 (0)