GithubHelp home page GithubHelp logo

changeface's Introduction

ChangeFace

简单的机器学习,有趣的Python换脸术

此文章是转载的,我可没有实力做出这个

原文地址:https://www.w3cschool.cn/python3/python3-egnr2z81.html

首先需要的模块,用pip下载

python-opencv模块;dlib模块;numpy模块。

pip install python-opencv
pip install dlib
pip install numpy

在这里插入图片描述

原理简介

主要流程:

(1)利用dlib库检测并获取人脸特征点;

(2)通过一些简单的处理使得第二张人脸的眼睛、鼻子和嘴巴较好地“装”到第一张人脸上。

一些细节:

特征检测器:

用的dlib官方提供的预训练好的模型。

第二张图片的人脸特征需要对齐到第一张图片的人脸特征,其实现参考了:

https://en.wikipedia.org/wiki/Procrustes_analysis#Ordinary_Procrustes_analysis

具体实现方式详见相关文件中的源代码。

使用演示

修改SwapFace.py文件的图片路径为自己需要操作的图片路径:

(1)特朗普+奥巴马

imgimgimg

(2)普及+安倍

imgimgimg

(3)乔布斯+比尔盖茨

imgimgimg

(4)莱布尼兹+牛顿

imgimgimg

(5)爱因斯坦+薛定谔

imgimgimg

That's All.

联系我?

博客:https://blog.csdn.net/cool99781

邮箱:[email protected]

changeface's People

Contributors

lucifer-ww avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

dalige88

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.