Skip to content

Latest commit

 

History

History

opencv-haar-tweaked

OpenCV - Haar (tweaked)

Detect faces using an OpenCV haar cascade classifier and customizing a few default settings.

Requirements

Installation

There are lots of different ways on how to install OpenCV and it's Python module.
The easiest way would be to install it through the unofficial Python package using Pip.
You can also compile OpenCV on your machine yourself, there are many tutorials covering this topic already. For OSX you can e.g. try out this tutorial.

Cascade classifier

We use OpenCV's CascadeClassifier class to load a stump-based 20x20 gentle adaboost frontal face detector classifier. Having said that, a big thank you to Rainer Lienhart who created and published this file.

Running the face detection

Simply run php index.php, your images with face detection will be saved in /dataset-output/opencv-haar-tweaked.

Note

The PHP script uses by default the python command line program.
If you want to use another command line program (e.g. python3), simply run composer install and copy the .env.example file to .env and customize the command line program.