Pratyush101 commited on
Commit
5040ccb
·
verified ·
1 Parent(s): 150480d

Update app.py

Browse files

Removed the knee angle and Hip angle and check if the code is correctly working or not

Files changed (1) hide show
  1. app.py +26 -21
app.py CHANGED
@@ -119,37 +119,42 @@ def video_frame_callback(frame: av.VideoFrame) -> av.VideoFrame:
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
- cv2.putText(image, 'Left', (int(w * 0.02), int(h * 0.05)),
128
- cv2.FONT_HERSHEY_SIMPLEX, 0.7, (255, 255, 255), 2, cv2.LINE_AA)
129
 
130
- cv2.putText(image, str(correct), (int(w * 0.02), int(h * 0.15)),
131
- cv2.FONT_HERSHEY_SIMPLEX, 1.7, (255, 255, 255), 2, cv2.LINE_AA)
 
 
 
132
 
133
  # Stage data for left leg
134
- cv2.putText(image, 'STAGE', (int(w * 0.25), int(h * 0.05)),
135
- cv2.FONT_HERSHEY_SIMPLEX, 0.7, (255, 255, 255), 2, cv2.LINE_AA)
136
 
137
- cv2.putText(image, stage, (int(w * 0.24), int(h * 0.15)),
138
- cv2.FONT_HERSHEY_SIMPLEX, 1.7, (255, 255, 255), 2, cv2.LINE_AA)
 
 
 
 
 
 
 
 
 
139
 
140
- # Hip angle
141
- cv2.putText(image, 'HipL', (int(w * 0.52), int(h * 0.05)),
142
- cv2.FONT_HERSHEY_SIMPLEX, 0.7, (255, 255, 255), 2, cv2.LINE_AA)
143
 
144
- cv2.putText(image, str(int(angleHipL)), (int(w * 0.51), int(h * 0.15)),
145
- cv2.FONT_HERSHEY_SIMPLEX, 1.7, (255, 255, 255), 2, cv2.LINE_AA)
146
 
147
- # Knee angle
148
- cv2.putText(image, 'Knee', (int(w * 0.76), int(h * 0.05)),
149
- cv2.FONT_HERSHEY_SIMPLEX, 0.7, (255, 255, 255), 2, cv2.LINE_AA)
150
 
151
- cv2.putText(image, str(int(angleKneeL)), (int(w * 0.75), int(h * 0.15)),
152
- cv2.FONT_HERSHEY_SIMPLEX, 1.7, (255, 255, 255), 2, cv2.LINE_AA)
153
  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))
154
 
155
  result_queue.put(detections)
 
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)