face
Version 1.1 Release
A PHP Library built for the Microsoft's Cognitive Services.
Cognitive Services: Face API
Kindly subscribe for an API key to Microsoft's Cognitive Services API page.
Open your composer.json file and add the following to the require key:
"ridvanbaluyos/face": "v1.1"
After adding the key, run composer update from the command line to install the package
composer installor
composer updateAdd your subscription key in src/Ridvanbaluyos/Face/config.json file
{
"url" : "https://westus.api.cognitive.microsoft.com/face/v1.0/detect",
"subscriptionKey" : "zWwPD7BGWYEArX6u6QxvS25TTsNge2Qw"
}
<?php
// namespace and autoloaders
use RidvanbaluyosFaceFaceDetection 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();