An open API service indexing awesome lists of open source software.

https://github.com/softon/laravel-face-detect

A Laravel Package for Face Detection
https://github.com/softon/laravel-face-detect

crop-image face-detection laravel-5-package laravel-package

Last synced: 2 months ago
JSON representation

A Laravel Package for Face Detection

Awesome Lists containing this project

README

        

# Laravel-Face-Detect
A Laravel Package for Face Detection and Cropping in Images.

Installation


  1. Edit the composer.json add to the require array & run composer update

     "softon/laravel-face-detect": "dev-master" 

     composer update 


  2. Add the service provider to the config/app.php file in Laravel

     'Softon\LaravelFaceDetect\FaceDetectServiceProvider', 



  3. Add an alias for the Facade to the config/app.php file in Laravel

     'FaceDetect' => 'Softon\LaravelFaceDetect\Facades\FaceDetect', 



  4. Publish the config file by running

     php artisan vendor:publish 



Usage

To extract the Face and save the cropped image use...
```php
use \Softon\LaravelFaceDetect\Facades\FaceDetect;

FaceDetect::extract($imagefilepath)->save($savefilepath);
```

To extract the Face and return the cropping coordinates without cropping the image...
```php
use \Softon\LaravelFaceDetect\Facades\FaceDetect;

$crop_params = FaceDetect::extract($imagefilepath)->face; // return array with x,y,width
```

To detect if face is found in a image...
```php
use \Softon\LaravelFaceDetect\Facades\FaceDetect;

$crop_params = FaceDetect::extract($imagefilepath)->face_found; // returns true/false
```

You may edit the config file facedetect.php in the config directory to add aditional padding to the cropped Images.