Skip to content

Object reference

The following class definitions with initialization should give you an idea of the objects that are used in the OpenCV Face Recognition C++ sdk package.

SortOrder

An object specifying the sort order

class SortOrder {
 public:
    static inline std::string ASCENDING = "ASC";
    static inline std::string DESCENDING = "DESC";
};

CollectionBase

An object to create a Collection

class CollectionBase {
public:
    std::string name;
    std::string description;
    std::string id;
};

Collection

An object representing a previously created Collection

class Collection: public CollectionBase
{
public:
    int count;
    std::string create_date;
    std::string modified_date;
};

CollectionCount

An object representing a list of collections matching specifying paging and search criteria

class CollectionCount {
public:
    int count;
    std::vector<Collection> collection;
};

PersonBase

An object to create a Person

class PersonBase {
public:

    std::string name;
    std::string email;
    std::string mobile;
    std::string gender;
    std::vector<string> images;
    std::string dob;
    std::string id; 
    std::string nationality;
    std::vector<Collection> collections;
    std::vector<cv::Mat> cv_images;
    std::string notes;
    bool is_bulk_insert;
};

Person

An object representing a previously created Person

class Person
{
private:
    std::string BACKEND;
    std::string api_key;
    int port;
public:
    std::string id;
    std::string name;
    std::string gender;
    std::string date_of_birth;
    std::string nationality;
    std::string create_date;
    std::string modified_date;
    std::vector<string> images;
    std::vector<cv::Mat> cv_images;
    std::vector<Collection> collections;
    std::string note;
    std::string email;
    std::vector<Thumbnail> thumbnails;
    bool is_bulk_insert;
};

PersonCount

An object representing a list of collections matching specifying paging and search criteria

''' class PersonCount { public: int count; std::vector persons; }; '''

SearchMode

A class specifying search mode

struct SearchMode {
public:
    inline static const std::string  ACCURATE = "ACCURATE";
    inline static const std::string  FAST = "FAST";
};

SearchRequest

An object specifying a search request

class SearchRequest {
public:
    double min_score{0.7};
    std::string search_mode{SearchMode::FAST};
    std::vector<string> images;
    std::string collectionid;
};

PersonSearchResult

An item in a search response

class PersonSearchResult 
{
    std::string id;
    std::string name;
    std::string gender;
    std::string date_of_birth;
    std::string nationality;
    std::string create_date;
    std::string modified_date;
    double score;
    std::vector<string> images;
    std::vector<Collection> collections;
    std::string note;
    std::vector<Thumbnail> thumbnails;
    bool is_bulk_insert;
};

OrderBy

Options to sort the results by specifying one of the fields below

class OrderBy {
 public:
     static inline std::string NAME = "name";
     static inline std::string DATE_OF_BIRTH = "date_of_birth";
     static inline std::string GENDER = "gender";
     static inline std::string NATIONALITY = "nationality";
     static inline std::string MODIFIED_DATE = "modified_date";
     static inline std::string CREATE_DATE = "create_date";
 };

Options

Options for a search

class Options {
public:
    int skip= 0 ;
    int take = 20 ;
    std::string order= SortOrder::ASCENDING;
    std::string order_by= OrderBy::NAME;
    std::string search = "";
};

DetectionRequest

An object specifying a detection request

class DetectRequest
{
public:
    std::string collection_id;
    double min_score;
    std::string search_mode;
};

Box

An object specifying a bounding box in a detection response item

class Box{
public:
    int left=0, top=0, bottom=0, right = 0;
};

LandMarks

An object specifying facial landmarks

class LandMarks
{
public:
    int left_eye[2];
    int right_eye[2];
    int nose[2];
    int left_mouth[2];
    int right_mouth[2];
};

DetectionResponseItem

A single item in the list of items returned when calling the detect API

class DetectionResponseItem
{
public:
    Box theBox;
    LandMarks theLandMarks;
    double detection_score;
    std::string thumbnail;
    std::vector<PersonSearchResult> persons;
};

VerificationRequest

An object specifying a verification request

class VerificationRequest
{
public:
    std::string id;
    double min_score;
    std::vector<string> images;
    std::string search_mode;
};

OS

A class representing the type of image capture device for liveness analysis

struct OS {
public:
    inline static const std::string DESKTOP = "DESKTOP";
    inline static const std::string ANDROID = "ANDROID";
    inline static const std::string IOS = "IOS";
};

LivenessRequest

An object specifying a liveness request

class LivenessRequest {
public:
    std::string os;
    std::string image;
};

LivenessResponse

An object specifying a liveness response

class LivenessResponse
{
public:
    double score{ 0 };
};

CompareRequest

class CompareRequest 
{
public:
    std::vector<string> gallery;
    // Image path (max 3)
    std::vector<string> probe;
    // Image path 
    std::string mode;
};

ErrorAPI

class ErrorAPI
{
public:
    int status;
    // http status code
    std::string error_code{ "" };
    // opencvfr error code
    std::string message{ "" };
    // opencvfr error message
    int retry_after;
    // if present, specifies the time in seconds when the request can be retried to meet rate limit checks
    std::string http_status_code{ "" };

    std::vector<string> loc{};
    std::string msg{ "" };
    // API DataValidation Error message
    std::string type{ "" };
    // API DataValidation Error type
    std::string cert_error_string{ "" };
    // Error certificate encryption 
};