face
Version 1.1 Release
为微软的认知服务构建的PHP库。
认知服务:面对API
请订阅Microsoft的认知服务API页面的API键。
打开您的composer.json文件,并将以下内容添加到require键:
"ridvanbaluyos/face": "v1.1"
添加密钥后,从命令行中运行作曲家更新以安装软件包
composer install或者
composer update在src/Ridvanbaluyos/Face/config.json文件中添加您的订阅密钥
{
"url" : " https://westus.api.cognitive.microsoft.com/face/v1.0/detect " ,
"subscriptionKey" : " zWwPD7BGWYEArX6u6QxvS25TTsNge2Qw "
}
<?php
// namespace and autoloaders
use Ridvanbaluyos Face FaceDetection as FaceDetection ;
require_once __DIR__ . ' /vendor/autoload.php ' ;
// let's use Justin Bieber's photo
$ image = array (
' url ' => ' http://img2.timeinc.net/people/i/2014/database/140831/justin-bieber-300.jpg ' ,
);
// instantiate face detection object
$ face = new FaceDetection ( $ image );
?> $ face -> getFaces (); $ face -> analyzeFaceLandmarks ()-> getFaces (); $ face -> analyzeFaceAttributes ()-> getFaces (); $ face -> analyzeFaceLandmarks ()-> analyzeFaceAttributes ()-> getFaces (); $ face -> analyzeAll ()-> getFaces ();