Coder Social home page Coder Social logo

simple_faceswap's Introduction

simple_faceswap

使用opencv-python和dlib实现的简单换脸程序

准备

实现步骤

  1. 使用dlib的shape_predictor_68_face_landmarks.dat模型获取人脸图片im1和摄像头图片im2的68个人脸特征点。
  2. 根据上一步获得的特征点得到两张图片的人脸掩模im1_mask和im2_mask。
  3. 利用68个特征点中的3个特征点,对人脸图片im1进行仿射变换使其脸部对准摄像头图片中的脸部,得到图片affine_im1。
  4. 对人脸图片的掩模im1_mask也进行相同的仿射变换得到affine_im1_mask。
  5. 对掩模im2_mask和掩模affine_im1_mask的掩盖部分取并集得到union_mask。
  6. 利用opencv里的seamlessClone函数对仿射变换后的affine_im1和摄像头图片im2进行泊松融合,掩模为union_mask,得到融合后的图像seamless_im。

换脸效果

  • 周杰伦的帅气照:

JayChou.png

  • 利用杰伦的脸作为替换的脸的换脸效果:

seamless_im.png

simple_faceswap's People

Contributors

jacen789 avatar

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.