9 #ifndef __PBIO_API__PBIO__FACEREC_SERVICE_H_
10 #define __PBIO_API__PBIO__FACEREC_SERVICE_H_
23 #include "stl_wraps_impls/WrapIStreamImpl.h"
24 #include "stl_wraps_impls/WrapOStreamImpl.h"
30 #include "ComplexObject.h"
33 #include "ActiveLiveness.h"
38 #include "ExceptionCheck.h"
42 #include "RawSample.h"
43 #include "Recognizer.h"
46 #include "VideoWorker.h"
47 #include "StructStorage.h"
49 #include "ProcessingUnit.h"
51 #ifndef WITHOUT_PROCESSING_BLOCK
53 #include "ProcessingBlock.h"
73 typedef LightSmartPtr<FacerecService>::tPtr
Ptr;
200 const std::string dll_path,
201 std::string facerec_conf_dir,
202 const std::string license_dir = std::string());
238 const std::string dll_path,
239 std::string facerec_conf_dir,
247 const std::string dll_path,
248 std::string facerec_conf_dir,
249 const std::string license,
250 const bool is_license_dir);
475 const char* ini_file,
476 const bool processing =
true,
477 const bool matching =
true,
478 const bool processing_less_memory_consumption =
false)
const;
526 const bool processing =
true,
527 const bool matching =
true,
528 const bool processing_less_memory_consumption =
false)
const;
608 const char* recognizer_ini_file,
609 const int streams_count,
610 const int processing_threads_count,
611 const int matching_threads_count)
const;
658 const int streams_count,
659 const int processing_threads_count,
660 const int matching_threads_count)
const;
786 pbio::stl_wraps::WrapIStream &binary_stream,
788 const double space_translation_x = 0,
789 const double space_translation_y = 0,
790 const double space_scale = 1)
const;
796 std::istream &binary_stream,
798 const double space_translation_x = 0,
799 const double space_translation_y = 0,
800 const double space_scale = 1)
const;
856 pbio::stl_wraps::WrapIStream &binary_stream,
857 const unsigned char *image_data,
859 const double space_translation_x = 0,
860 const double space_translation_y = 0,
861 const double space_scale = 1)
const;
868 std::istream &binary_stream,
869 const unsigned char *image_data,
871 const double space_translation_x = 0,
872 const double space_translation_y = 0,
873 const double space_scale = 1)
const;
920 const std::string ini_file)
const;
974 const std::string ini_file)
const;
1028 const std::string ini_file)
const;
1081 const std::string ini_file)
const;
1085 ProcessingUnit::Ptr createProcessingUnit(
1086 const int block_type,
1087 const char* serializedConfig)
const;
1089 #ifndef WITHOUT_PROCESSING_BLOCK
1098 Context createContext()
const;
1112 Context createContextFromEncodedImage(
const uint8_t* data, uint64_t dataSize)
const;
1124 Context createContextFromEncodedImage(
const std::vector<uint8_t>& data)
const;
1136 Context createContextFromEncodedImage(
const std::string& data)
const;
1138 Context createContextFromEncodedImage(
const std::vector<char>& data)
const;
1158 Context createContextFromFrame(uint8_t* data, int32_t width, int32_t height, Context::Format format = Context::Format::FORMAT_BGR, int32_t baseAngle = 0)
const;
1160 Context createContextFromJsonFile(
const char* path);
1172 Context createContextFromJsonFile(std::string path);
1325 jobject android_media_image);
1326 #endif // ifdef ANDROID
1371 const bool downscale_x2,
1372 void*
const result_buffer);
1375 void convertYUV2RGB(
1377 const bool downscale_x2,
1378 const int base_angle,
1379 void*
const result_buffer);
1382 void convertBGRA88882RGB(
1384 const bool downscale_x2,
1385 const int base_angle,
1386 void*
const result_buffer);
1391 const std::string _facerec_conf_dir;
1396 const DHPtr &dll_handle,
1397 const std::string &facerec_conf_dir,
1418 const std::string dll_path,
1419 std::string facerec_conf_dir,
1420 const std::string license_dir)
1422 return createService(NULL, dll_path, facerec_conf_dir, license_dir,
true);
1428 const std::string dll_path,
1429 std::string facerec_conf_dir,
1439 const std::string dll_path,
1440 std::string facerec_conf_dir,
1441 const std::string license,
1442 const bool is_license_dir)
1445 #ifdef __STATIC_LIBFACEREC_BUILD__
1448 const DHPtr dll_handle( DHPtr::make() );
1450 const DHPtr dll_handle( DHPtr::make(dll_path.c_str()) );
1453 if(facerec_conf_dir.empty())
1455 facerec_conf_dir =
"./";
1457 else if(facerec_conf_dir[facerec_conf_dir.length() - 1] !=
'/')
1459 facerec_conf_dir +=
'/';
1462 void* exception = NULL;
1468 the_impl = dll_handle->FacerecService_constructor3(
1470 facerec_conf_dir.c_str(),
1478 the_impl = dll_handle->FacerecService_constructor5(
1480 facerec_conf_dir.c_str(),
1486 checkException(exception, *dll_handle);
1488 return FacerecService::Ptr::make(
1496 FacerecService::FacerecService(
1497 const DHPtr &dll_handle,
1498 const std::string &facerec_conf_dir,
1500 ComplexObject(dll_handle, impl),
1501 _facerec_conf_dir(facerec_conf_dir)
1505 if (LIBFACEREC_VERSION != lib_version)
1506 std::cerr <<
"WARNING: The version in the header does not match the version in the library. Header version: "
1507 << LIBFACEREC_VERSION <<
", library version: " << lib_version << std::endl;
1514 std::ostringstream version_stream;
1515 pbio::stl_wraps::WrapOStreamImpl version_stream_wrap(version_stream);
1517 void* exception = NULL;
1519 _dll_handle->get_version(
1520 &version_stream_wrap,
1521 pbio::stl_wraps::WrapOStream::write_func,
1524 checkException(exception, *_dll_handle);
1526 return version_stream.str();
1533 void* exception = NULL;
1535 _dll_handle->FacerecService_forceOnlineLicenseUpdate(
1539 checkException(exception, *_dll_handle);
1546 const std::string file_path = _facerec_conf_dir + config.config_filepath;
1548 std::vector<char const*> overridden_keys;
1549 std::vector<double> overridden_values;
1551 config.prepare(overridden_keys, overridden_values);
1553 void* exception = NULL;
1555 pbio::facerec::CapturerImpl*
const capturer_impl =
1556 _dll_handle->FacerecService_createCapturerE(
1559 overridden_keys.size(),
1560 overridden_keys.empty() ? NULL : &(overridden_keys[0]),
1561 overridden_values.empty() ? NULL : &(overridden_values[0]),
1564 checkException(exception, *_dll_handle);
1566 return Capturer::Ptr::make(_dll_handle, capturer_impl);
1572 const std::string file_path = _facerec_conf_dir + ini_file;
1574 void* exception = NULL;
1576 pbio::facerec::AgeGenderEstimatorImpl*
const the_impl =
1577 _dll_handle->FacerecService_createAgeGenderEstimator(
1582 checkException(exception, *_dll_handle);
1584 return AgeGenderEstimator::Ptr::make(_dll_handle, the_impl);
1591 const std::string file_path = _facerec_conf_dir + ini_file;
1593 void* exception = NULL;
1595 pbio::facerec::QualityEstimatorImpl*
const the_impl =
1596 _dll_handle->FacerecService_createQualityEstimator(
1601 checkException(exception, *_dll_handle);
1603 return QualityEstimator::Ptr::make(_dll_handle, the_impl);
1610 const std::string file_path = _facerec_conf_dir + ini_file;
1612 void* exception = NULL;
1614 pbio::facerec::FaceQualityEstimatorImpl*
const the_impl =
1615 _dll_handle->FacerecService_createFaceQualityEstimator(
1620 checkException(exception, *_dll_handle);
1622 return FaceQualityEstimator::Ptr::make(_dll_handle, the_impl);
1628 void* exception = NULL;
1630 pbio::facerec::LivenessEstimatorImpl*
const the_impl =
1631 _dll_handle->FacerecService_createLivenessEstimator(
1635 checkException(exception, *_dll_handle);
1637 return LivenessEstimator::Ptr::make(_dll_handle, the_impl);
1643 const std::string ini_file)
const
1645 const std::string file_path = _facerec_conf_dir + ini_file;
1647 void* exception = NULL;
1649 pbio::facerec::EmotionsEstimatorImpl*
const the_impl =
1650 _dll_handle->FacerecService_createEmotionsEstimator(
1655 checkException(exception, *_dll_handle);
1657 return EmotionsEstimator::Ptr::make(_dll_handle, the_impl);
1663 const char* ini_file,
1664 const bool processing,
1665 const bool matching,
1666 const bool processing_less_memory_consumption)
const
1668 const std::string file_path = _facerec_conf_dir + ini_file;
1670 void* exception = NULL;
1672 pbio::facerec::RecognizerImpl*
const recognizer_impl =
1673 _dll_handle->FacerecService_createRecognizer2(
1681 (int) processing_less_memory_consumption,
1684 checkException(exception, *_dll_handle);
1686 return Recognizer::Ptr::make(_dll_handle, recognizer_impl);
1693 const bool processing,
1694 const bool matching,
1695 const bool processing_less_memory_consumption)
const
1697 const std::string file_path = _facerec_conf_dir + recognizer_config.config_filepath;
1699 std::vector<char const*> overridden_keys;
1700 std::vector<double> overridden_values;
1702 recognizer_config.prepare(overridden_keys, overridden_values);
1704 void* exception = NULL;
1706 pbio::facerec::RecognizerImpl*
const recognizer_impl =
1707 _dll_handle->FacerecService_createRecognizer2(
1710 overridden_keys.size(),
1711 overridden_keys.empty() ? NULL : &(overridden_keys[0]),
1712 overridden_values.empty() ? NULL : &(overridden_values[0]),
1715 (
int) processing_less_memory_consumption,
1718 checkException(exception, *_dll_handle);
1720 return Recognizer::Ptr::make(_dll_handle, recognizer_impl);
1728 const char* recognizer_ini_file,
1729 const int streams_count,
1730 const int processing_threads_count,
1731 const int matching_threads_count)
const
1735 .video_worker_config(video_worker_ini_file)
1736 .recognizer_ini_file(recognizer_ini_file)
1737 .streams_count(streams_count)
1738 .processing_threads_count(processing_threads_count)
1739 .matching_threads_count(matching_threads_count)
1747 const int streams_count,
1748 const int processing_threads_count,
1749 const int matching_threads_count)
const
1753 .video_worker_config(video_worker_ini_file)
1754 .recognizer_config(recognizer_config)
1755 .streams_count(streams_count)
1756 .processing_threads_count(processing_threads_count)
1757 .matching_threads_count(matching_threads_count)
1765 std::vector<char const*> vw_overridden_keys;
1766 std::vector<double> vw_overridden_values;
1768 params._video_worker_config.prepare(vw_overridden_keys, vw_overridden_values);
1769 std::vector<std::string> extra_over_params;
1771 if(!params._active_liveness_checks_order.empty()){
1772 bool is_unique =
true;
1773 for (
auto it = params._active_liveness_checks_order.begin(); it != params._active_liveness_checks_order.end(); ++it)
1774 if (std::find(it + 1, params._active_liveness_checks_order.end(), *it) != params._active_liveness_checks_order.end()) {
1780 "Error 0x3302330e: Set a unique order of `active_liveness_checks_order` for Active Liveness.");
1781 for (
size_t i = 0; i < params._active_liveness_checks_order.size(); i++){
1783 std::string check_str = ActiveLiveness::CheckTypeToString(check);
1784 extra_over_params.push_back(
"active_liveness.check_" + check_str);
1785 vw_overridden_keys.push_back(extra_over_params.back().c_str());
1786 vw_overridden_values.push_back(-(
double)(i+1));
1791 if (!params._recognizer_ini_file.empty() && !params._recognizer_config.config_filepath.empty())
1792 throw pbio::Error(0xb3fe4d07,
"Error: 0xed877a99 You must use either recognizer_config or recognizer_ini_file.");
1795 params._recognizer_ini_file.empty() ?
1796 params._recognizer_config :
1799 std::vector<char const*> rec_overridden_keys;
1800 std::vector<double> rec_overridden_values;
1802 recognizer_config.prepare(rec_overridden_keys, rec_overridden_values);
1804 void* exception = NULL;
1806 pbio::facerec::VideoWorkerImpl*
const vw_impl =
1807 _dll_handle->FacerecService_createVideoWorker_sti_age_gender_emotions(
1810 VideoWorker::STrackingCallback,
1811 VideoWorker::STemplateCreatedCallback,
1812 VideoWorker::SMatchFoundCallback,
1813 VideoWorker::STrackingLostCallback,
1814 VideoWorker::SStiPersonOutdatedCallback,
1816 (_facerec_conf_dir + params._video_worker_config.config_filepath).c_str(),
1817 vw_overridden_keys.size(),
1818 vw_overridden_keys.empty() ? NULL : &(vw_overridden_keys[0]),
1819 vw_overridden_values.empty() ? NULL : &(vw_overridden_values[0]),
1821 (_facerec_conf_dir + recognizer_config.config_filepath).c_str(),
1822 rec_overridden_keys.size(),
1823 rec_overridden_keys.empty() ? NULL : &(rec_overridden_keys[0]),
1824 rec_overridden_values.empty() ? NULL : &(rec_overridden_values[0]),
1826 params._streams_count,
1827 params._processing_threads_count,
1828 params._matching_threads_count,
1829 params._short_time_identification_enabled,
1830 params._short_time_identification_distance_threshold,
1831 params._short_time_identification_outdate_time_seconds,
1832 params._age_gender_estimation_threads_count,
1833 params._emotions_estimation_threads_count,
1836 checkException(exception, *_dll_handle);
1838 return VideoWorker::Ptr::make(_dll_handle, vw_impl);
1845 pbio::stl_wraps::WrapIStreamImpl binary_stream_wrap(binary_stream);
1853 void* exception = NULL;
1855 pbio::facerec::RawSampleImpl*
const raw_sampl_impl =
1856 _dll_handle->FacerecService_loadRawSample(
1859 pbio::stl_wraps::WrapIStream::read_func,
1862 checkException(exception, *_dll_handle);
1864 return RawSample::Ptr::make(_dll_handle, raw_sampl_impl);
1869 pbio::stl_wraps::WrapIStream &binary_stream,
1871 const double space_translation_x,
1872 const double space_translation_y,
1873 const double space_scale)
const
1875 void* exception = NULL;
1877 const RawImage::CapiData cdata = image.makeCapiData();
1879 pbio::facerec::RawSampleImpl*
const raw_sampl_impl =
1880 _dll_handle->FacerecService_loadRawSampleWithoutImage_raw_image(
1883 pbio::stl_wraps::WrapIStream::read_func,
1890 cdata.crop_info_offset_x,
1891 cdata.crop_info_offset_y,
1892 cdata.crop_info_data_image_width,
1893 cdata.crop_info_data_image_height,
1895 space_translation_x,
1896 space_translation_y,
1901 checkException(exception, *_dll_handle);
1903 return RawSample::Ptr::make(_dll_handle, raw_sampl_impl);
1908 std::istream &binary_stream,
1910 const double space_translation_x,
1911 const double space_translation_y,
1912 const double space_scale)
const
1914 pbio::stl_wraps::WrapIStreamImpl binary_stream_wrap(binary_stream);
1919 space_translation_x,
1920 space_translation_y,
1926 pbio::stl_wraps::WrapIStream &binary_stream,
1927 const unsigned char *image_data,
1928 int image_data_size,
1929 const double space_translation_x,
1930 const double space_translation_y,
1931 const double space_scale)
const
1933 void* exception = NULL;
1935 pbio::facerec::RawSampleImpl*
const raw_sampl_impl =
1936 _dll_handle->FacerecService_loadRawSampleWithoutImage_encoded_image(
1939 pbio::stl_wraps::WrapIStream::read_func,
1944 space_translation_x,
1945 space_translation_y,
1950 checkException(exception, *_dll_handle);
1952 return RawSample::Ptr::make(_dll_handle, raw_sampl_impl);
1957 std::istream &binary_stream,
1958 const unsigned char *image_data,
1959 int image_data_size,
1960 const double space_translation_x,
1961 const double space_translation_y,
1962 const double space_scale)
const
1964 pbio::stl_wraps::WrapIStreamImpl binary_stream_wrap(binary_stream);
1971 space_translation_x,
1972 space_translation_y,
1980 void* exception = NULL;
1982 pbio::facerec::CameraCalibratorImpl*
const calibrator_impl =
1983 _dll_handle->FacerecService_createCameraCalibrator(
1987 checkException(exception, *_dll_handle);
1989 return CameraCalibrator::Ptr::make(_dll_handle, calibrator_impl);
1996 const std::string ini_file)
const
1998 const std::string file_path = _facerec_conf_dir + ini_file;
2000 void* exception = NULL;
2002 pbio::facerec::DepthLivenessEstimatorImpl*
const the_impl =
2003 _dll_handle->FacerecService_createDepthLivenessEstimatorE(
2011 checkException(exception, *_dll_handle);
2013 return DepthLivenessEstimator::Ptr::make(_dll_handle, the_impl);
2021 const std::string file_path = _facerec_conf_dir + config.config_filepath;
2023 std::vector<char const*> overridden_keys;
2024 std::vector<double> overridden_values;
2026 config.prepare(overridden_keys, overridden_values);
2028 void* exception = NULL;
2030 pbio::facerec::DepthLivenessEstimatorImpl*
const the_impl =
2031 _dll_handle->FacerecService_createDepthLivenessEstimatorE(
2034 overridden_keys.size(),
2035 overridden_keys.empty() ? NULL : &(overridden_keys[0]),
2036 overridden_values.empty() ? NULL : &(overridden_values[0]),
2039 checkException(exception, *_dll_handle);
2041 return DepthLivenessEstimator::Ptr::make(_dll_handle, the_impl);
2046 const std::string ini_file)
const
2048 const std::string file_path = _facerec_conf_dir + ini_file;
2050 void* exception = NULL;
2052 pbio::facerec::IRLivenessEstimatorImpl*
const the_impl =
2053 _dll_handle->FacerecService_createIRLivenessEstimatorE(
2061 checkException(exception, *_dll_handle);
2063 return IRLivenessEstimator::Ptr::make(_dll_handle, the_impl);
2070 const std::string file_path = _facerec_conf_dir + config.config_filepath;
2072 std::vector<char const*> overridden_keys;
2073 std::vector<double> overridden_values;
2075 config.prepare(overridden_keys, overridden_values);
2077 void* exception = NULL;
2079 pbio::facerec::IRLivenessEstimatorImpl*
const the_impl =
2080 _dll_handle->FacerecService_createIRLivenessEstimatorE(
2083 overridden_keys.size(),
2084 overridden_keys.empty() ? NULL : &(overridden_keys[0]),
2085 overridden_values.empty() ? NULL : &(overridden_values[0]),
2088 checkException(exception, *_dll_handle);
2090 return IRLivenessEstimator::Ptr::make(_dll_handle, the_impl);
2095 const std::string ini_file)
const
2097 const std::string file_path = _facerec_conf_dir + ini_file;
2099 void* exception = NULL;
2101 pbio::facerec::Liveness2DEstimatorImpl*
const the_impl =
2102 _dll_handle->FacerecService_createLiveness2DEstimatorE(
2110 checkException(exception, *_dll_handle);
2112 return Liveness2DEstimator::Ptr::make(_dll_handle, the_impl);
2119 const std::string file_path = _facerec_conf_dir + config.config_filepath;
2121 std::vector<char const*> overridden_keys;
2122 std::vector<double> overridden_values;
2124 config.prepare(overridden_keys, overridden_values);
2126 void* exception = NULL;
2128 pbio::facerec::Liveness2DEstimatorImpl*
const the_impl =
2129 _dll_handle->FacerecService_createLiveness2DEstimatorE(
2132 overridden_keys.size(),
2133 overridden_keys.empty() ? NULL : &(overridden_keys[0]),
2134 overridden_values.empty() ? NULL : &(overridden_values[0]),
2137 checkException(exception, *_dll_handle);
2139 return Liveness2DEstimator::Ptr::make(_dll_handle, the_impl);
2144 const std::string ini_file)
const
2146 const std::string file_path = _facerec_conf_dir + ini_file;
2148 void* exception = NULL;
2150 pbio::facerec::FaceAttributesEstimatorImpl*
const the_impl =
2151 _dll_handle->FacerecService_createFaceAttributesEstimator(
2159 checkException(exception, *_dll_handle);
2161 return FaceAttributesEstimator::Ptr::make(_dll_handle, the_impl);
2167 ProcessingUnit::Ptr FacerecService::createProcessingUnit(
2168 const int block_type,
2169 const char* serializedConfig)
const
2171 return ProcessingUnit::Ptr::make(_dll_handle, block_type, serializedConfig);
2174 #ifndef WITHOUT_PROCESSING_BLOCK
2175 inline Context FacerecService::createContext()
const
2180 inline Context FacerecService::createContextFromEncodedImage(
const uint8_t* data, uint64_t dataSize)
const
2182 return Context(_dll_handle, data, dataSize);
2185 inline Context FacerecService::createContextFromEncodedImage(
const std::vector<uint8_t>& data)
const
2187 return Context(_dll_handle, data.data(), data.size());
2190 inline Context FacerecService::createContextFromEncodedImage(
const std::string& data)
const
2192 return Context(_dll_handle, reinterpret_cast<const uint8_t*>(data.data()), data.size());
2195 inline Context FacerecService::createContextFromEncodedImage(
const std::vector<char>& data)
const
2197 return Context(_dll_handle, reinterpret_cast<const uint8_t*>(data.data()), data.size());
2200 inline Context FacerecService::createContextFromFrame(uint8_t* data, int32_t width, int32_t height, Context::Format format, int32_t baseAngle)
const
2202 return Context(_dll_handle, data, width, height, format, baseAngle);
2205 inline Context FacerecService::createContextFromJsonFile(
const char* path)
2207 return Context(_dll_handle, path);
2210 inline Context FacerecService::createContextFromJsonFile(std::string path)
2212 return Context(_dll_handle, path.c_str());
2226 void* exception = NULL;
2228 void* struct_storage_impl = _dll_handle->FacerecService_getLicenseState(_impl, &exception);
2230 checkException(exception, *_dll_handle);
2232 const StructStorage struct_storage(_dll_handle, struct_storage_impl);
2236 result.
online = struct_storage.get_int64(StructStorageFields::license_state_online_t);
2238 result.
android_app_id = (
char const*) struct_storage.get_pointer(StructStorageFields::license_state_android_app_id_t);
2239 result.
android_serial = (
char const*) struct_storage.get_pointer(StructStorageFields::license_state_android_serial_t);
2240 result.
ios_app_id = (
char const*) struct_storage.get_pointer(StructStorageFields::license_state_ios_app_id_t);
2241 result.
hardware_reg = (
char const*) struct_storage.get_pointer(StructStorageFields::license_state_hardware_reg_t);
2243 result.
counters.resize( struct_storage.get_int64(
2244 StructStorageFields::license_state_licenses_count_t) );
2246 for(
size_t i = 0; i < result.
counters.size(); ++i)
2248 result.
counters[i].name = (
char const*) struct_storage.get_pointer(
2249 (i << 16) |
size_t(StructStorageFields::license_state_licenses_names_int16_t) );
2251 result.
counters[i].max_value = struct_storage.get_int64(
2252 (i << 16) |
size_t(StructStorageFields::license_state_licenses_total_counts_int16_t) );
2254 result.
counters[i].value = struct_storage.get_int64(
2255 (i << 16) |
size_t(StructStorageFields::license_state_licenses_in_use_counts_int16_t) );
2265 void* exception = NULL;
2267 _dll_handle->FacerecService_toggleAlgorithmsCacheKepp(1, &exception);
2269 checkException(exception, *_dll_handle);
2275 void* exception = NULL;
2277 _dll_handle->FacerecService_toggleAlgorithmsCacheKepp(0, &exception);
2279 checkException(exception, *_dll_handle);
2290 void* exception = NULL;
2294 void* imagetptr_ptr;
2296 void*
const the_impl = _dll_handle->InternalImageBuffer_constructor(
2305 checkException(exception, *_dll_handle);
2307 return InternalImageBuffer::Ptr::make(
2310 (
unsigned char*) data_ptr,
2323 jobject android_media_image)
2325 void* exception = NULL;
2332 void* imagetptr_ptr;
2334 void*
const the_impl = _dll_handle->InternalImageBuffer_constructor_from_android_image(
2336 android_media_image,
2345 checkException(exception, *_dll_handle);
2347 return InternalImageBuffer::Ptr::make(
2350 (
unsigned char*) data_ptr,
2362 const bool downscale_x2,
2363 void*
const result_buffer)
2365 void* exception = NULL;
2367 const RawImage::CapiData cdata = image.makeCapiData();
2369 _dll_handle->RawImage_convertYUV2ARGB(
2375 cdata.crop_info_offset_x,
2376 cdata.crop_info_offset_y,
2377 cdata.crop_info_data_image_width,
2378 cdata.crop_info_data_image_height,
2383 checkException(exception, *_dll_handle);
2387 void FacerecService::convertYUV2RGB(
2389 const bool downscale_x2,
2390 const int base_angle,
2391 void*
const result_buffer)
2393 void* exception = NULL;
2395 const RawImage::CapiData cdata = image.makeCapiData();
2397 _dll_handle->RawImage_convertYUV2RGB(
2403 cdata.crop_info_offset_x,
2404 cdata.crop_info_offset_y,
2405 cdata.crop_info_data_image_width,
2406 cdata.crop_info_data_image_height,
2412 checkException(exception, *_dll_handle);
2416 void FacerecService::convertBGRA88882RGB(
2418 const bool downscale_x2,
2419 const int base_angle,
2420 void*
const result_buffer)
2422 void* exception = NULL;
2424 const RawImage::CapiData cdata = image.makeCapiData();
2426 _dll_handle->RawImage_convertYUV2RGB(
2432 cdata.crop_info_offset_x,
2433 cdata.crop_info_offset_y,
2434 cdata.crop_info_data_image_width,
2435 cdata.crop_info_data_image_height,
2441 checkException(exception, *_dll_handle);
2451 #endif // __PBIO_API__PBIO__FACEREC_SERVICE_H_
VideoWorker::Ptr createVideoWorker(const pbio::VideoWorker::Params params) const
Creates a VideoWorker object. Thread-safe. When VideoWorker is created with matching_thread=0 and pr...
Definition: FacerecService.h:1762
Interface object used to work with estimators from Processing Block API.
Definition: ProcessingBlock.h:29
std::string android_serial
Serial number of the Android device. Only available on Android (tag <android_serial>).
Definition: FacerecService.h:141
Interface object used to work with estimators from Processing Block API.
Definition: ProcessingBlock.h:16
Struct that provides raw image data and optional cropping information.
Definition: RawImage.h:28
static FacerecService::Ptr createService(const std::string dll_path, std::string facerec_conf_dir, const std::string license_dir=std::string())
Initializes the facerec lib (can be called only once).
Definition: FacerecService.h:1417
Interface object for creating other interface objects.
Definition: FacerecService.h:64
QualityEstimator - Interface object used to estimate sample quality.
FaceAttributesEstimator::Ptr createFaceAttributesEstimator(const std::string ini_file) const
Creates an FaceAttributesEstimator object. Thread-safe.
Definition: FacerecService.h:2143
LightSmartPtr< InternalImageBuffer >::tPtr Ptr
Alias for the type of a smart pointer to InternalImageBuffer.
Definition: InternalImageBuffer.h:34
CameraCalibrator - Interface object for camera calibration and correction of image distortion...
LightSmartPtr< EmotionsEstimator >::tPtr Ptr
Alias for the type of a smart pointer to EmotionsEstimator.
Definition: EmotionsEstimator.h:50
int64_t max_value
Maximum counter value (equals to the tag value).
Definition: FacerecService.h:115
State of the counter assigned to a specified license element.
Definition: FacerecService.h:103
std::string android_app_id
Android application ID. Available only on Android (tag <android_app_id>).
Definition: FacerecService.h:135
LightSmartPtr< IRLivenessEstimator >::tPtr Ptr
Alias for the type of a smart pointer to IRLivenessEstimator.
Definition: IRLivenessEstimator.h:43
LightSmartPtr< FaceQualityEstimator >::tPtr Ptr
Alias for the type of a smart pointer to FaceQualityEstimator.
Definition: FaceQualityEstimator.h:50
LightSmartPtr< VideoWorker >::tPtr Ptr
Alias for the type of a smart pointer to VideoWorker.
Definition: VideoWorker.h:72
Liveness2DEstimator is an interface object used to estimate face liveness in order to prevent spoofin...
IRLivenessEstimator::Ptr createIRLivenessEstimator(const std::string ini_file) const
Creates an IRLivenessEstimator object. Thread-safe.
Definition: FacerecService.h:2045
LightSmartPtr< CameraCalibrator >::tPtr Ptr
Alias for the type of a smart pointer to CameraCalibrator.
Definition: CameraCalibrator.h:48
LightSmartPtr< Capturer >::tPtr Ptr
Alias for the type of a smart pointer to Capturer.
Definition: Capturer.h:45
Recognizer::Ptr createRecognizer(const char *ini_file, const bool processing=true, const bool matching=true, const bool processing_less_memory_consumption=false) const
Creates a Recognizer object. Thread-safe.
Definition: FacerecService.h:1662
void convertYUV2ARGB(const RawImage image, const bool downscale_x2, void *const result_buffer)
Convert input image to android.graphics.Bitmap.Config.ARGB_8888 format. Input must be in YUV_NV21 of ...
Definition: FacerecService.h:2360
CameraCalibrator::Ptr createCameraCalibrator() const
Creates a CameraCalibrator object. Thread-safe.
Definition: FacerecService.h:1978
Parameters of the VideoWorker constructor.
Definition: VideoWorker.h:89
Capturer::Ptr createCapturer(const pbio::FacerecService::Config config) const
Creates a Capturer object. Type and features depend on the content of the configuration file...
Definition: FacerecService.h:1543
DepthLivenessEstimator - Interface object used to estimate face liveness in order to prevent spoofing...
EmotionsEstimator - Interface object for estimation of emotions.
A class used to override the configuration parameters at runtime.
Definition: Config.h:19
LightSmartPtr< RawSample >::tPtr Ptr
Alias for the type of a smart pointer to RawSample.
Definition: RawSample.h:58
LightSmartPtr< QualityEstimator >::tPtr Ptr
Alias for the type of a smart pointer to QualityEstimator.
Definition: QualityEstimator.h:50
Error - the class of exceptions thrown when errors occur.
LivenessEstimator - Interface object used to estimate face liveness to prevent spoofing attacks...
AgeGenderEstimator - interface object for age and gender estimation.
void forceOnlineLicenseUpdate() const
Force online license update.
Definition: FacerecService.h:1531
AgeGenderEstimator::Ptr createAgeGenderEstimator(const std::string ini_file) const
Creates a AgeGenderEstimator object. Thread-safe.
Definition: FacerecService.h:1570
void freeAlgorithmsCache() const
Disable keeping algorithms data in memory. Thread-safe.
Definition: FacerecService.h:2273
const std::string license_body
Сontent of a license.
Definition: FacerecService.h:87
InternalImageBuffer::Ptr createInternalImageBuffer(const int width, const int height, const RawImage::Format format)
Create InternalImageBuffer for specified image size and format. Thread-safe. Always create new Intern...
Definition: FacerecService.h:2285
std::vector< CounterState > counters
State of all license counters.
Definition: FacerecService.h:159
LightSmartPtr< Recognizer >::tPtr Ptr
Alias for the type of a smart pointer to Recognizer.
Definition: Recognizer.h:46
LightSmartPtr< FacerecService >::tPtr Ptr
Alias for the type of a smart pointer to FacerecService.
Definition: FacerecService.h:73
The class of exceptions thrown when errors occur.
Definition: Error.h:26
std::string ios_app_id
iOS application ID. Available only on iOS (tag <ios_app_id>).
Definition: FacerecService.h:147
void keepAlgorithmsCache() const
Enalbe keeping algorithms data in memory even if no owners left. This will speedup repeated algorithm...
Definition: FacerecService.h:2263
Liveness2DEstimator::Ptr createLiveness2DEstimator(const std::string ini_file) const
Creates an Liveness2DEstimator object. Thread-safe.
Definition: FacerecService.h:2094
std::string hardware_reg
Hardware signature (tag <Reg>).
Definition: FacerecService.h:153
FaceQualityEstimator::Ptr createFaceQualityEstimator(const std::string ini_file) const
Creates a FaceQualityEstimator object. Thread-safe.
Definition: FacerecService.h:1608
std::string getVersion() const
Get version of face recognition library. Thread-safe.
Definition: FacerecService.h:1512
QualityEstimator::Ptr createQualityEstimator(const std::string ini_file) const
Creates a QualityEstimator object. Thread-safe.
Definition: FacerecService.h:1589
bool online
Online license flag.
Definition: FacerecService.h:128
int64_t value
Current value (number of used elements).
Definition: FacerecService.h:121
std::string name
Element name (equals to the tag name).
Definition: FacerecService.h:109
Storing the license as a string variable.
Definition: FacerecService.h:81
FaceAttributesEstimator is an interface object used to estimate attributes of the face...
Context is an interface object for storing data and interacting with methods from the Processing Bloc...
Definition: Context.h:51
LightSmartPtr< Liveness2DEstimator >::tPtr Ptr
Alias for the type of a smart pointer to Liveness2DEstimator.
Definition: Liveness2DEstimator.h:50
Context is an interface object for storing data and interacting with methods from the Processing Bloc...
Definition: Context.h:65
IRLivenessEstimator is an interface object used to estimate face liveness in order to prevent spoofin...
LicenseState getLicenseState() const
Get the license state. Thread-safe.
Definition: FacerecService.h:2224
LightSmartPtr< FaceAttributesEstimator >::tPtr Ptr
Alias for the type of a smart pointer to FaceAttributesEstimator.
Definition: FaceAttributesEstimator.h:37
RawSample::Ptr loadRawSample(std::istream &binary_stream) const
Loads a RawSample object that was saved with the RawSample::save member function. The format is platf...
Definition: FacerecService.h:1843
LightSmartPtr< LivenessEstimator >::tPtr Ptr
Alias for the type of a smart pointer to LivenessEstimator.
Definition: LivenessEstimator.h:42
RawSample::Ptr loadRawSampleWithoutImage(pbio::stl_wraps::WrapIStream &binary_stream, const RawImage image, const double space_translation_x=0, const double space_translation_y=0, const double space_scale=1) const
Loads a RawSample object that was saved with the RawSample::saveWithoutImage member function...
Definition: FacerecService.h:1868
EmotionsEstimator::Ptr createEmotionsEstimator(const std::string ini_file) const
Creates a EmotionsEstimator object. Thread-safe.
Definition: FacerecService.h:1642
Format
Format of image data.
Definition: IRawImage.h:46
LightSmartPtr< AgeGenderEstimator >::tPtr Ptr
Alias for the type of a smart pointer to AgeGenderEstimator.
Definition: AgeGenderEstimator.h:55
LivenessEstimator::Ptr createLivenessEstimator() const
Creates a LivenessEstimator object. Thread-safe.
Definition: FacerecService.h:1626
CheckType
Check type for active liveness.
Definition: ActiveLiveness.h:14
Struct that provides raw image data and optional cropping information.
Definition: RawImage.h:113
FaceQualityEstimator - Interface object for sample quality estimation.
DepthLivenessEstimator::Ptr createDepthLivenessEstimator(const std::string ini_file) const
Creates a DepthLivenessEstimator object. Thread-safe.
Definition: FacerecService.h:1995
License status.
Definition: FacerecService.h:97
LightSmartPtr< DepthLivenessEstimator >::tPtr Ptr
Alias for the type of a smart pointer to DepthLivenessEstimator.
Definition: DepthLivenessEstimator.h:43