Pratyush101 commited on
Commit
4936a67
·
verified ·
1 Parent(s): b215d73

Update app.py

Browse files

Modified the status box

Files changed (1) hide show
  1. app.py +35 -18
app.py CHANGED
@@ -117,27 +117,44 @@ def video_frame_callback(frame: av.VideoFrame) -> av.VideoFrame:
117
 
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),(500,80),(0,123,255),-1) # Bright blue background
124
-
125
- #REP data
126
- cv2.putText(image,'Left',(10,25),
127
- cv2.FONT_HERSHEY_SIMPLEX,0.8,(255,255,255),2,cv2.LINE_AA) # White text with larger font size
128
-
129
- cv2.putText(image,str(correct),
130
- (10,60),cv2.FONT_HERSHEY_SIMPLEX,2,(255,255,255),2,cv2.LINE_AA) # White text for count
131
- #Stage data for left leg
132
-
133
- cv2.putText(image,'STAGE',(230,12),
134
- cv2.FONT_HERSHEY_SIMPLEX,0.5,(0,0,0),1,cv2.LINE_AA)
135
-
136
- cv2.putText(image,stage,
137
- (230,60),cv2.FONT_HERSHEY_SIMPLEX,1,(255,255,255),1,cv2.LINE_AA)
138
 
139
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
 
 
 
141
  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))
142
 
143
  result_queue.put(detections)
 
117
 
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)