Fork me on GitHub

A Simple Face Detector

A simple tool for learning about face detection.



Download

Running the detector

SimpleFaceDetector is a Java application. You need to have Java 1.6 or greater installed to use it. Java can be downloaded and installed from the Oracle Java SE downloads page.

Running with a webcam

If you have a webcam, the Simple Face Detector can use it to capture images and highlight detected faces. You should be able to just double click on the facedetector.jar file to launch it. Alternatively, it can be launched from a command prompt with the following command:

java -jar facedetector.jar

When the tool launches, it will connect to the first webcam it sees and display the image. A red box will be drawn around any detected faces. Pressing the space bar will pause the video, and pressing again will unpause it. Pressing the s key will allow you to save the current image to a file.

Using your own images

The face detector tool also contains a command-line mode that allows it to read an image, detect faces and save the result. To do this, the following command can be used from a command prompt:

java -jar facedetector.jar <input_image> <output_image>

For example, to detect faces in the faces.jpg file and save the result to faces-detections.jpg one would run:

java -jar facedetector.jar faces.jpg faces-detections.jpg

The original and resultant images are shown below: