Face detection using PHP

December 21, 2009david 1 Comment »

Recently I heard about OpenCV and some applications for AI using this library. This is a interesting topic and very powerful. There is many examples in C, C++ and Python, but I really surprised because I found 2 implementations in PHP.

First of all, What Face Detection/Recognition is?

Is a computer technology that determines the locations and sizes of human faces in arbitrary (digital) images. It detects facial features and ignores anything else, such as buildings, trees and bodies.

How to do this in PHP?

OpenCV wrapper to detect faces with PHP. The extension offers the two new functions: face_count() and face_detect(). In princible, they differ only by their return value. The first returns only the number of faces found on the given image and the other an associative array of their coordinates. face_count() serves only to save the loops for counting. Examples:
OpenCV in PHP example 1
OpenCV in PHP example 2

Face detection in pure PHP (without OpenCV). This is a PHP Class to face recognition without OpenCV, it use an data file, but not external libraries. We can use it with few code:

 
$detector = new Face_Detector('detection.dat');
$detector->face_detect('maurice_svay_150.jpg');
$detector->toJpeg();
 

Example:
Example FaceDetection

Enjoy it!

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks

One response to this entry

Join the discussion


} catch(err) {}