更新Demo
parent
7121d24a90
commit
b6f672389e
|
@ -23,20 +23,19 @@ class CameraThread(QThread):
|
||||||
ret, frame = self.cap.read()
|
ret, frame = self.cap.read()
|
||||||
if ret:
|
if ret:
|
||||||
rgb_image = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
|
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
|
face_img = None
|
||||||
max_roi = 0
|
|
||||||
for bbox in bboxs:
|
for bbox in bboxs:
|
||||||
try:
|
try:
|
||||||
x, y, w, h = bbox[1]
|
x, y, w, h, confidence = bbox
|
||||||
if w * h > max_roi:
|
|
||||||
max_roi = w * h
|
|
||||||
face_img = img[y:y + h, x:x + w]
|
face_img = img[y:y + h, x:x + w]
|
||||||
except:
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
self.new_frame.emit(img)
|
self.new_frame.emit(original_img)
|
||||||
if face_img is not None:
|
if face_img is not None:
|
||||||
self.fps_signal.emit(self.fps)
|
self.fps_signal.emit(self.fps)
|
||||||
self.storage_frame.emit(cv2.resize(face_img, (224, 224)))
|
self.storage_frame.emit(cv2.resize(face_img, (224, 224)))
|
||||||
|
|
Loading…
Reference in New Issue