Code Monkey home page Code Monkey logo

facemaskexample's Introduction

Face Mask example

What is it?

It's android example of Android application with Augmented Reality effects on face.

IMAGE ALT TEXT HERE

Unsigned APK file could be downloaded here: https://drive.google.com/file/d/1pRe2OyKeeM5-DZbs3Xz9TyZ9xORk-JIO/view?usp=sharing . Please add permission to camera.

This application uses VrFace library on Android. This project shows you how easily VrFace library could be used.

How to build?

Fork and clone this project.

Download model file from http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2. Unzip it, like this: bzip2 -d shape_predictor_68_face_landmarks.dat.bz2. As a result you should have file: shape_predictor_68_face_landmarks.dat, rename it to: sp68.dat, and put under the directory app/src/main/assets/. File size is about 70 Mbytes, that's why I don't want to put it under source control.

Note. Loading model sp68.dat is very heavy task, it can take several seconds or dozen seconds to be uploaded. You could try to retrain model and decrease size and therefore size of the application and initialization time.

Create local.properties in project root directory. Add two properties into file:

GITHUB_USER=YOU_GITHUB_USER_NAME
GITHUB_TOKEN=YOUR_GITHUB_TOKEN

put your github username instead of YOU_GITHUB_USER_NAME, to get YOUR_GITHUB_TOKEN open https://github.com/settings/tokens. Generate new token with read:packages permission. To read more about credentials please read here

Build project and install onto your phone. Add permission to Camera manually in your settings.

How it works?

It uses my library VrFace. This library makes all the work, please read description for more details. As it written in the library's description we need to implement only:

  • layout with com.stoleg.vrface.camera.FastCameraView for camera and GLSurfaceView for providing result
  • MainActivity initialize GLSurfaceView, initialize native library, add model for 3d face and model for points on the face
  • ShaderEffectMask implements shaders effects with shaders

You could just fork it or clone it and add your own effects.

Questions?

Just write me. Will glad to hear if it's useful.

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.