ASEF eye tracking in C
C++ C Makefile
Switch branches/tags
Nothing to show
Latest commit 5d06b2e Nov 27, 2014 @laoyang Merge pull request #3 from kiwifig/master
Update and rename asef.c to asef.cc
Permalink
Failed to load latest commit information.
data
.gitignore
Makefile
README.md
asef.cc
asef.cpp
asef.h
asef.hpp
camera_main.c
fd.c
fd.h
utils.c
utils.h

README.md

ASEF eye locator

Xiaochao Yang

Rev. 2

Quite a few people are interesed in this project, but unfortunately the code in the repo was just a dump from an experimental project for research. I spent a few days rewriting it. Please let me know if you have any problem with it. The code is tested on Mac OS X and Ubuntu, should also works on other Linux distros.

About ASEF

ASEF stands for Average of Synthetic Exact Filters. With trained filters (./data/EyeLocatorASEF128x128.fel), ASEF can quickly locate both eyes in an image with a face present. I ported the python implementation from D.S. Bolme's FaceL library. Please refer to his paper on the details of the algorithm:

Average of Synthetic Exact Filters

Here is the video demo of the same code running on an iPhone 4:

http://www.youtube.com/watch?v=cQA_Do1mZ9E. (You need to make many changes to have it running on iOS, read the suggestions below)

For those who are only interested in the implementation of ASEF, please look at

	void asef_locate_eyes(AsefEyeLocator *asef)

in asef.c

Caveat: ASEF operates on the results of Haar face detection. ASEF is fast, but face detection is slow. Also face detection is not good at handling rotation (both in-plane and out-of-plane), so the ASEF shares the same problem.

Suggestions to iOS/Mac/Android developers

I'm pretty sure Apple provides face detection, eye and mouth tracking functions (bought from Pola Rose) to desktop and mobile developers. Please refer to the SDK manual. I think you should use them instead of this as they're speed and accuracy optimized for the system, without the dependency to OpenCV. (Loading OpenCV static libraries on a iPhone can take 5-10 seconds!!)

Android provides face detection function on the video live feeds, but not eye and mouth detection. If you look up in the manual, their APIs actually have eye and mouth detections, but they're not implemented on the most of the syetems I've seen: Nexus S, Galaxy Nexus, Galaxy S3, at Android version 4.2. Let's hope Google can add them soon.

Prerequisites:

  • System: Linux/Mac OS X.
  • Having gcc and related command line tools installed.
  • Having OpenCV installed.
  • You need to check if you have pkg-config setup for opencv by executing "pkg-config opencv --cflags --libs", and make sure that the results make sense.
  • Optional but strongly recommended: Enable the TBB support in OpenCV. The face detection function in OpenCV is multi-threaded with TBB. It will take advantage of your multi-core processor. (Mac homebrew user, install with "brew instal opencv --with-tbb")

To compile:

In a terminal, cd to the source code folder and run:

	make

To run

Make sure you have a webcam attached. In a terminal, cd to the source code folder and run:

	./camera_main -f ./data/haarcascade_frontalface_alt2.xml -e ./data/EyeLocatorASEF128x128.fel

TODOs :

  • Add a seperate binary for single image demostration.
  • Add byte swapping for endieness.