Kairos is the easist way add Face-Recognition to your web applications. Our API provides a full-featured and robust Face-Recognition backend, right out of the box. This is the PHP wrapper for the Kairos Face Recognition API. The package includes a class (Kairos.php) you can use as an easy client to the API. Continue reading to learn how to integrate Kairos into your web application.
Thanks to contributions by some of our customers, we also have Ruby and .NET wrappers available. Also see our Javascript SDK, our Android SDK and our iOS SDK.
- An environment configured to run PHP scripts.
If you just want to do a quick test run, follow these steps:
- Create your free developer account
- Log into the Kairos Developer Dashboard
- Create an application and copy your App Id & App Key
- Run
methods_test.php
in your browser. - Enter your app_id and app_key, and run the Kairos methods.
- Create your free Kairos developer account if you don't already have one.
- Log into the dashboard and create a new app.
- Copy your App ID & App Key (you'll need them later).
- Download the SDK and unzip the package.
- Open the folder named Kairos-SDK-PHP containing the Kairos.php class.
- Place the wrapper class (Kairos.php) somewhere within your application.
- Include Kairos.php where needed in your web application project.
include("Kairos.php");
This method returns a list of all galleries you've created:
$response = $Kairos->viewGalleries();
This method returns a list of all subjects for a given gallery:
$gallery_name = 'friends1';
$argumentArray = array(
"gallery_name" => $gallery_name
);
$response = $Kairos->viewSubjectsInGallery($argumentArray);
This method removes a subject from given gallery:
$subject_id = 'dave';
$gallery_name = 'friends1';
$argumentArray = array(
"subject_id" => $subject_id,
"gallery_name" => $gallery_name
);
$response = $Kairos->removeSubjectFromGallery($argumentArray);
This method removes a given gallery:
$gallery_name = 'friends1';
$argumentArray = array(
"gallery_name" => $gallery_name
);
$response = $Kairos->removeGallery($argumentArray);
The Enroll method registers a face for later recognitions. Here's an example of enrolling a face (subject) using a method that accepts an absolute path to an image file in your file system or base64 image data, and enrolls it as a new subject into your specified gallery:
$image = '/images/myphotos/myphoto123.png';
(or)
$image = 'iVBORw0KGgoAAA ... ABJRU5ErkJggg==\r\n';
$subject_id = 'elizabeth';
$gallery_name = 'friends1';
$argumentArray = array(
"image" => $image,
"subject_id" => $subject_id,
"gallery_name" => $gallery_name
);
$response = $Kairos->enroll($argumentArray);
The SDK also includes a file upload field, which converts a local image file to base64 data.
The Recognize method takes an image of a subject and attempts to match it against a given gallery of previously-enrolled subjects. Here's an example of recognizing a subject using a method that accepts an absolute path to an image file in your file system or base64 image data, sends it to the API, and returns a match and confidence value:
$image = '/images/myphotos/myphoto123.png';
(or)
$image = 'iVBORw0KGgoAAA ... ABJRU5ErkJggg==\r\n';
$gallery_name = 'friends1';
$argumentArray = array(
"image" => $image,
"gallery_name" => $gallery_name
);
$response = $Kairos->recognize($argumentArray);
The SDK also includes a file upload field, which converts a local image file to base64 data.
The Detect method takes an image of a subject and returns various attributes pertaining to the face features. Here's an example of the detect method which accepts a path to an image file on your system or base64 image data, sends it to the API, and returns face attributes:
$image = '/images/myphotos/myphoto123.png';
(or)
$image = 'iVBORw0KGgoAAA ... ABJRU5ErkJggg==\r\n';
$argumentArray = array(
"image" => $image
);
$response = $Kairos->detect($argumentArray);
The SDK also includes a file upload field, which converts a local image file to base64 data.
The Verify method takes an image and verifies that it matches an existing subject in a gallery. Here's an example of using verify via method that accepts a path to an image file, sends it to the API, and returns face attributes:
$image = '/images/myphotos/myphoto123.png';
(or)
$image = 'iVBORw0KGgoAAA ... ABJRU5ErkJggg==\r\n';
$subject_id = 'elizabeth';
$gallery_name = 'friends1';
$argumentArray = array(
"image" => $image,
"subject_id" => $subject_id,
"gallery_name" => $gallery_name
);
$response = $Kairos->verify($argumentArray);
The SDK also includes a file upload field, which converts a local image file to base64 data.
##Support Have an issue? Visit our Support page or create an issue on GitHub
Test on RapidAPI