Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

History

History
History
18 lines (16 loc) 路 806 Bytes

File metadata and controls

18 lines (16 loc) 路 806 Bytes
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import cv2
img_file = "Human.jpg"
# trained human data Link:"https://raw.githubusercontent.com/opencv/opencv/master/data/haarcascades/haarcascade_fullbody.xml"
classifier_Human = 'car_dect.xml'
img = cv2.imread(img_file) # create image reader
# convert image black and white i.e. grayscale
black_and_white = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
Human_detect = cv2.CascadeClassifier(classifier_Human) # create classifier
humans = Human_detect.detectMultiScale(black_and_white) # detect cars
for (
x, y, w, h
) in cars: # the above variable will return 4 cordinates i.e height,width,postionx,positiony
# this loop will create grren rectangle when car is detected
cv2.rectangle(img, (x, y), (x + w, y + h), (0, 255, 0), 3)
cv2.imshow('Human image', img) # display image
cv2.waitKey()
Morty Proxy This is a proxified and sanitized view of the page, visit original site.