资源简介
使用python dlib+openCV实现人脸融合,通用语python2和python3
代码片段和文件信息
#!/usr/bin/python3
# Copyright (c) 2015 Matthew Earl
#
# Permission is hereby granted free of charge to any person obtaining a copy
# of this software and associated documentation files (the “Software“) to deal
# in the Software without restriction including without limitation the rights
# to use copy modify merge publish distribute sublicense and/or sell
# copies of the Software and to permit persons to whom the Software is
# furnished to do so subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED “AS IS“ WITHOUT WARRANTY OF ANY KIND EXPRESS
# OR IMPLIED INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM
# DAMAGES OR OTHER LIABILITY WHETHER IN AN ACTION OF CONTRACT TORT OR
# OTHERWISE ARISING FROM OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
# USE OR OTHER DEALINGS IN THE SOFTWARE.
“““
This is the code behind the Switching Eds blog post:
http://matthewearl.github.io/2015/07/28/switching-eds-with-python/
See the above for an explanation of the code below.
To run the script you‘ll need to install dlib (http://dlib.net) including its
Python bindings and OpenCV. You‘ll also need to obtain the trained model from
sourceforge:
http://sourceforge.net/projects/dclib/files/dlib/v18.10/shape_predictor_68_face_landmarks.dat.bz2
Unzip with ‘bunzip2‘ and change ‘PREDICTOR_PATH‘ to refer to this file. The
script is run like so:
./faceswap.py
If successful a file ‘output.jpg‘ will be produced with the facial features
from ‘‘ replaced with the facial features from ‘‘.
“““
import cv2
import dlib
import numpy
import sys
PREDICTOR_PATH = “/home/work/python/ttt/shape_predictor_68_face_landmarks.dat“
SCALE_FACTOR = 1
FEATHER_AMOUNT = 11
FACE_POINTS = list(range(17 68))
MOUTH_POINTS = list(range(48 61))
RIGHT_BROW_POINTS = list(range(17 22))
LEFT_BROW_POINTS = list(range(22 27))
RIGHT_EYE_POINTS = list(range(36 42))
LEFT_EYE_POINTS = list(range(42 48))
NOSE_POINTS = list(range(27 35))
JAW_POINTS = list(range(0 17))
# Points used to line up the images.
ALIGN_POINTS = (LEFT_BROW_POINTS + RIGHT_EYE_POINTS + LEFT_EYE_POINTS +
RIGHT_BROW_POINTS + NOSE_POINTS + MOUTH_POINTS)
# Points from the second image to overlay on the first. The convex hull of each
# element will be overlaid.
OVERLAY_POINTS = [
LEFT_EYE_POINTS + RIGHT_EYE_POINTS + LEFT_BROW_POINTS + RIGHT_BROW_POINTS
NOSE_POINTS + MOUTH_POINTS
]
# Amount of blur to use during colour correction as a fraction of the
# pupillary distance.
COLOUR_CORRECT_BLUR_FRAC = 0.6
detector = dlib.get_frontal_
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 7617 2018-09-11 14:47 face.py
文件 135 2018-09-11 14:52 readme.txt
....... 99693937 2018-01-28 21:15 shape_predictor_68_face_landmarks.dat
----------- --------- ---------- ----- ----
99701689 3
相关资源
- python3.5 百度ai人脸识别
- python基于人脸检测和人脸识别
- Python-一系列高品质的动漫人脸数据集
- Python-Insightface人脸检测识别的最小化
- Python-pytorch实现的人脸检测和人脸识别
- dlib-19.18.0-cp37-cp37m-linux_armv7l.whl
- 人脸识别算法,双2D2DPCALBP余弦相似度
- MATLAB版本的2Dpca和欧式距离算法
- Python-PCA降维人脸识别,已包含yale数据
- 人脸识别算法 python
- dlib18.17 编译好的python-dlib库 不需要
- python人脸识别截取
- 性别模型库 simple_CNN.81-0.96.hdf5
- 人脸识别图片集(刘德华吴彦祖)
- 利用python和opencv进行人脸识别
- 人脸识别-python-特征脸-PCA
- opencv3+python人脸检测和识别- 完整实战
- 人脸识别python代码187268
- opencv3+python人脸检测和识别- 完整实战
- opencv3+python人脸检测和识别 完整项目
- opencv3视频中检测人脸python
- dlib-19.17.0-py3.7-win-amd64.egg.zip免去复杂
- 人脸检测并打马赛克源码
- Python-STGAN用于图像合成的空间变换生
- 西电数据挖掘作业——VSM人脸识别算
- 基于Tensorflow的人脸识别源码
-
树莓派人脸识别python代码及xm
l模型 - python + opencv 人脸识别代码(可以跨平
- python人脸识别
- 3DMM人脸模型匹配
评论
共有 条评论