首先从中这里下载下代码:

https://github.com/ageitgey/face_recognition#face-recognition

然后安装所以必须的组件,我用的Python3.5

进入example里面跑他的demo,主要就是掉了dlib的接口比如:

    face_locations = face_recognition.face_locations(rgb_frame)
face_encodings = face_recognition.face_encodings(rgb_frame, face_locations)
face_landmarks_list = face_recognition.face_landmarks(rgb_frame)

引入了OpenCV稍微改了下显示,camera实时跟踪人脸的特征点,速度奇慢,而且还不准。

代码很简单:

import face_recognition
import cv2 # This is a super simple (but slow) example of running face recognition on live video from your webcam.
# There's a second example that's a little more complicated but runs faster. # PLEASE NOTE: This example requires OpenCV (the `cv2` library) to be installed only to read from your webcam.
# OpenCV is *not* required to use the face_recognition library. It's only required if you want to run this
# specific demo. If you have trouble installing it, try any of the other demos that don't require it instead. # Get a reference to webcam # (the default one)
video_capture = cv2.VideoCapture() # Load a sample picture and learn how to recognize it.
obama_image = face_recognition.load_image_file("obama.jpg")
obama_face_encoding = face_recognition.face_encodings(obama_image)[] # Load a second sample picture and learn how to recognize it.
biden_image = face_recognition.load_image_file("biden.jpg")
biden_face_encoding = face_recognition.face_encodings(biden_image)[] # Create arrays of known face encodings and their names
known_face_encodings = [
obama_face_encoding,
biden_face_encoding
]
known_face_names = [
"Barack Obama",
"Joe Biden"
] while True:
# Grab a single frame of video
ret, frame = video_capture.read() # Convert the image from BGR color (which OpenCV uses) to RGB color (which face_recognition uses)
rgb_frame = frame[:, :, ::-] # Find all the faces and face enqcodings in the frame of video
# face_locations = face_recognition.face_locations(rgb_frame)
# face_encodings = face_recognition.face_encodings(rgb_frame, face_locations)
face_landmarks_list = face_recognition.face_landmarks(rgb_frame) # Loop through each face in this frame of video
# for (top, right, bottom, left), face_encoding in zip(face_locations, face_encodings):
# # See if the face is a match for the known face(s)
# matches = face_recognition.compare_faces(known_face_encodings, face_encoding)
#
# name = "Unknown" # If a match was found in known_face_encodings, just use the first one.
# if True in matches:
# first_match_index = matches.index(True)
# name = known_face_names[first_match_index] # # Draw a box around the face
# cv2.rectangle(frame, (left, top), (right, bottom), (, , ), )
#
# # Draw a label with a name below the face
# cv2.rectangle(frame, (left, bottom - ), (right, bottom), (, , ), cv2.FILLED)
# font = cv2.FONT_HERSHEY_DUPLEX
# cv2.putText(frame, name, (left + , bottom - ), font, 1.0, (, , ), ) for face_landmarks in face_landmarks_list: # Print the location of each facial feature in this image
facial_features = [
'chin',
'left_eyebrow',
'right_eyebrow',
'nose_bridge',
'nose_tip',
'left_eye',
'right_eye',
'top_lip',
'bottom_lip'
] for facial_feature in facial_features:
for point in face_landmarks[facial_feature]:
cv2.circle(frame, point, , (, , )) # Display the resulting image
cv2.imshow('Video', frame) # Hit 'q' on the keyboard to quit!
if cv2.waitKey() & 0xFF == ord('q'):
break # Release handle to the webcam
video_capture.release()
cv2.destroyAllWindows()

dlib实现人脸landmark点检测以及一些其他的应用的更多相关文章

  1. Python 3 利用 Dlib 实现人脸检测和剪切

    0. 引言 利用 Python 开发,借助 Dlib 库进行人脸检测 / face detection 和剪切:   1. crop_faces_show.py : 将检测到的人脸剪切下来,依次排序平 ...

  2. 基于CNN的人脸相似度检测

    人脸相似度检测主要是检测两张图片中人脸的相似度,从而判断这两张图片的对象是不是一个人. 在上一篇文章中,使用CNN提取人脸特征,然后利用提取的特征进行分类.而在人脸相似度检测的工作中,我们也可以利用卷 ...

  3. OpenCV4.1.0实践(2) - Dlib+OpenCV人脸特征检测

    待更! 参考: python dlib opencv 人脸68点特征检测

  4. dlib python 人脸检测与关键点标记

    http://blog.csdn.net/sunmc1204953974/article/details/49976045 人脸检测 #coding=utf-8 # -*- coding: utf-8 ...

  5. 人脸检测学习笔记(数据集-DLIB人脸检测原理-DLIB&OpenCV人脸检测方法及对比)

    1.Easily Create High Quality Object Detectors with Deep Learning 2016/10/11 http://blog.dlib.net/201 ...

  6. 使用dlib基于CNN(卷积神经网络)的人脸检测器来检测人脸

    基于机器学习CNN方法来检测人脸比之前介绍的效率要慢很多 需要先下载一个训练好的模型数据: 地址点击下载 // dlib_cnn_facedetect.cpp: 定义控制台应用程序的入口点. // # ...

  7. face landmark 人脸特征点检测

    1.ASM&AAM算法 ASM(Active Shape Model)算法介绍:http://blog.csdn.net/carson2005/article/details/8194317 ...

  8. 写个神经网络,让她认得我`(๑•ᴗ•๑)(Tensorflow,opencv,dlib,cnn,人脸识别)

    训练一个神经网络 能让她认得我 阅读原文 这段时间正在学习tensorflow的卷积神经网络部分,为了对卷积神经网络能够有一个更深的了解,自己动手实现一个例程是比较好的方式,所以就选了一个这样比较有点 ...

  9. Python 3 利用 Dlib 实现人脸 68个 特征点的标定

    0. 引言 利用 Dlib 官方训练好的模型 “shape_predictor_68_face_landmarks.dat” 进行 68 个点标定: 利用 OpenCv 进行图像化处理,在人脸上画出 ...

随机推荐

  1. Java NIO.2 —— 文件或目录删除操作

    文件删除 删除单个文件的操作很简单,如果要删除一个目录树的话,需要实现FileVisitor 接口然后递归地调用delete() 或deleteIfExists()方法.在看代码之前,需要注意一下问题 ...

  2. mysql 大数据提取

    今天要重五百多万的一个数据库表 提取 大约五十万条数据,刚开始的解决思路是: 先把数据查询出来,然后再导出来,然后再设计一个数据库表格,把这些数据导入,最后导出数据和导入数据花费了很多时间,最后向同事 ...

  3. 基础004_V7-DSP Slice

    主要参考ug479.pdf.之前的文章:FIR调用DSP48E_05.本文主要记录基本用法. 一.DSP48核 A-参数说明 instrctions,多个功能,通过sel选用 目前没发现C勾选与否,有 ...

  4. Axure chrome 扩展显示已损坏的解决方法

    下载地址 链接:https://pan.baidu.com/s/11K3t_mvgJg51siO_jNRejg 提取码:goz1 如果链接失效,请留言或站内信提醒我更新 疑问 之前用的好好的Axure ...

  5. Spring Security教程(七):RememberMe功能

    在之前的教程中一笔带过式的讲了下RememberMe记住密码的功能,那篇的Remember功能是最简易的配置,其功能和安全性都不强.这里就配置下security中RememberMe的各种方式. 一. ...

  6. NSString和NSMutablestring,copy和strong(转载)

    1.http://www.cocoachina.com/ios/20150512/11805.html 2.http://blog.csdn.net/winzlee/article/details/5 ...

  7. c++中浮点数精度设置

    1.包含头文件<iomanip>,附注manip是manipulator,操控的简写. 2.第一种写法: cout<<setiosflags(ios::); 第二种写法: co ...

  8. struts2(三) 输入校验和拦截器

    前面知道了struts2的架构图和struts2的自动封装表单参数和数据类型自动转换,今天来学struts2的第三第四个东西,输入校验和拦截器, --WH 一.输入校验 在以前我们写一个登录页面时,并 ...

  9. 【Unity】2.6 游戏视图(Game)

    分类:Unity.C#.VS2015 创建日期:2016-03-29 一.简介 游戏视图 (Game View) 从游戏的相机 ((Camera(s)) 中呈现,代表所发布游戏的最终版.你将需要一台或 ...

  10. Codeforces Round #Pi (Div. 2)(A,B,C,D)

    A题: 题目地址:Lineland Mail #include <stdio.h> #include <math.h> #include <string.h> #i ...