A Laravel Package for Face Detection and Cropping in Images.
freearhey/laravel-face-detection is a Laravel package for a laravel package for face detection and cropping in images..
It currently has 41 GitHub stars and 2.237 downloads on Packagist (latest version v1.4.0).
Install it with composer require freearhey/laravel-face-detection.
Discover more Laravel packages by freearhey
or browse all Laravel packages to compare alternatives.
Last updated
A Laravel Package for Face Detection.
composer require freearhey/laravel-face-detection
config/app.php file in Laravel:'providers' => [
...
Arhey\FaceDetection\FaceDetectionServiceProvider::class,
...
],
php artisan vendor:publish
use Arhey\FaceDetection\Facades\FaceDetection;
$face = FaceDetection::extract('path/to/image.jpg');
To detect if face is found in a image:
if($face->found) {
// face found
} else {
// face not found
}
To get the facial boundaries:
var_dump($face->bounds);
/*
array(
'x' => 292.0,
'y' => 167.0,
'w' => 204.8,
'h' => 204.8,
)
*/
To save the found face image:
$face->save('path/to/output.jpg');
vendor/bin/phpunit