Pratyush101 commited on
Commit
a21e9b6
·
verified ·
1 Parent(s): bea8c63

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -29
app.py CHANGED
@@ -109,40 +109,40 @@ def video_frame_callback(frame: av.VideoFrame) -> av.VideoFrame:
109
  cv2.rectangle(image, (310, 180), (450, 220), (0, 0, 0), -1)
110
  cv2.putText(image,f"Bend Forward",(320,200),cv2.FONT_HERSHEY_SIMPLEX,1,(150,120,255),1,cv2.LINE_AA)
111
 
112
- # 2. Lean Backward Warning
113
- if angleHipL > 45:
114
- cv2.rectangle(image, (310, 180), (450, 220), (0, 0, 0), -1)
115
- cv2.putText(image,f"Bend Backward",(320,200),cv2.FONT_HERSHEY_SIMPLEX,1,(80,120,255),1,cv2.LINE_AA)
116
 
117
- # # stage 2
118
 
119
- # # Incorrect movements
120
 
121
- # 3. Knees not low enough
122
- if 110 < angleKneeL < 130:
123
- cv2.rectangle(image, (220, 40), (450, 80), (0, 0, 0), -1)
124
- cv2.putText(image,f"Lower Your Hips",(230,60),cv2.FONT_HERSHEY_SIMPLEX,1,(255,255,255),1,cv2.LINE_AA)
125
 
126
 
127
- # 3. Knees not low enough and not completed the squat
128
- if angleKneeL>130 and stage=='mid':
129
- cv2.rectangle(image, (220, 40), (450, 80), (0, 0, 0), -1)
130
- cv2.putText(image,f"Lower Your Hips",(230,60),cv2.FONT_HERSHEY_SIMPLEX,1,(255,255,255),1,cv2.LINE_AA)
131
- incorrect+=1
132
- stage='up'
133
-
134
- # 4. Squat too deep
135
- if angleKneeL < 80 and stage=='mid':
136
- cv2.rectangle(image, (220, 40), (450, 80), (0, 0, 0), -1)
137
- cv2.putText(image,f"Squat too deep",(230,60),cv2.FONT_HERSHEY_SIMPLEX,1,(255,255,255),1,cv2.LINE_AA)
138
- incorrect +=1
139
- stage='up'
140
-
141
- # stage 4
142
- if (80 < angleKneeL < 110) and stage=='mid':
143
- if (18 < angleHipL < 40): # Valid "down" position
144
- correct+=1
145
- stage='up'
146
 
147
 
148
 
 
109
  cv2.rectangle(image, (310, 180), (450, 220), (0, 0, 0), -1)
110
  cv2.putText(image,f"Bend Forward",(320,200),cv2.FONT_HERSHEY_SIMPLEX,1,(150,120,255),1,cv2.LINE_AA)
111
 
112
+ # # 2. Lean Backward Warning
113
+ # if angleHipL > 45:
114
+ # cv2.rectangle(image, (310, 180), (450, 220), (0, 0, 0), -1)
115
+ # cv2.putText(image,f"Bend Backward",(320,200),cv2.FONT_HERSHEY_SIMPLEX,1,(80,120,255),1,cv2.LINE_AA)
116
 
117
+ # # # stage 2
118
 
119
+ # # # Incorrect movements
120
 
121
+ # # 3. Knees not low enough
122
+ # if 110 < angleKneeL < 130:
123
+ # cv2.rectangle(image, (220, 40), (450, 80), (0, 0, 0), -1)
124
+ # cv2.putText(image,f"Lower Your Hips",(230,60),cv2.FONT_HERSHEY_SIMPLEX,1,(255,255,255),1,cv2.LINE_AA)
125
 
126
 
127
+ # # 3. Knees not low enough and not completed the squat
128
+ # if angleKneeL>130 and stage=='mid':
129
+ # cv2.rectangle(image, (220, 40), (450, 80), (0, 0, 0), -1)
130
+ # cv2.putText(image,f"Lower Your Hips",(230,60),cv2.FONT_HERSHEY_SIMPLEX,1,(255,255,255),1,cv2.LINE_AA)
131
+ # incorrect+=1
132
+ # stage='up'
133
+
134
+ # # 4. Squat too deep
135
+ # if angleKneeL < 80 and stage=='mid':
136
+ # cv2.rectangle(image, (220, 40), (450, 80), (0, 0, 0), -1)
137
+ # cv2.putText(image,f"Squat too deep",(230,60),cv2.FONT_HERSHEY_SIMPLEX,1,(255,255,255),1,cv2.LINE_AA)
138
+ # incorrect +=1
139
+ # stage='up'
140
+
141
+ # # stage 4
142
+ # if (80 < angleKneeL < 110) and stage=='mid':
143
+ # if (18 < angleHipL < 40): # Valid "down" position
144
+ # correct+=1
145
+ # stage='up'
146
 
147
 
148