From b6f672389e374a99b0d141f4cefdc37162854e55 Mon Sep 17 00:00:00 2001 From: PEAandDA <1641300388@qq.com> Date: Mon, 22 Jul 2024 20:12:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0Demo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- demo/core/camera_thread.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/demo/core/camera_thread.py b/demo/core/camera_thread.py index cc93320..cf3c407 100644 --- a/demo/core/camera_thread.py +++ b/demo/core/camera_thread.py @@ -23,20 +23,19 @@ class CameraThread(QThread): ret, frame = self.cap.read() if ret: rgb_image = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) - img, bboxs = self.face_detector.find_faces(rgb_image) + original_img, img, bboxs = self.face_detector.find_faces(rgb_image) face_img = None - max_roi = 0 + for bbox in bboxs: try: - x, y, w, h = bbox[1] - if w * h > max_roi: - max_roi = w * h - face_img = img[y:y + h, x:x + w] - except: + x, y, w, h, confidence = bbox + face_img = img[y:y + h, x:x + w] + except Exception as e: + print(e) pass - self.new_frame.emit(img) + self.new_frame.emit(original_img) if face_img is not None: self.fps_signal.emit(self.fps) self.storage_frame.emit(cv2.resize(face_img, (224, 224)))