sym / sym-baidu-face-laravel
百度人脸laravel拓展
dev-master
2020-06-02 03:03 UTC
Requires
- php: >=5.6
This package is auto-updated.
Last update: 2024-12-29 06:27:35 UTC
README
基于人脸识别SDK适配laravel拓展
安装
composer require sym/sym-baidu-face-laravel
发布配置
php artisan vendor:publish --tag=baidu-face
百度人脸参数 config/baidu-face.php
return [ 'APP_ID' => '', 'API_KEY' => '', 'SECRET_KEY' => '', ];
laravel<=5.8
//配置 config/app.php [ 'providers'=>[ 'Sym\BaiduFace\BaiduFaceServiceProvider::class' ] ];
示例
// APP_ID, API_KEY, SECRET_KEY 如果传了这三个参数会优先与配置参数 $client = new AipFace(APP_ID, API_KEY, SECRET_KEY); $image = file_get_contents('test.jpg'); // 调用人脸检测 调用方式和官方SDK一样 // 可选参数 $options = [ 'max_face_num'=>1, 'face_field' => 'age,beauty,expression,face_shape,gender,eye_status,face_type,mask,occlusion,spoofing,quality,landmark,landmark72,angle' ]; $res = $client->detect(base64_encode(file_get_contents($image)), 'BASE64', $options); dd($res);
相关
百度人脸识别SDK for php 百度在线文档:https://cloud.baidu.com/doc/FACE/Face-PHP-SDK.html