Pratyush101 commited on
Commit
870200a
·
verified ·
1 Parent(s): e271f8c

Update app.py

Browse files

Make the angle relative to change in height or width

Files changed (1) hide show
  1. app.py +24 -24
app.py CHANGED
@@ -118,43 +118,43 @@ def video_frame_callback(frame: av.VideoFrame) -> av.VideoFrame:
118
  if 80 < angleKneeL < 110 and stage == 'up':
119
  stage = 'down'
120
 
121
- # # Render Counter to our camera screen
122
- # # # Setup Status box
123
- # # cv2.rectangle(image, (0,0), (720, 80),(127, 248, 236), -1)
124
- # # cv2.rectangle(image, (0, 3), (715, 77), (12, 85, 61), -1)
125
 
126
- # # REP data
127
 
128
- # cv2.putText(image, 'Left', (10, 22),
129
- # cv2.FONT_HERSHEY_SIMPLEX, 0.7, (255, 255, 255), 2, cv2.LINE_AA)
130
 
131
- # cv2.putText(image, str(correct),
132
- # (10, 70), cv2.FONT_HERSHEY_SIMPLEX, 1.7, (255, 255, 255), 2, cv2.LINE_AA)
133
 
134
- # # Stage data for left leg
135
 
136
- # cv2.putText(image, 'STAGE', (180, 22),
137
- # cv2.FONT_HERSHEY_SIMPLEX, 0.7, (255, 255, 255), 2, cv2.LINE_AA)
138
 
139
- # cv2.putText(image, stage,
140
- # (170, 70), cv2.FONT_HERSHEY_SIMPLEX, 1.7, (255, 255, 255), 2, cv2.LINE_AA)
141
 
142
- # # Hip angle
143
 
144
 
145
- # cv2.putText(image, 'HipL', (350, 22),
146
- # cv2.FONT_HERSHEY_SIMPLEX, 0.7, (255, 255, 255), 2, cv2.LINE_AA)
147
 
148
- # cv2.putText(image, str(int(angleHipL)),
149
- # (340, 70), cv2.FONT_HERSHEY_SIMPLEX, 1.7, (255, 255, 255), 2, cv2.LINE_AA)
150
 
151
- # # Knee angle
152
 
153
- # cv2.putText(image, 'Knee', (545, 22),
154
- # cv2.FONT_HERSHEY_SIMPLEX, 0.7, (255, 255, 255), 2, cv2.LINE_AA)
155
 
156
- # cv2.putText(image, str(int(angleKneeL)),
157
- # (535, 70), cv2.FONT_HERSHEY_SIMPLEX, 1.7, (255, 255, 255), 2, cv2.LINE_AA)
158
  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))
159
 
160
  result_queue.put(detections)
 
118
  if 80 < angleKneeL < 110 and stage == 'up':
119
  stage = 'down'
120
 
121
+ # Render Counter to our camera screen
122
+ # # Setup Status box
123
+ # cv2.rectangle(image, (0,0), (w, 80),(127, 248, 236), -1)
124
+ # cv2.rectangle(image, (0, 3), (w-5, 77), (12, 85, 61), -1)
125
 
126
+ # REP data
127
 
128
+ cv2.putText(image, 'Left', (10, 22),
129
+ cv2.FONT_HERSHEY_SIMPLEX, 0.7, (255, 255, 255), 2, cv2.LINE_AA)
130
 
131
+ cv2.putText(image, str(correct),
132
+ (10, 70), cv2.FONT_HERSHEY_SIMPLEX, 1.7, (255, 255, 255), 2, cv2.LINE_AA)
133
 
134
+ # Stage data for left leg
135
 
136
+ cv2.putText(image, 'STAGE', (180, 22),
137
+ cv2.FONT_HERSHEY_SIMPLEX, 0.7, (255, 255, 255), 2, cv2.LINE_AA)
138
 
139
+ cv2.putText(image, stage,
140
+ (170, 70), cv2.FONT_HERSHEY_SIMPLEX, 1.7, (255, 255, 255), 2, cv2.LINE_AA)
141
 
142
+ # Hip angle
143
 
144
 
145
+ cv2.putText(image, 'HipL', (w-370, 22),
146
+ cv2.FONT_HERSHEY_SIMPLEX, 0.7, (255, 255, 255), 2, cv2.LINE_AA)
147
 
148
+ cv2.putText(image, str(int(angleHipL)),
149
+ (w-380, 70), cv2.FONT_HERSHEY_SIMPLEX, 1.7, (255, 255, 255), 2, cv2.LINE_AA)
150
 
151
+ # Knee angle
152
 
153
+ cv2.putText(image, 'Knee', (w-175, 22),
154
+ cv2.FONT_HERSHEY_SIMPLEX, 0.7, (255, 255, 255), 2, cv2.LINE_AA)
155
 
156
+ cv2.putText(image, str(int(angleKneeL)),
157
+ (w-185, 70), cv2.FONT_HERSHEY_SIMPLEX, 1.7, (255, 255, 255), 2, cv2.LINE_AA)
158
  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))
159
 
160
  result_queue.put(detections)