Skip to content

Commit 76a49a2

Browse files
assignment day 5 full body detection
1 parent 0774664 commit 76a49a2

File tree

5 files changed

+17043
-0
lines changed

5 files changed

+17043
-0
lines changed

.idea/family.jpg

13.8 KB
Loading

body_detection.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import cv2
2+
import matplotlib.pyplot as plt
3+
image = cv2.imread('person.jpg')
4+
image_temp = image.copy()
5+
full_body_cascade = cv2.CascadeClassifier('haarcascade_fullbody.xml')
6+
gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
7+
body = full_body_cascade.detectMultiScale(gray_image, 1.02, 3)
8+
for (x, y, w, h) in body:
9+
cv2.rectangle(image, (x, y), (x + w, y + h), (255, 0, 0), 2)
10+
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
11+
cv2.imshow("final",image)
12+
cv2.waitKey(0)
13+
cv2.destroyAllWindows()

family.jpg

13.8 KB
Loading

0 commit comments

Comments
 (0)