softon / laravel-face-detect
A Laravel Package for Face Detection and Cropping in Images.
Installs: 23 806
Dependents: 0
Suggesters: 0
Security: 0
Stars: 57
Watchers: 6
Forks: 23
Open Issues: 4
Requires
- php: >=8.0
- illuminate/support: ~5.6.0|~5.7.0|~5.8.0|^6.0|^7.0|^8.0|^9.0
This package is auto-updated.
Last update: 2024-12-15 09:08:06 UTC
README
A Laravel Package for Face Detection and Cropping in Images.
Installation
- Edit the composer.json add to the require array & run composer update
"softon/laravel-face-detect": "dev-master"
composer update
- Add the service provider to the config/app.php file in Laravel
'Softon\LaravelFaceDetect\FaceDetectServiceProvider',
- Add an alias for the Facade to the config/app.php file in Laravel
'FaceDetect' => 'Softon\LaravelFaceDetect\Facades\FaceDetect',
- Publish the config file by running
php artisan vendor:publish
Usage
To extract the Face and save the cropped image use...
use \Softon\LaravelFaceDetect\Facades\FaceDetect; FaceDetect::extract($imagefilepath)->save($savefilepath);
To extract the Face and return the cropping coordinates without cropping the image...
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...
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.