Pratyush101 commited on
Commit
731164f
·
verified ·
1 Parent(s): 745f252

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -10
app.py CHANGED
@@ -109,6 +109,16 @@ def video_frame_callback(frame: av.VideoFrame) -> av.VideoFrame:
109
  # Calculate angles
110
  angleKneeL = calculate_angle(hipL, kneeL, ankleL)
111
  angleHipL = calculate_angle(shoulderL, hipL, [hipL[0], 0])
 
 
 
 
 
 
 
 
 
 
112
 
113
  if angleKneeL > 110 and stage == 'down':
114
  stage = 'up'
@@ -137,16 +147,6 @@ def video_frame_callback(frame: av.VideoFrame) -> av.VideoFrame:
137
  cv2.putText(image, stage,
138
  (170, 70), cv2.FONT_HERSHEY_SIMPLEX, 1.7, (255, 255, 255), 2, cv2.LINE_AA)
139
 
140
- # # Hip angle
141
-
142
-
143
- #Visualize of left leg hip joint
144
- cv2.putText(image, str(angleHipL),tuple(np.multiply(angleHipL, [w, h]).astype(int)),cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 0, 0), 2, cv2.LINE_AA)
145
-
146
- # # Knee angle
147
- #Visualize of left leg knee joint
148
- cv2.putText(image, str(angleKneeL),tuple(np.multiply(angleKneeL, [w, h]).astype(int)),cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 0, 0), 2, cv2.LINE_AA)
149
-
150
  mp_drawing.draw_landmarks(image, results.pose_landmarks, mp_pose.POSE_CONNECTIONS,mp_drawing.DrawingSpec(color=(255, 175, 0), thickness=2, circle_radius=2),mp_drawing.DrawingSpec(color=(0, 255, 200), thickness=2, circle_radius=2))
151
 
152
  result_queue.put(detections)
 
109
  # Calculate angles
110
  angleKneeL = calculate_angle(hipL, kneeL, ankleL)
111
  angleHipL = calculate_angle(shoulderL, hipL, [hipL[0], 0])
112
+ # # Hip angle
113
+
114
+
115
+ #Visualize of left leg hip joint
116
+ cv2.putText(image, str(angleHipL),tuple(np.multiply(angleHipL, [w, h]).astype(int)),cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 0, 0), 2, cv2.LINE_AA)
117
+
118
+ # # Knee angle
119
+ #Visualize of left leg knee joint
120
+ cv2.putText(image, str(angleKneeL),tuple(np.multiply(angleKneeL, [w, h]).astype(int)),cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 0, 0), 2, cv2.LINE_AA)
121
+
122
 
123
  if angleKneeL > 110 and stage == 'down':
124
  stage = 'up'
 
147
  cv2.putText(image, stage,
148
  (170, 70), cv2.FONT_HERSHEY_SIMPLEX, 1.7, (255, 255, 255), 2, cv2.LINE_AA)
149
 
 
 
 
 
 
 
 
 
 
 
150
  mp_drawing.draw_landmarks(image, results.pose_landmarks, mp_pose.POSE_CONNECTIONS,mp_drawing.DrawingSpec(color=(255, 175, 0), thickness=2, circle_radius=2),mp_drawing.DrawingSpec(color=(0, 255, 200), thickness=2, circle_radius=2))
151
 
152
  result_queue.put(detections)