Update app.py
Browse files
app.py
CHANGED
@@ -111,8 +111,19 @@ def video_frame_callback(frame: av.VideoFrame) -> av.VideoFrame:
|
|
111 |
angleHipL = calculate_angle(shoulderL, hipL, [hipL[0], 0])
|
112 |
|
113 |
#Visualize of left leg
|
114 |
-
cv2.putText(image, str(angleHipL), tuple(np.multiply(angleHipL, [w, h]).astype(int)),cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 255), 2, cv2.LINE_AA)
|
115 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
|
117 |
|
118 |
if angleKneeL > 110 and stage == 'down':
|
|
|
111 |
angleHipL = calculate_angle(shoulderL, hipL, [hipL[0], 0])
|
112 |
|
113 |
#Visualize of left leg
|
114 |
+
# cv2.putText(image, str(angleHipL), tuple(np.multiply(angleHipL, [w, h]).astype(int)),cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 255), 2, cv2.LINE_AA)
|
115 |
+
|
116 |
+
# cv2.putText(image, str(int(angleHipL)),(0, 200), cv2.FONT_HERSHEY_SIMPLEX, 1.7, (255, 255, 255), 2, cv2.LINE_AA)
|
117 |
+
# # cv2.putText(image, str(angleKneeL), tuple(np.multiply(angleKneeL, [w, h]).astype(int)),cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 255), 2, cv2.LINE_AA)
|
118 |
+
# cv2.putText(image, str(int(angleKneeL)),(170, 200), cv2.FONT_HERSHEY_SIMPLEX, 1.7, (255, 255, 255), 2, cv2.LINE_AA)
|
119 |
+
|
120 |
+
# Relative points in terms of w and h
|
121 |
+
rel_point1 = (int(w * 0), int(h - h * 0.5)) # (0, h - 0.2*h)
|
122 |
+
rel_point2 = (int(w * 0.265625), int(h - h * 0.5)) # 170 / 640 = 0.265625
|
123 |
+
|
124 |
+
cv2.putText(image, str(int(angleHipL)),(rel_point1), cv2.FONT_HERSHEY_SIMPLEX, 1.7, (255, 255, 255), 2, cv2.LINE_AA)
|
125 |
+
|
126 |
+
cv2.putText(image, str(int(angleKneeL)),(rel_point2), cv2.FONT_HERSHEY_SIMPLEX, 1.7, (255, 255, 255), 2, cv2.LINE_AA)
|
127 |
|
128 |
|
129 |
if angleKneeL > 110 and stage == 'down':
|