GithubHelp home page GithubHelp logo

face-alignment's Introduction

68 Facial Landmarks Shape Predictor(Easy Use)

This repo aims at shortening your developing time in face detection and alignment.

I use dlib to perform face detection and landmarks regression, and you can refer to https://github.com/codeniko/shape_predictor_81_face_landmarks for 81 face landmarks detection.

Prepare Dlib model(official release)

Please download the pre-trained model from shape_predictor_68_face_landmarks.dat and extract it to dlibmodels directory.

Requirements

opencv-python>=3.2.0
dlib>=19.14.0
numpy

Usage

In this work, a easy-use face detector is build. refer to dlibpp.py. To detect from a image, just run:

fd = dlibpp.DLIBPP()
box, landmarks = fd.detect_faces(img)

Example code

from dlibpp import DLIBPP
import cv2
import mask

fd = DLBPP()
img = cv2.imread('example.png')
box, landmarks = fd.detect_faces(img)
linemask = np.zeros_like(img).astype(np.uint8)

for landmarks_i in landmarks:
    for (x,y) in landmarks_i:
        img = cv2.circle(img, (x, y), 1, (0,255,0), 1)
	linemask = mask.generate_line_mask(linemask, landmarks_i)
example = np.hstack([img, linemask])
cv2.imshow('example', example)
cv2.waitKey(0)
cv2.destroyAllWindows()

Examples

1-1

7-1

5-withlandmarks

6-results

9-withlandmarks

9-linemask

Acknowledgement

  • Thanks for open source code from Dlib
  • Thanks for codeniko for his fantastic 81 landmarks alignment work.

Thanks for your interest in this repo. If you work or research benefit from this repo, please cite it , start it and popularize it ๐Ÿ˜ƒ

face-alignment's People

Contributors

junleen avatar

Stargazers

 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.