inquid/laravel-azure-face-api
Composer 安装命令:
composer require inquid/laravel-azure-face-api
包简介
Laravel package to access Azure Cognitive Face APIs and do Facial Recognition
README 文档
README
Install Library
Using composer:
composer require inquid/laravel-azure-face-api
Run composer update to update or install the library.
Set env variables
# Azure Cognitive Services
AZURE_COGNITIVE_API_KEY_FACE={your_api_key}
AZURE_COGNITIVE_ENDPOINT_FACE=https://yourdomain.cognitiveservices.azure.com/
Update Providers
Update the config/app.php file to add the following line to the providers array:
AzureFace\AzureFaceServiceProvider::class,
And the following line to the aliases array:
'AzureFace' => AzureFace\Facades\AzureFace::class,
Test the library
For a quick check, you can use the following code in a controller:
$face = AzureFace::detectFacesFromUrl('https://upload.wikimedia.org/wikipedia/commons/thumb/d/d2/Donald_Trump_August_19%2C_2015_%28cropped%29.jpg/245px-Donald_Trump_August_19%2C_2015_%28cropped%29.jpg', [ 'recognitionModel' => 'recognition_02', 'detectionModel' => 'detection_01', 'returnFaceId' => 'true', 'returnFaceLandmarks' => 'true', 'returnFaceAttributes' => 'age,gender,glasses,smile,noise,hair,accessories,emotion,makeup,headPose,facialHair,occlusion,blur,exposure', ]); dd($face);
Examples
Detect Faces using URL.
$face = AzureFace::detectFacesFromUrl('https://upload.wikimedia.org/wikipedia/commons/thumb/d/d2/Donald_Trump_August_19%2C_2015_%28cropped%29.jpg/245px-Donald_Trump_August_19%2C_2015_%28cropped%29.jpg', [ 'recognitionModel' => 'recognition_02', 'detectionModel' => 'detection_01', 'returnFaceId' => 'true', 'returnFaceLandmarks' => 'true', 'returnFaceAttributes' => 'age,gender,glasses,smile,noise,hair,accessories,emotion,makeup,headPose,facialHair,occlusion,blur,exposure', ]);
Detect Faces using file file (uploaded as binary)
$face = AzureFace::detectFacesFromFile(file_get_contents(public_path('IMG.jpg')), [ 'recognitionModel' => 'recognition_02', 'detectionModel' => 'detection_01', 'returnFaceId' => 'true', 'returnFaceLandmarks' => 'true', 'returnFaceAttributes' => 'age,gender,glasses,smile,noise,hair,accessories,emotion,makeup,headPose,facialHair,occlusion,blur,exposure', ]);
统计信息
- 总下载量: 23
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-10-28