本文共 791 字,大约阅读时间需要 2 分钟。
1.检测脸部
def read_im_and_landmarks(fname): if not osp.exists(fname): raise Exception('Cannot find image file: {}'.format(fname)) im = cv2.imread(fname, cv2.IMREAD_COLOR) im = cv2.resize(im, (im.shape[1] * SCALE_FACTOR, im.shape[0] * SCALE_FACTOR)) s = get_landmarks(im) return im, s
def calibrate(frame): frame_new = numpy.clip(frame,0,255) frame_new = numpy.uint8(frame_new) frame_new = cv2.cvtColor(frame_new,cv2.COLOR_BGR2RGB) dets = predictor_calibrate(frame_new, 1) num_faces = len(dets) if num_faces == 0: print("Sorry, there were no faces found in current frame") return None faces = dlib.full_object_detections() for detection in dets: faces.append(sp(frame_new, detection)) i
转载地址:http://qgyqz.baihongyu.com/