Giter Club home page Giter Club logo

average_portrait's Introduction

Average Portrait

Uses openCV and dlib to automatically align portraits in python, average the portraits using processing & p5.js [ p5 Demo ]

portrait animation

Portrait Average

portrait average

Portrait Swap

portrait swap

Portrait Detection

portrait detection

How to Use

  • Download landmarks
  • Unzip it and move to landmarks folder
  • Face Align python face_align.py image_folder image_format reference_image_path
  • Face Detection python face_detection.py image_folder
  • Face Swap python face_swap.py original_portrait.jpg new_portrait.jpg
  • Generating Image Metadata CSV exiftool -csv -FileSize -ImageWidth -ImageHeight image_folder/*.jpg > metadata.csv

Examples

Face Align

python face_align.py portraits/ jpg portraits/01a4462309f79052d1a480170ef3d7ca7bcbd564.jpg

Generate Image Metadata CSV

// change directory
cd processing/average_portraits/data/
// scan images and generate metadata csv
exiftool -csv -FileSize -ImageWidth -ImageHeight ../../../result_align/*.jpg  > metadata.csv

Face Detection

python face_detection.py portraits/

Face Swap

python face_swap.py portraits/01a4462309f79052d1a480170ef3d7ca7bcbd564.jpg portraits/838ba61ea8d3fd1ff15d9549314e251f95ca5f68.jpg

References

Install OpenCV and Dlib

Install pip

sudo easy_install pip

Install cmake

// download binary
https://cmake.org/download/
// install command line tool from application menu
Tools->How To Install For Command Line Use

Install homebrew

ruby -e "$(curl -fsSL [https://raw.githubusercontent.com/Homebrew/install/master/install](https://raw.githubusercontent.com/Homebrew/install/master/install))"

Install boost

brew install boost --with-python

Install boost-python

brew install boost-python

Install numpy

sudo pip install numpy

Install dlib

sudo pip install dlib

Install openCV Reference

brew tap homebrew/science
// opencv installation will be located at: /usr/local/Cellar/opencv/2.4.10/
brew install opencv
cat ~/.bash_profile | grep PYTHONPATH
ln -s /usr/local/Cellar/opencv/2.4.12/lib/python2.7/site-packages/cv.py cv.py
ln -s /usr/local/Cellar/opencv/2.4.12/lib/python2.7/site-packages/cv2.so cv2.so

Install skimage [ OPTIONAL ]

sudo pip install -U scikit-image

Install ExifTool

// download command line tool
http://www.sno.phy.queensu.ca/~phil/exiftool/

average_portrait's People

Contributors

xyfeng avatar

Watchers

 avatar  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.