From 2f31eba1c5954be5cb7a147bd8cb85d251e68f51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B8=A3=E6=B8=A3=E5=92=8C?= <2608761159@qq.com> Date: Thu, 26 Sep 2024 16:44:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8D=95=E5=8F=8C=E6=9D=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Exercise3/pull_up_1.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Exercise3/pull_up_1.py b/Exercise3/pull_up_1.py index 9efb09e..ebf58f0 100644 --- a/Exercise3/pull_up_1.py +++ b/Exercise3/pull_up_1.py @@ -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: