Pratyush101 commited on
Commit
52700a9
·
verified ·
1 Parent(s): c3ddf22

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -13
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.55))
106
- rel_point2 = (int(w * 0.265625), int(h - h * 0.55))
107
 
108
- cv2.rectangle(image, (0, 110), (280, 225), (127, 248, 236), -1)
109
- cv2.rectangle(image, (0, 113), (277, 222), (12, 85, 61), -1)
110
- cv2.putText(image, 'HipL', (10, 140), cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 255), 2, cv2.LINE_AA)
111
 
112
- cv2.putText(image, 'KneeL', (180, 140),cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 255), 2, cv2.LINE_AA)
113
- cv2.putText(image, str(int(angleHipL)), rel_point1, cv2.FONT_HERSHEY_SIMPLEX, 1.7, (255, 255, 255), 2, cv2.LINE_AA)
114
- cv2.putText(image, str(int(angleKneeL)), rel_point2, cv2.FONT_HERSHEY_SIMPLEX, 1.7, (255, 255, 255), 2, cv2.LINE_AA)
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), (280, 103), (127, 248, 236), -1)
125
- cv2.rectangle(image, (0, 3), (277, 100), (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.7, (255, 255, 255), 2, cv2.LINE_AA)
129
- cv2.putText(image, 'STAGE', (180, 22), cv2.FONT_HERSHEY_SIMPLEX, 0.7, (255, 255, 255), 2, cv2.LINE_AA)
130
- cv2.putText(image, stage, (147, 70), cv2.FONT_HERSHEY_SIMPLEX, 1.7, (255, 255, 255), 2, cv2.LINE_AA)
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,