freearhey/laravel-face-detection

A Laravel Package for Face Detection and Cropping in Images.
2,578 41
Install
composer require freearhey/laravel-face-detection
Latest Version:v1.4.0
PHP:^8.1
License:MIT
Last Updated:Dec 7, 2023
Links: GitHub  ·  Packagist
Maintainer: Arhey

Face Detection Build Status

A Laravel Package for Face Detection.

Installation

  1. Install the package via composer:
composer require freearhey/laravel-face-detection
  1. Add the service provider to the config/app.php file in Laravel:
'providers' => [
  ...
  Arhey\FaceDetection\FaceDetectionServiceProvider::class,
  ...
],
  1. Publish the config file by running:
php artisan vendor:publish

Usage

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');

Testing

vendor/bin/phpunit

License

MIT

Related Packages

softon/laravel-face-detect

A Laravel Package for Face Detection and Cropping in Images.

26,490 57
php-tmdb/laravel

Laravel Package for TMDB ( The Movie Database ) API. Provides easy access to the...

53,315 160
laravel-ja/laravel

The Laravel Framework.

5,667 17
kavenegar/laravel

laravel 4 and 5 kavenegar integration

368,693 86
reliese/laravel

Reliese Components for Laravel Framework code generation.

3,991,690 1,705