ridvanbaluyos/face
A PHP Library built for the Microsoft's Cognitive Services., (*1)
Cognitive Services: Face API
br/br/, (*2)
, (*3)
Table of contents
Requirements
Kindly subscribe for an API key to Microsoft's Cognitive Services API page., (*4)
Installation
Open your composer.json
file and add the following to the require
key:, (*5)
"ridvanbaluyos/face": "v1.1"
After adding the key, run composer update from the command line to install the package, (*6)
composer install
or, (*7)
composer update
Configuration
Add your subscription key in src/Ridvanbaluyos/Face/config.json
file, (*8)
{
"url" : "https://westus.api.cognitive.microsoft.com/face/v1.0/detect",
"subscriptionKey" : "zWwPD7BGWYEArX6u6QxvS25TTsNge2Qw"
}
Usage
'http://img2.timeinc.net/people/i/2014/database/140831/justin-bieber-300.jpg',
);
// instantiate face detection object
$face = new FaceDetection($image);
?>
Detecting a face
$face->getFaces();
Analyzing Face Landmarks
$face->analyzeFaceLandmarks()->getFaces();
Analyzing Face Attributes
$face->analyzeFaceAttributes()->getFaces();
Chaining options
$face->analyzeFaceLandmarks()->analyzeFaceAttributes()->getFaces();
Alternatively, you can analyze all possible options
$face->analyzeAll()->getFaces();
References