在python中用68点人脸识别,可多脸识别,已测试过

“`
    # load the input image and convert it to grayscale
    _, image = cap.read()
    image = cv2.flip(image,180)
    gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
    # detect faces in the grayscale image
    rects = detector(gray, 0)
    # loop over the face detections
    #rect renlian
    for (i, rect) in enumerate(rects):
        # determine the facial landmarks for the face region, then
        # convert the facial landmark (x, y)-coordinates to a NumPy
        # array
        shape = predictor(gray, rect)
        shape = face_utils.shape_to_np(shape)
        # loop over the (x, y)-coordinates for the facial landmarks
        # and draw them on the image
        for (x, y) in shape:
            cv2.circle(image, (x, y), 2, (0, 255, 0), -1)
    # show the output image with the face detections + facial landmarks
    cv2.imshow(“Output”, image)
“`

By liu

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注