Skip to content

Commit 81a319f

Browse files
Full Body Human Detection Using OpenCV
1 parent 14343fc commit 81a319f

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

Human Detection/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Full Body Human Detection
2+
3+
Uses OpenCV to Detect Human using pre trained data.
4+
5+
## Image Processing
6+
7+
Image Processing is most commonly termed as 'Digital Image Processing' and the domain in which it is frequently used is 'Computer Vision'.
8+
9+
Both Image Processing algorithms and Computer Vision (CV) algorithms take an image as input; however, in image processing,the output is also an image, whereas in computer vision the output can be some features/information about the image.
10+
11+
## OpenCV
12+
13+
![](https://logodix.com/logo/1989939.png)
14+
15+
## Installation
16+
17+
### Windows
18+
19+
`$ pip install opencv-python`
20+
21+
### MacOS
22+
23+
`$ brew install opencv3 --with-contrib --with-python3`
24+
25+
### Linux
26+
27+
`$ sudo apt-get install libopencv-dev python-opencv`

Human Detection/script.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import cv2
2+
img_file = "Human.jpg"
3+
# trained human data Link:"https://raw.githubusercontent.com/opencv/opencv/master/data/haarcascades/haarcascade_fullbody.xml"
4+
classifier_Human = 'car_dect.xml'
5+
img = cv2.imread(img_file) # create image reader
6+
# convert image black and white i.e. grayscale
7+
black_and_white = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
8+
Human_detect = cv2.CascadeClassifier(classifier_Human) # create classifier
9+
humans = Human_detect.detectMultiScale(black_and_white) # detect cars
10+
11+
for (x, y, w, h) in cars: # the above variable will return 4 cordinates i.e height,width,postionx,positiony
12+
# this loop will create grren rectangle when car is detected
13+
cv2.rectangle(img, (x, y), (x+w, y+h), (0, 255, 0), 3)
14+
15+
cv2.imshow('Human image', img) # display image
16+
cv2.waitKey()

0 commit comments

Comments
 (0)