Update app.py
Browse files
app.py
CHANGED
@@ -292,46 +292,51 @@ def video_frame_callback(frame: av.VideoFrame) -> av.VideoFrame:
|
|
292 |
# cv2.putText(image, "Squat Too Deep!", (300, 250), cv2.FONT_HERSHEY_SIMPLEX, 2, (0, 0, 255), 3)
|
293 |
# elif angleKneeL > 110:
|
294 |
# cv2.putText(image, "Lower Your Hips!", (300, 300), cv2.FONT_HERSHEY_SIMPLEX, 2, (0, 0, 255), 3)
|
|
|
|
|
295 |
|
296 |
-
# 1. Bend Forward Warning
|
297 |
-
if 10 < angleHipL < 18:
|
298 |
-
|
299 |
-
|
300 |
|
301 |
-
# 2. Lean Backward Warning
|
302 |
-
if angleHipL > 45:
|
303 |
-
|
304 |
-
|
305 |
|
306 |
-
# stage 2
|
307 |
|
308 |
-
# Incorrect movements
|
309 |
|
310 |
-
# 3. Knees not low enough
|
311 |
-
if 110 < angleKneeL < 130:
|
312 |
-
|
313 |
-
|
314 |
|
315 |
|
316 |
-
# 3. Knees not low enough and not completed the squat
|
317 |
-
if angleKneeL>130 and stage=='mid':
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
# 4. Squat too deep
|
324 |
-
if angleKneeL < 80 and stage=='mid':
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
# stage 4
|
331 |
-
if (80 < angleKneeL < 110) and stage=='mid':
|
332 |
-
|
333 |
-
|
334 |
-
|
|
|
|
|
|
|
335 |
# cv2.putText(image,f"Correct:{correct}",
|
336 |
# (400,120),cv2.FONT_HERSHEY_SIMPLEX,1,(0,0,0),1,cv2.LINE_AA)
|
337 |
# cv2.putText(image,f"Incorrect:{incorrect}",
|
|
|
292 |
# cv2.putText(image, "Squat Too Deep!", (300, 250), cv2.FONT_HERSHEY_SIMPLEX, 2, (0, 0, 255), 3)
|
293 |
# elif angleKneeL > 110:
|
294 |
# cv2.putText(image, "Lower Your Hips!", (300, 300), cv2.FONT_HERSHEY_SIMPLEX, 2, (0, 0, 255), 3)
|
295 |
+
|
296 |
+
|
297 |
|
298 |
+
# # 1. Bend Forward Warning
|
299 |
+
# if 10 < angleHipL < 18:
|
300 |
+
# cv2.rectangle(image, (310, 180), (450, 220), (0, 0, 0), -1)
|
301 |
+
# cv2.putText(image,f"Bend Forward",(320,200),cv2.FONT_HERSHEY_SIMPLEX,1,(150,120,255),1,cv2.LINE_AA)
|
302 |
|
303 |
+
# # 2. Lean Backward Warning
|
304 |
+
# if angleHipL > 45:
|
305 |
+
# cv2.rectangle(image, (310, 180), (450, 220), (0, 0, 0), -1)
|
306 |
+
# cv2.putText(image,f"Bend Backward",(320,200),cv2.FONT_HERSHEY_SIMPLEX,1,(80,120,255),1,cv2.LINE_AA)
|
307 |
|
308 |
+
# # stage 2
|
309 |
|
310 |
+
# # Incorrect movements
|
311 |
|
312 |
+
# # 3. Knees not low enough
|
313 |
+
# if 110 < angleKneeL < 130:
|
314 |
+
# cv2.rectangle(image, (220, 40), (450, 80), (0, 0, 0), -1)
|
315 |
+
# cv2.putText(image,f"Lower Your Hips",(230,60),cv2.FONT_HERSHEY_SIMPLEX,1,(255,255,255),1,cv2.LINE_AA)
|
316 |
|
317 |
|
318 |
+
# # 3. Knees not low enough and not completed the squat
|
319 |
+
# if angleKneeL>130 and stage=='mid':
|
320 |
+
# cv2.rectangle(image, (220, 40), (450, 80), (0, 0, 0), -1)
|
321 |
+
# cv2.putText(image,f"Lower Your Hips",(230,60),cv2.FONT_HERSHEY_SIMPLEX,1,(255,255,255),1,cv2.LINE_AA)
|
322 |
+
# incorrect+=1
|
323 |
+
# stage='up'
|
324 |
+
|
325 |
+
# # 4. Squat too deep
|
326 |
+
# if angleKneeL < 80 and stage=='mid':
|
327 |
+
# cv2.rectangle(image, (220, 40), (450, 80), (0, 0, 0), -1)
|
328 |
+
# cv2.putText(image,f"Squat too deep",(230,60),cv2.FONT_HERSHEY_SIMPLEX,1,(255,255,255),1,cv2.LINE_AA)
|
329 |
+
# incorrect +=1
|
330 |
+
# stage='up'
|
331 |
+
|
332 |
+
# # stage 4
|
333 |
+
# if (80 < angleKneeL < 110) and stage=='mid':
|
334 |
+
# if (18 < angleHipL < 40): # Valid "down" position
|
335 |
+
# correct+=1
|
336 |
+
# stage='up'
|
337 |
+
|
338 |
+
|
339 |
+
|
340 |
# cv2.putText(image,f"Correct:{correct}",
|
341 |
# (400,120),cv2.FONT_HERSHEY_SIMPLEX,1,(0,0,0),1,cv2.LINE_AA)
|
342 |
# cv2.putText(image,f"Incorrect:{incorrect}",
|