GithubHelp home page GithubHelp logo

linecode / face-landmark-android Goto Github PK

View Code? Open in Web Editor NEW

This project forked from simoncherrygz/face-landmark-android

0.0 1.0 0.0 16.06 MB

Android AR Camera

License: Apache License 2.0

Makefile 40.99% Java 44.40% C++ 10.33% GLSL 4.28%

face-landmark-android's Introduction

AR相机

根据人脸图片构建简单的3D人脸模型,然后在摄像头预览画面中展示。基于该人脸模型进行换脸或者添加装饰品。

基于

应用截图

GIF演示

image image

显示人脸3D模型

image image image

显示装饰品

image image image image

测试页面

image image

原理

  • 根据人脸图片构建3D人脸模型

    使用Dlib可以检测出人脸的68个关键点:

    image

    根据这68个点可以连线得到一个低面数的人脸模型:

    image

    我使用Blender 建立了该模型,这里称其为BaseModel,格式为obj。

  • 动态修改BaseModel

    查询obj文件结构可知,以“v”开头的行描述的是模型的顶点,以“vt”开头的行描述的是模型的贴图坐标点。

    那么只要找到这些点与人类关键点的对应关系,就可以简单地通过替换对应行的数据,来达到动态修改模型的目的。

不足

  • Dlib库依赖shape_predictor_68_face_landmarks.dat,其大小约100M,加载需要花费数秒。

  • Dlib库检测人脸的速度与图像的大小成反比,因此需要对摄像头的预览画面进行截取。

    截取得太小的话也检测不出人脸。在大小不影响检测的情况下,检测速度依然不理想。

  • 由于是从单张图片构建3D人脸,无法获取Z轴的数值,所以在估算三维姿态时用的是模拟数据,得出的数值可能不准确。

构建

  1. 按照dlib-android 描述的步骤来构建Dlib-Android库。
  2. dlib-android-app 中找到shape_predictor_68_face_landmarks.dat,将其复制到手机根目录中。

依赖库

Written with StackEdit.

face-landmark-android's People

Contributors

simoncherrygz avatar

Watchers

 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.