import cv2 import dlib import face_recognition import face_recognition_models from PIL import Image from PyQt5.QtWidgets import * from PyQt5.QtGui import QIcon, QFont, QPixmap from PyQt5.QtCore import QCoreApplication from PyQt5 import QtWidgets from py._builtin import execfile import numpy as np import alskyo_test import face_alignment_dlib from person_db import Face, Person, PersonDB pdb = PersonDB() def replace_foreach(idx, file, _fc): img = np.array(Image.open(file)) img = cv2.cvtColor(img, cv2.COLOR_RGB2BGR) # img_RGB.clear() # Image.open(file).show() temp_str = file.split(sep="\\") temp_str2 = temp_str[-1].split(sep=".") faces = _fc.detect_faces(img, temp_str2[0]) print(file, faces) return idx, faces
print("source", args.inputfile) print("original: %dx%d, %f frame/sec" % (src.get(3), src.get(4), frame_rate)) ratio = float(args.resize_ratio) if ratio != 1.0: s = "RESIZE_RATIO: " + args.resize_ratio s += " -> %dx%d" % (int(src.get(3) * ratio), int(src.get(4) * ratio)) print(s) print("process every %d frame" % frames_between_capture) print("similarity shreshold:", args.threshold) if args.stop > 0: print("Detecting will be stopped after %d second." % args.stop) # load person DB result_dir = "result" pdb = PersonDB() pdb.load_db(result_dir) pdb.print_persons() # prepare capture directory num_capture = 0 if args.capture: print("Captured frames are saved in '%s' directory." % args.capture) if not os.path.isdir(args.capture): os.mkdir(args.capture) # set SIGINT (^C) handler def signal_handler(sig, frame): global running running = False
print("original: %dx%d, %f frame/sec" % (src.get(3), src.get(4), frame_rate)) ratio = float(args.resize_ratio) if ratio != 1.0: s = "RESIZE_RATIO: " + args.resize_ratio s += " -> %dx%d" % (int(src.get(3) * ratio), int(src.get(4) * ratio)) print(s) print("process every %d frame" % frames_between_capture) print("similarity threshold:", args.threshold) if args.stop > 0: print("Detecting will be stopped after %d second." % args.stop) # load person DB result_dir = "result" pdb = PersonDB() pdb.load_db(result_dir) total_start_time = time.localtime() # prepare capture directory num_capture = 0 ''' if args.capture: print("Captured frames are saved in '%s' directory." % args.capture) if not os.path.isdir(args.capture): os.mkdir(args.capture) ''' # set SIGINT (^C) handler def signal_handler(sig, frame):