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

Sign up
Appearance settings

Commit 4ccbb63

Browse files
Merge pull request avinashkranjan#601 from Avishake007/new_branch
Added Body Detection
2 parents 0b4631c + a3fcaaa commit 4ccbb63

File tree

3 files changed

+17082
-0
lines changed

3 files changed

+17082
-0
lines changed

‎Body Detection/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
<h1 align="center"> Body Detection</h1>
3+
Detect your Body with this
4+
5+
---------------------------------------------------------------------
6+
7+
## Modules Used
8+
-opencv
9+
10+
11+
## How it works
12+
- First you have to enter the correct path where your video is located.
13+
- Then it will convert your video frame by frame into grayscale
14+
- Then it will detect your Body using the fullbody cascade xml file
15+
- Then you could see green rectangle boxes appearing which is detecting your body
16+
17+
#### By [Avishake Maji](https://github.com/Avishake007)

‎Body Detection/detection.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import cv2
2+
3+
# Load the Cascade Classifier
4+
body_cascade = cv2.CascadeClassifier("haarcascade_fullbody.xml")
5+
videopath=input("Enter the video Path : ")
6+
#Capture the video
7+
cap = cv2.VideoCapture(videopath)
8+
9+
while True:
10+
11+
#read image from video
12+
response,frame = cap.read()
13+
14+
if response == False:
15+
break
16+
17+
# Convert to grayscale
18+
gray_img = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
19+
20+
# Detect the full body
21+
faces = body_cascade.detectMultiScale(gray_img, 1.1, 1)
22+
23+
#display rectangle
24+
for (x, y, w, h) in faces:
25+
cv2.rectangle(frame, (x, y), (x+w, y+h), (0, 255, 0), 2)
26+
27+
# display video
28+
cv2.imshow('img', frame)
29+
30+
if cv2.waitKey(1) & 0xFF == ord('q'):# Enter q to quit
31+
break
32+
33+
# Release the VideoCapture object
34+
cap.release()
35+
cv2.destroyAllWindows()

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /