Update app.py
Browse files
app.py
CHANGED
@@ -102,16 +102,16 @@ def video_frame_callback(frame: av.VideoFrame) -> av.VideoFrame:
|
|
102 |
angleKneeL = calculate_angle(hipL, kneeL, ankleL)
|
103 |
angleHipL = calculate_angle(shoulderL, hipL, [hipL[0], 0])
|
104 |
|
105 |
-
rel_point1 = (int(w * 0), int(h - h * 0.
|
106 |
-
rel_point2 = (int(w * 0.
|
107 |
|
108 |
-
cv2.rectangle(image, (0,
|
109 |
-
cv2.rectangle(image, (0,
|
110 |
-
cv2.putText(image, 'HipL', (10,
|
111 |
|
112 |
-
cv2.putText(image, 'KneeL', (
|
113 |
-
cv2.putText(image, str(int(angleHipL)), rel_point1, cv2.FONT_HERSHEY_SIMPLEX, 1.
|
114 |
-
cv2.putText(image, str(int(angleKneeL)), rel_point2, cv2.FONT_HERSHEY_SIMPLEX, 1.
|
115 |
|
116 |
if angleKneeL > 110 and stage == 'down':
|
117 |
stage = 'up'
|
@@ -121,13 +121,13 @@ def video_frame_callback(frame: av.VideoFrame) -> av.VideoFrame:
|
|
121 |
if angleKneeL < 110 and stage == 'up':
|
122 |
stage = 'down'
|
123 |
|
124 |
-
cv2.rectangle(image, (0, 0), (
|
125 |
-
cv2.rectangle(image, (0, 3), (
|
126 |
|
127 |
cv2.putText(image, 'Left', (10, 22), cv2.FONT_HERSHEY_SIMPLEX, 0.7, (255, 255, 255), 2, cv2.LINE_AA)
|
128 |
-
cv2.putText(image, str(correct), (10, 70), cv2.FONT_HERSHEY_SIMPLEX, 1.
|
129 |
-
cv2.putText(image, 'STAGE', (
|
130 |
-
cv2.putText(image, stage, (
|
131 |
|
132 |
mp_drawing.draw_landmarks(
|
133 |
image, results.pose_landmarks, mp_pose.POSE_CONNECTIONS,
|
|
|
102 |
angleKneeL = calculate_angle(hipL, kneeL, ankleL)
|
103 |
angleHipL = calculate_angle(shoulderL, hipL, [hipL[0], 0])
|
104 |
|
105 |
+
rel_point1 = (int(w * 0), int(h - h * 0.65))
|
106 |
+
rel_point2 = (int(w * 0.17), int(h - h * 0.65))
|
107 |
|
108 |
+
cv2.rectangle(image, (0, 90), (200, 175), (127, 248, 236), -1)
|
109 |
+
cv2.rectangle(image, (0, 93), (197, 173), (12, 85, 61), -1)
|
110 |
+
cv2.putText(image, 'HipL', (10, 122), cv2.FONT_HERSHEY_SIMPLEX, 0.7, (255, 255, 255), 2, cv2.LINE_AA)
|
111 |
|
112 |
+
cv2.putText(image, 'KneeL', (125, 122),cv2.FONT_HERSHEY_SIMPLEX, 0.7, (255, 255, 255), 2, cv2.LINE_AA)
|
113 |
+
cv2.putText(image, str(int(angleHipL)), rel_point1, cv2.FONT_HERSHEY_SIMPLEX, 1.5, (255, 255, 255), 2, cv2.LINE_AA)
|
114 |
+
cv2.putText(image, str(int(angleKneeL)), rel_point2, cv2.FONT_HERSHEY_SIMPLEX, 1.5, (255, 255, 255), 2, cv2.LINE_AA)
|
115 |
|
116 |
if angleKneeL > 110 and stage == 'down':
|
117 |
stage = 'up'
|
|
|
121 |
if angleKneeL < 110 and stage == 'up':
|
122 |
stage = 'down'
|
123 |
|
124 |
+
cv2.rectangle(image, (0, 0), (200, 83), (127, 248, 236), -1)
|
125 |
+
cv2.rectangle(image, (0, 3), (197, 80), (12, 85, 61), -1)
|
126 |
|
127 |
cv2.putText(image, 'Left', (10, 22), cv2.FONT_HERSHEY_SIMPLEX, 0.7, (255, 255, 255), 2, cv2.LINE_AA)
|
128 |
+
cv2.putText(image, str(correct), (10, 70), cv2.FONT_HERSHEY_SIMPLEX, 1.5, (255, 255, 255), 2, cv2.LINE_AA)
|
129 |
+
cv2.putText(image, 'STAGE', (110, 22), cv2.FONT_HERSHEY_SIMPLEX, 0.7, (255, 255, 255), 2, cv2.LINE_AA)
|
130 |
+
cv2.putText(image, stage, (77, 70), cv2.FONT_HERSHEY_SIMPLEX, 1.5, (255, 255, 255), 2, cv2.LINE_AA)
|
131 |
|
132 |
mp_drawing.draw_landmarks(
|
133 |
image, results.pose_landmarks, mp_pose.POSE_CONNECTIONS,
|