-
Notifications
You must be signed in to change notification settings - Fork 0
/
drawer.py
24 lines (24 loc) · 2.75 KB
/
drawer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import cv2
def draw(origimg, theRect, thePoints):
cv2.rectangle(origimg, (int(theRect[0]), int(theRect[1])), (int(theRect[2]), int(theRect[3])), (0, 255, 0), 2)
cv2.line(origimg, (int(thePoints[0][0]), int(thePoints[0][1])), (int(thePoints[1][0]), int(thePoints[1][1])), (255, 255, 0), 2, 8, 0)
cv2.line(origimg, (int(thePoints[1][0]), int(thePoints[1][1])), (int(thePoints[3][0]), int(thePoints[3][1])), (255, 255, 0), 2, 8, 0)
# nose -> right_eye -> right_ear.(0, 2), (2, 4)
cv2.line(origimg, (int(thePoints[0][0]), int(thePoints[0][1])), (int(thePoints[2][0]), int(thePoints[2][1])), (255, 255, 0), 2, 8, 0)
cv2.line(origimg, (int(thePoints[2][0]), int(thePoints[2][1])), (int(thePoints[4][0]), int(thePoints[4][1])), (255, 255, 0), 2, 8, 0)
# nose -> left_shoulder -> left_elbow -> left_wrist.(0, 5), (5, 7), (7, 9)
# cv2.line(origimg, (int(thePoints[0][0]), int(thePoints[0][1])), (int(thePoints[5][0]), int(thePoints[5][1])), (255, 255, 0), 2, 8, 0)
# cv2.line(origimg, (int(thePoints[5][0]), int(thePoints[5][1])), (int(thePoints[7][0]), int(thePoints[7][1])), (255, 255, 0), 2, 8, 0)
# cv2.line(origimg, (int(thePoints[7][0]), int(thePoints[7][1])), (int(thePoints[9][0]), int(thePoints[9][1])), (255, 255, 0), 2, 8, 0)
# # nose -> right_shoulder -> right_elbow -> right_wrist.(0, 6), (6, 8), (8, 10)
# cv2.line(origimg, (int(thePoints[0][0]), int(thePoints[0][1])), (int(thePoints[6][0]), int(thePoints[6][1])), (255, 255, 0), 2, 8, 0)
# cv2.line(origimg, (int(thePoints[6][0]), int(thePoints[6][1])), (int(thePoints[8][0]), int(thePoints[8][1])), (255, 255, 0), 2, 8, 0)
# cv2.line(origimg, (int(thePoints[8][0]), int(thePoints[8][1])), (int(thePoints[10][0]), int(thePoints[10][1])), (255, 255, 0), 2, 8, 0)
# # left_shoulder -> left_hip -> left_knee -> left_ankle.(5, 11), (11, 13), (13, 15)
# cv2.line(origimg, (int(thePoints[5][0]), int(thePoints[5][1])), (int(thePoints[11][0]), int(thePoints[11][1])), (255, 255, 0), 2, 8, 0)
# cv2.line(origimg, (int(thePoints[11][0]), int(thePoints[11][1])), (int(thePoints[13][0]), int(thePoints[13][1])), (255, 255, 0), 2, 8, 0)
# cv2.line(origimg, (int(thePoints[13][0]), int(thePoints[13][1])), (int(thePoints[15][0]), int(thePoints[15][1])), (255, 255, 0), 2, 8, 0)
# # right_shoulder -> right_hip -> right_knee -> right_ankle.(6, 12), (12, 14), (14, 16)
# cv2.line(origimg, (int(thePoints[6][0]), int(thePoints[6][1])), (int(thePoints[12][0]), int(thePoints[12][1])), (255, 255, 0), 2, 8, 0)
# cv2.line(origimg, (int(thePoints[12][0]), int(thePoints[12][1])), (int(thePoints[14][0]), int(thePoints[14][1])), (255, 255, 0), 2, 8, 0)
# cv2.line(origimg, (int(thePoints[14][0]), int(thePoints[14][1])), (int(thePoints[16][0]), int(thePoints[16][1])), (255, 255, 0), 2, 8, 0)