Pratyush101 commited on
Commit
01b8664
·
verified ·
1 Parent(s): 432e5b8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -121,11 +121,17 @@ def video_frame_callback(frame: av.VideoFrame) -> av.VideoFrame:
121
  rel_point1 = (int(w * 0), int(h - h * 0.55)) # (0, h - 0.2*h)
122
  rel_point2 = (int(w * 0.265625), int(h - h * 0.55)) # 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':
130
  stage = 'up'
131
  if 18 < angleHipL < 40:
@@ -136,8 +142,8 @@ def video_frame_callback(frame: av.VideoFrame) -> av.VideoFrame:
136
 
137
  # REP data
138
  # Setup Status box
139
- cv2.rectangle(image, (0,0), (275, 225), (127, 248, 236), -1)
140
- cv2.rectangle(image, (0, 3), (273, 222), (12, 85, 61), -1)
141
 
142
  cv2.putText(image, 'Left', (10, 22),
143
  cv2.FONT_HERSHEY_SIMPLEX, 0.7, (255, 255, 255), 2, cv2.LINE_AA)
@@ -152,10 +158,6 @@ def video_frame_callback(frame: av.VideoFrame) -> av.VideoFrame:
152
 
153
  cv2.putText(image, stage,
154
  (170, 70), cv2.FONT_HERSHEY_SIMPLEX, 1.7, (255, 255, 255), 2, cv2.LINE_AA)
155
-
156
- cv2.putText(image, 'HipL', (10, 140), cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 255), 2, cv2.LINE_AA)
157
-
158
- cv2.putText(image, 'KneeL', (180, 140),cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 255), 2, cv2.LINE_AA)
159
 
160
  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))
161
 
 
121
  rel_point1 = (int(w * 0), int(h - h * 0.55)) # (0, h - 0.2*h)
122
  rel_point2 = (int(w * 0.265625), int(h - h * 0.55)) # 170 / 640 = 0.265625
123
 
124
+ cv2.rectangle(image, (0,110), (275, 225), (127, 248, 236), -1)
125
+ cv2.rectangle(image, (0, 113), (273, 222), (12, 85, 61), -1)
126
+
127
  cv2.putText(image, str(int(angleHipL)),(rel_point1), cv2.FONT_HERSHEY_SIMPLEX, 1.7, (255, 255, 255), 2, cv2.LINE_AA)
128
 
129
  cv2.putText(image, str(int(angleKneeL)),(rel_point2), cv2.FONT_HERSHEY_SIMPLEX, 1.7, (255, 255, 255), 2, cv2.LINE_AA)
130
 
131
+ cv2.putText(image, 'HipL', (10, 140), cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 255), 2, cv2.LINE_AA)
132
 
133
+ cv2.putText(image, 'KneeL', (180, 140),cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 255), 2, cv2.LINE_AA)
134
+
135
  if angleKneeL > 110 and stage == 'down':
136
  stage = 'up'
137
  if 18 < angleHipL < 40:
 
142
 
143
  # REP data
144
  # Setup Status box
145
+ cv2.rectangle(image, (0,0), (275, 103), (127, 248, 236), -1)
146
+ cv2.rectangle(image, (0, 3), (273, 100), (12, 85, 61), -1)
147
 
148
  cv2.putText(image, 'Left', (10, 22),
149
  cv2.FONT_HERSHEY_SIMPLEX, 0.7, (255, 255, 255), 2, cv2.LINE_AA)
 
158
 
159
  cv2.putText(image, stage,
160
  (170, 70), cv2.FONT_HERSHEY_SIMPLEX, 1.7, (255, 255, 255), 2, cv2.LINE_AA)
 
 
 
 
161
 
162
  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))
163