Recommend this page to a friend! |
Download |
Info | Documentation | Demos | Screenshots | Files | Install with Composer | Download | Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
Not enough user ratings | Total: 344 | All time: 7,051 This week: 47 |
Version | License | PHP version | Categories | |||
haarphp 1.0.6 | Artistic License | 5 | PHP 5, Graphics, Artificial intelligence |
Description | Author | |||||||||||||||||||||||
This package can be used to detect features (e.g. faces) that may be present in images |
|
I need a PHP class for face matching
Solution to match faces from uploaded pictures
__Feature Detection Library for PHP__
Based on Viola-Jones Feature Detection Algorithm using Haar Cascades and improvement Viola-Jones-Lienhart et al Feature Detection Algorithm
This is a port of OpenCV C++ Haar Detection and of JViolaJones Java) to PHP.
there is also a javascript
version: HAAR.js
You can use the __existing openCV cascades__ to build your detectors.
To do this just transform the __opencv xml file__ to PHP format using the __haartophp__ (php) tool (in cascades folder)
__examples:__
to use opencv's haarcascades_frontalface_alt.xml in php do:
haartophp haarcascades_frontalface_alt.xml > haarcascades_frontalface_alt.php
this creates a php
file: haarcascades_frontalface_alt.php
which you can include in your php
application (see examples)
the variable to use in php is similarly: $haarcascades_frontalface_alt
__constructor()__
new HaarDetector($haardata);
__Explanation of parameters__
__clearCache()__
$detector->clearCache();
Clear any cached image data and haardata in case space is an issue. Use image method and cascade method (see below) to re-set image and haar data
__cascade()__
$detector->cascade($haardata);
Allow to use same detector (with its cached image data), to detect different feature on same image, by using another cascade. This way any image pre-processing is done only once
__Explanation of parameters__
__image()__
$detector->image($GDImage, $scale = 1.0);
__Explanation of parameters__
__selection()__
$detector->selection('auto'|array|feature|$x [,$y, $width, $height]);
Get/Set a custom region in the image to confine the detection process only in that region (eg detect nose while face already detected)
__Explanation of parameters__
The actual selection rectangle/feature is available as $this->selection()
or $detector->selection()
with no parameters
__cannyThreshold()__
$detector->cannyThreshold(array('low'=> lowThreshold, 'high'=> highThreshold));
Set the thresholds when Canny Pruning is used, for extra fine-tuning. Canny Pruning detects the number/density of edges in a given region. A region with too few or too many edges is unlikely to be a feature. Default values work fine in most cases, however depending on image size and the specific feature, some fine tuning could be needed
__Explanation of parameters__
__detect()__
$detector->detect($baseScale = 1, $scale_inc = 1.25, $increment = 0.1, $min_neighbors = 1 , $epsilon = 0.2, $doCannyPruning = false);
__Explanation of parameters__ (JViolaJones Parameters)
__Examples included with face detection__
__1.0.6__ * correction when selection is used again (revert to previous code)
__1.0.5__ * correction when selection is used, use same version as HAAR.js * implicit type casting warnings in php 8 handled
__1.0.2__ * port code from latest version of opencv
__1.0.1__ * inline detection routine for further speed * update test examples with many faces detection
__1.0.0__ * correct detection on custom selection * refactor code
__0.4__
* refactor code (make smaller)
* add clearCache method, to delete any stored/cached image data in the detector (in case space is an issue)
* add the tilted feature (Lienhart et al, extension)
* make new haartophp
tool, output format changed, __make sure to re-convert your .php
haar cascades!!__
* tidy up the repo
* fix some typos, edits
__0.3__ * add new methods (_selection_ , _cascade_ , _cannyThreshold_ ) * use fixed-point arithmetic if possible (eg gray-scale, canny computation) * optimize array indexing, remove unnecessary multiplications * reduce unnecessary loops, inline code instead of method calling for speed * rewrite _merge_ method (features might be slightly different now) * features are now generic classes not arrays * code refactor/fixes * update readme, add method documentation
__0.2__ * add haartophp tool in php (all-php solution) * optimize array operations, refactor, etc..
__0.1__ * initial release
see also:
Screenshots (1) | ||
Files (13) | / | cascades |
File | Role | Description |
---|---|---|
haarcascade_frontalface_alt.php | Aux. | Auxiliary script |
haarcascade_frontalface_alt.xml | Data | Auxiliary data |
haartophp.bat | Data | Auxiliary data |
haartophp.php | Class | Class source |
haartophp.sh | Data | Auxiliary data |
Files (13) | / | examples |
File | Role | Description |
---|---|---|
css.css | Data | Auxiliary data |
feature_detection.php | Example | Example script |
index.php | Aux. | Auxiliary script |
manyfaces.jpg | Icon | Icon image |
modelface.jpg | Icon | Icon image |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.