https://github.com/kylemcdonald/FaceTracker
Real time deformable face tracking in C++ with OpenCV 3.
https://github.com/kylemcdonald/FaceTracker
computer-vision facetracker opencv realtime
Last synced: about 1 month ago
JSON representation
Real time deformable face tracking in C++ with OpenCV 3.
- Host: GitHub
- URL: https://github.com/kylemcdonald/FaceTracker
- Owner: kylemcdonald
- License: mit
- Archived: true
- Created: 2012-09-30T22:50:52.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2020-07-24T18:26:28.000Z (over 4 years ago)
- Last Synced: 2024-09-27T04:03:55.180Z (7 months ago)
- Topics: computer-vision, facetracker, opencv, realtime
- Language: C++
- Homepage:
- Size: 338 KB
- Stars: 1,001
- Watchers: 118
- Forks: 360
- Open Issues: 8
-
Metadata Files:
- Readme: readme.md
- License: license.md
Awesome Lists containing this project
- awesome - FaceTracker - Real time deformable face tracking in C++ with OpenCV 3. (realtime)
README
# FaceTracker
**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](http://jsaragih.org/) and maintained by [Kyle McDonald](http://kylemcdonald.net/).
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.`
## FAQ
1. **"I successfully compiled the code, so why is my app is crashing?"** Make sure that your model files are in the right location. If you see the error `Assertion failed: s.is_open()` when running your app, that means you forgot to put the model files in the right directory.
2. **"Is there an example of using FaceTracker on a mobile device?"** There is no official example. But there is an example of using ofxFaceTracker on iOS [here](https://github.com/kylemcdonald/ofxFaceTracker-iOS) and a native Android example [here](https://github.com/ajdroid/facetrackerapp).
3. **"Why is the tracking is slow, and why is there high CPU usage?"** The face detection step (finding the general location of the face) can be slow. If this is causing an issue, you might want to put the tracking in a separate thread. If the detection is very slow you might try using a face detector that is native to your platform, and initializing FaceTracker with that rectangle.
4. **Can I use this for my commercial project/product?** Yes. FaceTracker was re-licensed under the MIT license on April 8, 2020. Previously it was available under a custom non-commercial use license, with a separate license for commercial use available for purchase.Wrappers are available for:
* Android: [facetrackerapp](https://github.com/ajdroid/facetrackerapp)
* [openFrameworks](http://www.openframeworks.cc/): [ofxFaceTracker](https://github.com/kylemcdonald/ofxFaceTracker)
* [Cinder](http://libcinder.org/): [ciFaceTracker](https://github.com/Hebali/ciFaceTracker)
* Python: [pyfacetracker](https://bitbucket.org/amitibo/pyfacetracker)## Installation
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](https://github.com/kylemcdonald/FaceTracker/tree/opencv2) branch of this repo). On OSX you can use [homebrew](http://brew.sh/):
```
$ 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](https://github.com/opencv/opencv) 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:
- src (contains all source code)
- model (contains a pre-trained tracking model)
- bin (will contain the executable after building)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](http://openmp.org/) 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` Usage
````
Usage: face_tracker [options]
Options:
-m : Tracker model (default: ../model/face2.tracker)
-c : Connectivity (default: ../model/face.con)
-t : Triangulation (default: ../model/face.tri)
-s : Image scaling (default: 1)
-d : Frames/detections (default: -1)
--check : Check for failure
--help : Print help
-? : Print help
````