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;
};
CollectionPersons
An object specifying an update request and response to add and remove persons
class CollectionPersons
{
public:
std::string collection_id;
std::vector<string> new_person_ids;
std::vector<string> removed_person_ids;
}
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<Person> persons;
};
Actions
An object specifying type of action for bulk operations
class Actions
{
public:
static inline std::string DEL = "DELETE";
};
UpdatePersonsRequest
An object specifying a bulk action request
class UpdatePersonsRequest
{
public:
std::string action = Actions::DEL;
std::string <std::string> ids;
};
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
{
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;
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 box;
LandMarks landmarks;
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;
// OS setting
std::string image;
// Image path
};
LivenessResponse
An object specifying a liveness response
class LivenessResponse
{
public:
double score{ 0 };
// the score of the liveness
};
CompareRequest
An object specifying a request to compare two sets of images
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{ "" };
// HTTP status code
std::vector<string> loc{};
// location of error
std::string msg{ "" };
// API DataValidation Error message
std::string type{ "" };
// API DataValidation Error type
std::string cert_error_string{ "" };
// Error certificate encryption
};