def pull_up(self, counter, status, avg_score): nose = detection_body_part(self.landmarks, "NOSE") left_elbow = detection_body_part(self.landmarks, "LEFT_ELBOW") right_elbow = detection_body_part(self.landmarks, "RIGHT_ELBOW") avg_shoulder_y = (left_elbow[1] + right_elbow[1]) / 2 standard = [30, 45] standard_sum = 2 * sum(standard) if status: if nose[1] > avg_shoulder_y: counter += 1 status = False left_arm_score = (1 - abs((self.angle_of_the_left_arm() - standard[0]) / standard_sum)) * 100 right_arm_score = (1 - abs((self.angle_of_the_right_arm() - standard[0]) / standard_sum)) * 100 left_shoulder_score = (1 - abs((self.angle_of_the_left_shoulder() - standard[1]) / standard_sum)) * 100 right_shoulder_score = (1 - abs((self.angle_of_the_right_shoulder() - standard[1]) / standard_sum)) * 100 avg_score = (left_arm_score + right_arm_score + left_shoulder_score + right_shoulder_score) / 4 else: if nose[1] < avg_shoulder_y: status = True avg_score = 0 return
时间: 2023-04-03 22:00:35 浏览: 128
faceRecogniton.rar_face nose detection_face边缘自驾_marker detection
这是一个 Python 代码段,它定义了一个名为 "pull_up" 的函数,该函数接受三个参数:计数器、状态和平均分数。函数的主要目的是检测人体姿势,特别是手臂和肩膀的角度,以确定是否正在进行引体向上运动。如果正在进行引体向上运动,则函数将计算左臂、右臂、左肩和右肩的得分,并返回这些得分的平均值。如果没有进行引体向上运动,则函数将重置状态和平均分数,并返回 。
阅读全文