def run(self): prevTime = 0 with mp_pose.Pose(min_detection_confidence=0.5, min_tracking_confidence=0.5) as pose: counter = 0 status = True avg_score = 0 self.mutex.lock() while self.mw.cap.isOpened(): ret, frame = self.mw.cap.read() nchannel = frame.shape[2] frame = cv2.resize(frame, (1200, 680), interpolation=cv2.INTER_AREA) frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) frame.flags.writeable = False results = pose.process(frame) frame.flags.writeable = True frame = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR) try: landmarks = results.pose_landmarks.landmark counter, status, avg_score = TypeOfExercise(landmarks).calculate_exercise( self.exercise_type, counter, status, avg_score) except: pass TypeOfExercise(landmarks).score_table(self.exercise_type, counter, status, avg_score, self._isPause) self.scoreSignal.emit(str(avg_score))
时间: 2023-04-07 13:01:20 浏览: 163
noise_estimation.zip_IMCRA_MCRA噪声估计_minimum tracking_minimum和min
5星 · 资源好评率100%
我可以回答这个问题。这是一个 Python 代码段,它使用了 mp_pose 库来检测人体姿势,并计算运动得分。具体来说,它使用了 TypeOfExercise 类来确定运动类型,并计算运动得分。它还使用了一个互斥锁来确保线程安全。
阅读全文