2017 © Pedro Peláez
 

library phpkairos

PhpKairos is a nice client for the Kairos Face Recognition API

image

ympons/phpkairos

PhpKairos is a nice client for the Kairos Face Recognition API

  • Sunday, November 8, 2015
  • by ympons
  • Repository
  • 1 Watchers
  • 3 Stars
  • 13 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

PhpKairos

PhpKairos is a nice client for the Kairos Face Recognition API, (*1)

status: Stable Please report any bugs you find so that we can improve the library for everyone., (*2)

Requires

  • PHP Version >= 5.5

Installation

Main public repository of PhpKairos is hosted at https://github.com/ympons/PhpKairos.git., (*3)

To install most recent version of library, just type, (*4)

git clone https://github.com/ympons/PhpKairos.git

where you want its file to be located., (*5)

If you have not already installed globally, you have to download composer. Just run this command inside your PhpKairos directory., (*6)

php -r "readfile('https://getcomposer.org/installer');" | php

Now get the required libraries to work with PhpKairos:, (*7)

php composer.phar --no-dev install
Note:

If you already have a composer installed or your existing project use it, you can install/add PhpKairos via Composer https://packagist.org/packages/ympons/phpkairos, it is linked to this GitHub repository ( so it is everytime updated ), and add it as dependecy to your project., (*8)

php composer.phar require "ympons/phpkairos:dev-master" --update-no-dev

Usage

PhpKairos specify autoload information, Composer generates a vendor/autoload.php file. You can simply include this file and you will get autoloading for free and declare the use of PhpKairos Client with fully qualified name., (*9)

require "vendor/autoload.php";
use PhpKairos\PhpKairos;

Client initialization

$api     = 'http://api.kairos.com/';
$app_id  = 'your_app_id';
$app_key = 'your_app_key';
$client = new PhpKairos( $api, $app_id, $app_key );

Enroll an image

The image parameter must be a publicly accessible URL or Base64 encoded photo, (*10)

$image        = 'http://media.kairos.com/kairos-elizabeth.jpg';
$subject_id   = 'subject1';
$gallery_name = 'gallerytest1';
$options      = [
  'selector' => 'SETPOSE',
  'symmetricFill' => true
];

$response = $client->enroll($image, $subject_id, $gallery_name, $options);
$result   = $response->getBody()->getContents();

Recognize an image

The image parameter must be a publicly accessible URL or Base64 encoded photo, (*11)

$image        = 'http://media.kairos.com/kairos-elizabeth.jpg';
$gallery_name = 'gallerytest1';

$response = $client->recognize($image, $gallery_name);
$result   = $response->getBody()->getContents();

Detect image attributes

The image parameter must be a publicly accessible URL or Base64 encoded photo, (*12)

$encodedImage = 'iVBORw0KGgoAAA ... ABJRU5ErkJggg==\r\n';

$response = $client->detect($encodedImage);
$result   = $response->getBody()->getContents();

List galleries

Lists out all the galleries you have created, (*13)

$response = $client->listGalleries();
$result   = $response->getBody()->getContents();

Lists out all the subjects you have enrolled in a gallery, (*14)

$gallery_name = 'gallerytest1';

$response = $client->viewGallery($gallery_name);
$result   = $response->getBody()->getContents();
$gallery_name = 'gallerytest1';

$response = $client->removeGallery($gallery_name);
$result   = $response->getBody()->getContents();

Remove a subject

Removes a subject you have enrolled within a gallery, (*15)

$subject_id   = 'subject1';
$gallery_name = 'gallerytest1';

$response = $client->removeSubject($subject_id, $gallery_name);
$result   = $response->getBody()->getContents();

License

MIT License, see LICENSE.md., (*16)

The Versions

08/11 2015

dev-master

9999999-dev

PhpKairos is a nice client for the Kairos Face Recognition API

  Sources   Download

MIT

The Requires

 

The Development Requires

sdk kairos phpkairos