当前位置: 首页>>代码示例>>Python>>正文


Python face_utils.FACIAL_LANDMARKS_IDXS属性代码示例

本文整理汇总了Python中imutils.face_utils.FACIAL_LANDMARKS_IDXS属性的典型用法代码示例。如果您正苦于以下问题:Python face_utils.FACIAL_LANDMARKS_IDXS属性的具体用法?Python face_utils.FACIAL_LANDMARKS_IDXS怎么用?Python face_utils.FACIAL_LANDMARKS_IDXS使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在imutils.face_utils的用法示例。


在下文中一共展示了face_utils.FACIAL_LANDMARKS_IDXS属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from imutils import face_utils [as 别名]
# 或者: from imutils.face_utils import FACIAL_LANDMARKS_IDXS [as 别名]
def __init__(self, path):
        import dlib # lazy loading
        # use dlib 68-point facial landmark
        self._detector = dlib.shape_predictor(path + 'shape_predictor_68_face_landmarks.dat')
        (self._leye_start, self._leye_end) = face_utils.FACIAL_LANDMARKS_IDXS["left_eye"]
        (self._reye_start, self._reye_end) = face_utils.FACIAL_LANDMARKS_IDXS["right_eye"]
        try:
            (self._mouth_start, self._mouth_end) = face_utils.FACIAL_LANDMARKS_IDXS["inner_mouth"]
        except:
            (self._mouth_start, self._mouth_end) = (60, 68) 
开发者ID:richmondu,项目名称:libfaceid,代码行数:12,代码来源:liveness.py

示例2: recognize

# 需要导入模块: from imutils import face_utils [as 别名]
# 或者: from imutils.face_utils import FACIAL_LANDMARKS_IDXS [as 别名]
def recognize():
    database = initialize()
    cap = cv2.VideoCapture(0)
    (lStart, lEnd) = face_utils.FACIAL_LANDMARKS_IDXS["left_eye"]
    (rStart, rEnd) = face_utils.FACIAL_LANDMARKS_IDXS["right_eye"]
    while True:
        ret, img = cap.read()
        img_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
        gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
        subjects = detector(gray, 0)
        for subject in subjects:
            shape = predictor(gray, subject)
            shape = face_utils.shape_to_np(shape)  # converting to NumPy Array
            leftEye = shape[lStart:lEnd]
            rightEye = shape[rStart:rEnd]
            leftEAR = eye_aspect_ratio(leftEye)
            rightEAR = eye_aspect_ratio(rightEye)
            ear = (leftEAR + rightEAR) / 2.0
            leftEyeHull = cv2.convexHull(leftEye)
            rightEyeHull = cv2.convexHull(rightEye)
            cv2.drawContours(img, [leftEyeHull], -1, (0, 255, 0), 1)
            cv2.drawContours(img, [rightEyeHull], -1, (0, 255, 0), 1)
            extract_face_info(img, img_rgb, database,ear)
        cv2.imshow('Recognizing faces', img)
        if cv2.waitKey(1) == ord('q'):
            break

    cap.release()
    cv2.destroyAllWindows() 
开发者ID:akshaybahadur21,项目名称:Facial-Recognition-using-Facenet,代码行数:31,代码来源:rec-feat.py


注:本文中的imutils.face_utils.FACIAL_LANDMARKS_IDXS属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。