This repository is no longer maintained, due to challenges of upgrading to OpenCV 4.
FaceTracker is a library for deformable face tracking written in C++ using OpenCV 2, authored by Jason Saragih and maintained by Kyle McDonald.
Any publications arising from the use of this software, including but not limited to academic journal and conference publications, technical reports and manuals, should cite the following work: J. M. Saragih, S. Lucey, and J. F. Cohn. Face Alignment through Subspace Constrained Mean-Shifts. International Conference of Computer Vision (ICCV), September, 2009.
Assertion failed: s.is_open()
when running your app, that means you forgot to put the model files in the right directory.Wrappers are available for:
These instructions are for compiling the code on OS X and Ubuntu, but it should be possible to compile on other platforms.
First, install OpenCV3 (if you're using OpenCV2, use the opencv2 branch of this repo). On OSX you can use homebrew:
$ brew tap homebrew/science
$ brew install opencv3
And on Ubuntu use:
$ sudo apt-get install libcv-dev libopencv-dev
Alternatively, you can download OpenCV from the GitHub and compile it manually.
After installing OpenCV, clone this repository with git clone git://github.com/kylemcdonald/FaceTracker.git
. This repository contains a few subdirectories within the root directory:
Next, make sure that your copy of OpenCV is located in /usr/local
(this should be the case if you used apt-get
). If it isn't located there, modify the OPENCV_PATH
in the Makefile
. If you installed with Homebrew, it should be set to /usr/local/opt/opencv3
.
Optionally, you can also add -fopenmp
to the CFLAGS
and -lgomp
to the LIBRARIES
variable to compile with OpenMP support.
From the root FaceTracker
directory, build the library and example by running make
.
To test the demo, cd bin
and ./face_tracker
. Because many webcams are 1280x720, try running ./face_tracker -s .25
to rescale the image before processing for a smoother framerate.
face_tracker
UsageUsage: face_tracker [options]
Options:
-m <string> : Tracker model (default: ../model/face2.tracker)
-c <string> : Connectivity (default: ../model/face.con)
-t <string> : Triangulation (default: ../model/face.tri)
-s <double> : Image scaling (default: 1)
-d <int> : Frames/detections (default: -1)
--check : Check for failure
--help : Print help
-? : Print help