修改单双杠

This commit is contained in:
渣渣和 2024-09-26 16:44:01 +08:00
parent d4b876bfed
commit 2f31eba1c5
1 changed files with 5 additions and 4 deletions

View File

@ -45,7 +45,7 @@ class PullUp_1(BaseExercise):
self.initial_wrist_2_y = 0
# 引体向上参数
self.corner = (0, 480, 260, 380)
self.corner = (0, 480, 240, 400)
MediapipeAlgorithmPlugin.set_corner(corner=self.corner)
MediapipeAlgorithmPlugin.set_config(config=self.config)
@ -81,6 +81,7 @@ class PullUp_1(BaseExercise):
def display(self, img):
cv2.rectangle(img, (self.corner[2], self.corner[0]), (self.corner[3], self.corner[1]), (0, 255, 0), 2)
cv2.rectangle(img, (self.corner[2], 170), (self.corner[3], 470), (0, 255, 0), 2)
# 绘制状态条
cv2.rectangle(img, (650 - 100, 60), (650 - 80, 282), (255, 255, 255), 2)
self.detector.drawPoint_more(img, [9, 11, 13, 19, 25], bias_x=self.corner[2], bias_y=self.corner[0])
@ -141,7 +142,7 @@ class PullUp_1(BaseExercise):
self.bar = np.interp(h_range, (90, 0), (280, 62))
if self.pre_pos == 0:
self.pre_pos = 1
self.speak_driver.add_speak("请进入准备状态")
self.speak_driver.add_speak("上杠,听到提示声后开始考试")
if self.form == 0:
if time.time() - self.sta_time > 1.5:
@ -149,7 +150,7 @@ class PullUp_1(BaseExercise):
self.time_1 += 1
if self.time_1 > 30:
self.form = 1
self.speak_driver.add_speak("请开始考试")
beep()
self.starttime = time.time()
self.initial_wrist_1_y = wrist_1_y
self.initial_wrist_2_y = wrist_2_y
@ -191,7 +192,7 @@ class PullUp_1(BaseExercise):
self._time = 0
self.body_state = 0
if mouth_1_y < hand_1_y or mouth_2_y < hand_2_y and not self.had_done:
if head_1_y < hand_1_y or head_2_y < hand_2_y and not self.had_done:
self.feedback = "下落"
if self.state == 0:
if self.direction == 1: