face
Version 1.1 Release
Microsoftの認知サービス向けに構築されたPHPライブラリ。
認知サービス:Face API
MicrosoftのCognitive Services APIページのAPIキーを登録してください。
composer.jsonファイルを開き、次のことをrequireキーに追加します。
"ridvanbaluyos/face": "v1.1"
キーを追加した後、コマンドラインから作曲家の更新を実行してパッケージをインストールします
composer installまたは
composer updatesrc/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 ();