Skip to content


Persons are people you would like to recognize/verify using our API.

You can use the API to add persons to the database, group them into collections, and manage them later.

Create a Person

Let's get started with creating a person:

PersonBase personbase; = "varun";
Personbase.images ={“c:\\images\\varun.jpg”};
Person person;
person = sdk.persons.create(personbase);

Here, we have initialized the person object with a name and the path to an image. In addition to a path to an image, you could also have passed in an image in opencv Mat format.

personbase.cv_image = {image_1,image_2};

Images can be loaded in both methods to same object.

We now have a created Person.

A person has the following class properties listed below:

  • name - mandatory name of the person (we used this while creating the person)
  • images - at least 1 and a maximum of 3 images of the person (we used one image)
  • id - if specified, the system uses this as the id of the person. If unspecified, the system uses a unique identifier.
  • gender - the gender of the person
  • date_of_birth - the person's date of birth
  • nationality - the person's nationality
  • collections - a list of collections that the person belongs to
  • notes - any additional notes about the person

List Persons

Now that we have created a Person let's list all persons (as we did with collections).

Options op;
PersonCount persons= sdk.persons.list(op);

This should return an “persons” object of type PersonCount. The “count” attribute of the object indicates the number of persons and the “person” attribute of the objects is a vector of person object(s) with particulars such as “name” and “description” in it.

Filtering Persons

In the previous example, we called sdk.persons.list() without specifying any qualifiers.

Like in collections, we can call sdk.persons.list() with additional parameters that determine what results will be returned.

Options op;
op.skip = 0;
op.take = 5; = “Varun”;
op.order = SortOrder::ASCENDING;
op.order_by = Order_by::CREATE_DATE;
PersonCount persons= sdk.persons.list(op);

As with collections, you can choose a sort order, a column to order the results by order_by, a search string, and take and skip parameters to help you implement paging.

Updating a Person

You can update a Person either after creating one, or after getting one:


Person person;
PersonBase personbase; = "varun";
Personbase.images ={“c:\\images\\varun.jpg”};
person = sdk.persons.create(personbase);


Person my_person = sdk.persons.get(;

As long as my_person is a valid reference to a person, you can update it like so: = "Speedy Gonzalves";
my_person = sdk.persons.update(my_person);
Updating the images of a Person

To update the images of a person, you can set the images property: = "Speedy Gonzalves";
my_person.images = {"c:\\images\\varun1.jpg"};
my_person = sdk.persons.update(my_person);

Alternatively, the OpencCV format Mat object can be added by

my_person.cv_image = { my_image };

If you retrieved the person using sdk.persons.get(, then all images should be set in one go. You should NOT do the following:

my_person.images = {my_person.thumbnail[0].save_jpeg(“c:\\output.jpg”)};

Doing the above will mean that the first image is actually a thumbnail from the server - which is smaller than 224x224 pixels, and should not be sent to the server again. Using new, full size images to update the person's images is the intended way to use this SDK.

Adding a Person to a Collection

To add a Person to a Collection, you can specify the Collection in the collections list of the person during a create, or update operation.

During creation:

Collection my_collection = sdk.collections.get(; = "varun";
personbase.images ={“c:\\images\\varun.jpg”};
person = sdk.persons.create(personbase);

During update:

Collection my_collection = sdk.collections.get(;
person = sdk.persons.get(;
person = sdk.persons.update(person);

Deleting a specific Person

If you know the id of a person, you can delete the person like so:

string deleted_id = sdk.persons.deletePerson(;