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;
482 const char* ini_file,
483 const bool processing =
true,
484 const bool matching =
true,
485 const bool processing_less_memory_consumption =
false)
const;
533 const bool processing =
true,
534 const bool matching =
true,
535 const bool processing_less_memory_consumption =
false)
const;
615 const char* recognizer_ini_file,
616 const int streams_count,
617 const int processing_threads_count,
618 const int matching_threads_count)
const;
665 const int streams_count,
666 const int processing_threads_count,
667 const int matching_threads_count)
const;
793 pbio::stl_wraps::WrapIStream &binary_stream,
795 const double space_translation_x = 0,
796 const double space_translation_y = 0,
797 const double space_scale = 1)
const;
803 std::istream &binary_stream,
805 const double space_translation_x = 0,
806 const double space_translation_y = 0,
807 const double space_scale = 1)
const;
863 pbio::stl_wraps::WrapIStream &binary_stream,
864 const unsigned char *image_data,
866 const double space_translation_x = 0,
867 const double space_translation_y = 0,
868 const double space_scale = 1)
const;
875 std::istream &binary_stream,
876 const unsigned char *image_data,
878 const double space_translation_x = 0,
879 const double space_translation_y = 0,
880 const double space_scale = 1)
const;
927 const std::string ini_file)
const;
981 const std::string ini_file)
const;
1035 const std::string ini_file)
const;
1088 const std::string ini_file)
const;
1092 ProcessingUnit::Ptr createProcessingUnit(
1093 const int block_type,
1094 const char* serializedConfig)
const;
1096 #ifndef WITHOUT_PROCESSING_BLOCK
1105 Context createContext()
const;
1119 Context createContextFromEncodedImage(
const uint8_t* data, uint64_t dataSize)
const;
1131 Context createContextFromEncodedImage(
const std::vector<uint8_t>& data)
const;
1143 Context createContextFromEncodedImage(
const std::string& data)
const;
1145 Context createContextFromEncodedImage(
const std::vector<char>& data)
const;
1165 Context createContextFromFrame(uint8_t* data, int32_t width, int32_t height, Context::Format format = Context::Format::FORMAT_BGR, int32_t baseAngle = 0)
const;
1167 Context createContextFromJsonFile(
const char* path);
1179 Context createContextFromJsonFile(std::string path);
1332 jobject android_media_image);
1333 #endif // ifdef ANDROID
1378 const bool downscale_x2,
1379 void*
const result_buffer);
1382 void convertYUV2RGB(
1384 const bool downscale_x2,
1385 const int base_angle,
1386 void*
const result_buffer);
1389 void convertBGRA88882RGB(
1391 const bool downscale_x2,
1392 const int base_angle,
1393 void*
const result_buffer);
1398 const std::string _facerec_conf_dir;
1403 const DHPtr &dll_handle,
1404 const std::string &facerec_conf_dir,
1425 const std::string dll_path,
1426 std::string facerec_conf_dir,
1427 const std::string license_dir)
1429 return createService(NULL, dll_path, facerec_conf_dir, license_dir,
true);
1435 const std::string dll_path,
1436 std::string facerec_conf_dir,
1446 const std::string dll_path,
1447 std::string facerec_conf_dir,
1448 const std::string license,
1449 const bool is_license_dir)
1452 #ifdef __STATIC_LIBFACEREC_BUILD__
1455 const DHPtr dll_handle( DHPtr::make() );
1457 const DHPtr dll_handle( DHPtr::make(dll_path.c_str()) );
1460 if(facerec_conf_dir.empty())
1462 facerec_conf_dir =
"./";
1464 else if(facerec_conf_dir[facerec_conf_dir.length() - 1] !=
'/')
1466 facerec_conf_dir +=
'/';
1469 void* exception = NULL;
1475 the_impl = dll_handle->FacerecService_constructor3(
1477 facerec_conf_dir.c_str(),
1485 the_impl = dll_handle->FacerecService_constructor5(
1487 facerec_conf_dir.c_str(),
1493 checkException(exception, *dll_handle);
1495 return FacerecService::Ptr::make(
1503 FacerecService::FacerecService(
1504 const DHPtr &dll_handle,
1505 const std::string &facerec_conf_dir,
1507 ComplexObject(dll_handle, impl),
1508 _facerec_conf_dir(facerec_conf_dir)
1512 if (LIBFACEREC_VERSION != lib_version)
1513 std::cerr <<
"WARNING: The version in the header does not match the version in the library. Header version: "
1514 << LIBFACEREC_VERSION <<
", library version: " << lib_version << std::endl;
1521 std::ostringstream version_stream;
1522 pbio::stl_wraps::WrapOStreamImpl version_stream_wrap(version_stream);
1524 void* exception = NULL;
1526 _dll_handle->get_version(
1527 &version_stream_wrap,
1528 pbio::stl_wraps::WrapOStream::write_func,
1531 checkException(exception, *_dll_handle);
1533 return version_stream.str();
1540 void* exception = NULL;
1542 _dll_handle->FacerecService_forceOnlineLicenseUpdate(
1546 checkException(exception, *_dll_handle);
1553 const std::string file_path = _facerec_conf_dir + config.config_filepath;
1555 std::vector<char const*> overridden_keys;
1556 std::vector<double> overridden_values;
1558 config.prepare(overridden_keys, overridden_values);
1560 void* exception = NULL;
1562 pbio::facerec::CapturerImpl*
const capturer_impl =
1563 _dll_handle->FacerecService_createCapturerE(
1566 overridden_keys.size(),
1567 overridden_keys.empty() ? NULL : &(overridden_keys[0]),
1568 overridden_values.empty() ? NULL : &(overridden_values[0]),
1571 checkException(exception, *_dll_handle);
1573 return Capturer::Ptr::make(_dll_handle, capturer_impl);
1579 const std::string file_path = _facerec_conf_dir + ini_file;
1581 void* exception = NULL;
1583 pbio::facerec::AgeGenderEstimatorImpl*
const the_impl =
1584 _dll_handle->FacerecService_createAgeGenderEstimator(
1589 checkException(exception, *_dll_handle);
1591 return AgeGenderEstimator::Ptr::make(_dll_handle, the_impl);
1598 const std::string file_path = _facerec_conf_dir + ini_file;
1600 void* exception = NULL;
1602 pbio::facerec::QualityEstimatorImpl*
const the_impl =
1603 _dll_handle->FacerecService_createQualityEstimator(
1608 checkException(exception, *_dll_handle);
1610 return QualityEstimator::Ptr::make(_dll_handle, the_impl);
1617 const std::string file_path = _facerec_conf_dir + ini_file;
1619 void* exception = NULL;
1621 pbio::facerec::FaceQualityEstimatorImpl*
const the_impl =
1622 _dll_handle->FacerecService_createFaceQualityEstimator(
1627 checkException(exception, *_dll_handle);
1629 return FaceQualityEstimator::Ptr::make(_dll_handle, the_impl);
1635 void* exception = NULL;
1637 pbio::facerec::LivenessEstimatorImpl*
const the_impl =
1638 _dll_handle->FacerecService_createLivenessEstimator(
1642 checkException(exception, *_dll_handle);
1644 return LivenessEstimator::Ptr::make(_dll_handle, the_impl);
1650 const std::string ini_file)
const
1652 const std::string file_path = _facerec_conf_dir + ini_file;
1654 void* exception = NULL;
1656 pbio::facerec::EmotionsEstimatorImpl*
const the_impl =
1657 _dll_handle->FacerecService_createEmotionsEstimator(
1662 checkException(exception, *_dll_handle);
1664 return EmotionsEstimator::Ptr::make(_dll_handle, the_impl);
1670 const char* ini_file,
1671 const bool processing,
1672 const bool matching,
1673 const bool processing_less_memory_consumption)
const
1675 const std::string file_path = _facerec_conf_dir + ini_file;
1677 void* exception = NULL;
1679 pbio::facerec::RecognizerImpl*
const recognizer_impl =
1680 _dll_handle->FacerecService_createRecognizer2(
1688 (int) processing_less_memory_consumption,
1691 checkException(exception, *_dll_handle);
1693 return Recognizer::Ptr::make(_dll_handle, recognizer_impl);
1699 const char* ini_file,
1700 const bool processing,
1701 const bool matching,
1702 const bool processing_less_memory_consumption)
const
1704 const std::string file_path = _facerec_conf_dir + ini_file;
1706 void* exception = NULL;
1708 pbio::facerec::RecognizerImpl*
const recognizer_impl =
1709 _dll_handle->FacerecService_createResizableRecognizer2(
1717 (int) processing_less_memory_consumption,
1720 checkException(exception, *_dll_handle);
1722 return Recognizer::Ptr::make(_dll_handle, recognizer_impl);
1729 const bool processing,
1730 const bool matching,
1731 const bool processing_less_memory_consumption)
const
1733 const std::string file_path = _facerec_conf_dir + recognizer_config.config_filepath;
1735 std::vector<char const*> overridden_keys;
1736 std::vector<double> overridden_values;
1738 recognizer_config.prepare(overridden_keys, overridden_values);
1740 void* exception = NULL;
1742 pbio::facerec::RecognizerImpl*
const recognizer_impl =
1743 _dll_handle->FacerecService_createRecognizer2(
1746 overridden_keys.size(),
1747 overridden_keys.empty() ? NULL : &(overridden_keys[0]),
1748 overridden_values.empty() ? NULL : &(overridden_values[0]),
1751 (
int) processing_less_memory_consumption,
1754 checkException(exception, *_dll_handle);
1756 return Recognizer::Ptr::make(_dll_handle, recognizer_impl);
1764 const char* recognizer_ini_file,
1765 const int streams_count,
1766 const int processing_threads_count,
1767 const int matching_threads_count)
const
1771 .video_worker_config(video_worker_ini_file)
1772 .recognizer_ini_file(recognizer_ini_file)
1773 .streams_count(streams_count)
1774 .processing_threads_count(processing_threads_count)
1775 .matching_threads_count(matching_threads_count)
1783 const int streams_count,
1784 const int processing_threads_count,
1785 const int matching_threads_count)
const
1789 .video_worker_config(video_worker_ini_file)
1790 .recognizer_config(recognizer_config)
1791 .streams_count(streams_count)
1792 .processing_threads_count(processing_threads_count)
1793 .matching_threads_count(matching_threads_count)
1801 std::vector<char const*> vw_overridden_keys;
1802 std::vector<double> vw_overridden_values;
1804 params._video_worker_config.prepare(vw_overridden_keys, vw_overridden_values);
1805 std::vector<std::string> extra_over_params;
1807 if(!params._active_liveness_checks_order.empty()){
1808 bool is_unique =
true;
1809 for (
auto it = params._active_liveness_checks_order.begin(); it != params._active_liveness_checks_order.end(); ++it)
1810 if (std::find(it + 1, params._active_liveness_checks_order.end(), *it) != params._active_liveness_checks_order.end()) {
1816 "Error 0x3302330e: Set a unique order of `active_liveness_checks_order` for Active Liveness.");
1817 for (
size_t i = 0; i < params._active_liveness_checks_order.size(); i++){
1819 std::string check_str = ActiveLiveness::CheckTypeToString(check);
1820 extra_over_params.push_back(
"active_liveness.check_" + check_str);
1821 vw_overridden_keys.push_back(extra_over_params.back().c_str());
1822 vw_overridden_values.push_back(-(
double)(i+1));
1827 if (!params._recognizer_ini_file.empty() && !params._recognizer_config.config_filepath.empty())
1828 throw pbio::Error(0xb3fe4d07,
"Error: 0xed877a99 You must use either recognizer_config or recognizer_ini_file.");
1831 params._recognizer_ini_file.empty() ?
1832 params._recognizer_config :
1835 std::vector<char const*> rec_overridden_keys;
1836 std::vector<double> rec_overridden_values;
1838 recognizer_config.prepare(rec_overridden_keys, rec_overridden_values);
1840 void* exception = NULL;
1842 pbio::facerec::VideoWorkerImpl*
const vw_impl =
1843 _dll_handle->FacerecService_createVideoWorker_sti_age_gender_emotions(
1846 VideoWorker::STrackingCallback,
1847 VideoWorker::STemplateCreatedCallback,
1848 VideoWorker::SMatchFoundCallback,
1849 VideoWorker::STrackingLostCallback,
1850 VideoWorker::SStiPersonOutdatedCallback,
1852 (_facerec_conf_dir + params._video_worker_config.config_filepath).c_str(),
1853 vw_overridden_keys.size(),
1854 vw_overridden_keys.empty() ? NULL : &(vw_overridden_keys[0]),
1855 vw_overridden_values.empty() ? NULL : &(vw_overridden_values[0]),
1857 (_facerec_conf_dir + recognizer_config.config_filepath).c_str(),
1858 rec_overridden_keys.size(),
1859 rec_overridden_keys.empty() ? NULL : &(rec_overridden_keys[0]),
1860 rec_overridden_values.empty() ? NULL : &(rec_overridden_values[0]),
1862 params._streams_count,
1863 params._processing_threads_count,
1864 params._matching_threads_count,
1865 params._short_time_identification_enabled,
1866 params._short_time_identification_distance_threshold,
1867 params._short_time_identification_outdate_time_seconds,
1868 params._age_gender_estimation_threads_count,
1869 params._emotions_estimation_threads_count,
1872 checkException(exception, *_dll_handle);
1874 return VideoWorker::Ptr::make(_dll_handle, vw_impl);
1881 pbio::stl_wraps::WrapIStreamImpl binary_stream_wrap(binary_stream);
1889 void* exception = NULL;
1891 pbio::facerec::RawSampleImpl*
const raw_sampl_impl =
1892 _dll_handle->FacerecService_loadRawSample(
1895 pbio::stl_wraps::WrapIStream::read_func,
1898 checkException(exception, *_dll_handle);
1900 return RawSample::Ptr::make(_dll_handle, raw_sampl_impl);
1905 pbio::stl_wraps::WrapIStream &binary_stream,
1907 const double space_translation_x,
1908 const double space_translation_y,
1909 const double space_scale)
const
1911 void* exception = NULL;
1913 const RawImage::CapiData cdata = image.makeCapiData();
1915 pbio::facerec::RawSampleImpl*
const raw_sampl_impl =
1916 _dll_handle->FacerecService_loadRawSampleWithoutImage_raw_image(
1919 pbio::stl_wraps::WrapIStream::read_func,
1926 cdata.crop_info_offset_x,
1927 cdata.crop_info_offset_y,
1928 cdata.crop_info_data_image_width,
1929 cdata.crop_info_data_image_height,
1931 space_translation_x,
1932 space_translation_y,
1937 checkException(exception, *_dll_handle);
1939 return RawSample::Ptr::make(_dll_handle, raw_sampl_impl);
1944 std::istream &binary_stream,
1946 const double space_translation_x,
1947 const double space_translation_y,
1948 const double space_scale)
const
1950 pbio::stl_wraps::WrapIStreamImpl binary_stream_wrap(binary_stream);
1955 space_translation_x,
1956 space_translation_y,
1962 pbio::stl_wraps::WrapIStream &binary_stream,
1963 const unsigned char *image_data,
1964 int image_data_size,
1965 const double space_translation_x,
1966 const double space_translation_y,
1967 const double space_scale)
const
1969 void* exception = NULL;
1971 pbio::facerec::RawSampleImpl*
const raw_sampl_impl =
1972 _dll_handle->FacerecService_loadRawSampleWithoutImage_encoded_image(
1975 pbio::stl_wraps::WrapIStream::read_func,
1980 space_translation_x,
1981 space_translation_y,
1986 checkException(exception, *_dll_handle);
1988 return RawSample::Ptr::make(_dll_handle, raw_sampl_impl);
1993 std::istream &binary_stream,
1994 const unsigned char *image_data,
1995 int image_data_size,
1996 const double space_translation_x,
1997 const double space_translation_y,
1998 const double space_scale)
const
2000 pbio::stl_wraps::WrapIStreamImpl binary_stream_wrap(binary_stream);
2007 space_translation_x,
2008 space_translation_y,
2016 void* exception = NULL;
2018 pbio::facerec::CameraCalibratorImpl*
const calibrator_impl =
2019 _dll_handle->FacerecService_createCameraCalibrator(
2023 checkException(exception, *_dll_handle);
2025 return CameraCalibrator::Ptr::make(_dll_handle, calibrator_impl);
2032 const std::string ini_file)
const
2034 const std::string file_path = _facerec_conf_dir + ini_file;
2036 void* exception = NULL;
2038 pbio::facerec::DepthLivenessEstimatorImpl*
const the_impl =
2039 _dll_handle->FacerecService_createDepthLivenessEstimatorE(
2047 checkException(exception, *_dll_handle);
2049 return DepthLivenessEstimator::Ptr::make(_dll_handle, the_impl);
2057 const std::string file_path = _facerec_conf_dir + config.config_filepath;
2059 std::vector<char const*> overridden_keys;
2060 std::vector<double> overridden_values;
2062 config.prepare(overridden_keys, overridden_values);
2064 void* exception = NULL;
2066 pbio::facerec::DepthLivenessEstimatorImpl*
const the_impl =
2067 _dll_handle->FacerecService_createDepthLivenessEstimatorE(
2070 overridden_keys.size(),
2071 overridden_keys.empty() ? NULL : &(overridden_keys[0]),
2072 overridden_values.empty() ? NULL : &(overridden_values[0]),
2075 checkException(exception, *_dll_handle);
2077 return DepthLivenessEstimator::Ptr::make(_dll_handle, the_impl);
2082 const std::string ini_file)
const
2084 const std::string file_path = _facerec_conf_dir + ini_file;
2086 void* exception = NULL;
2088 pbio::facerec::IRLivenessEstimatorImpl*
const the_impl =
2089 _dll_handle->FacerecService_createIRLivenessEstimatorE(
2097 checkException(exception, *_dll_handle);
2099 return IRLivenessEstimator::Ptr::make(_dll_handle, the_impl);
2106 const std::string file_path = _facerec_conf_dir + config.config_filepath;
2108 std::vector<char const*> overridden_keys;
2109 std::vector<double> overridden_values;
2111 config.prepare(overridden_keys, overridden_values);
2113 void* exception = NULL;
2115 pbio::facerec::IRLivenessEstimatorImpl*
const the_impl =
2116 _dll_handle->FacerecService_createIRLivenessEstimatorE(
2119 overridden_keys.size(),
2120 overridden_keys.empty() ? NULL : &(overridden_keys[0]),
2121 overridden_values.empty() ? NULL : &(overridden_values[0]),
2124 checkException(exception, *_dll_handle);
2126 return IRLivenessEstimator::Ptr::make(_dll_handle, the_impl);
2131 const std::string ini_file)
const
2133 const std::string file_path = _facerec_conf_dir + ini_file;
2135 void* exception = NULL;
2137 pbio::facerec::Liveness2DEstimatorImpl*
const the_impl =
2138 _dll_handle->FacerecService_createLiveness2DEstimatorE(
2146 checkException(exception, *_dll_handle);
2148 return Liveness2DEstimator::Ptr::make(_dll_handle, the_impl);
2155 const std::string file_path = _facerec_conf_dir + config.config_filepath;
2157 std::vector<char const*> overridden_keys;
2158 std::vector<double> overridden_values;
2160 config.prepare(overridden_keys, overridden_values);
2162 void* exception = NULL;
2164 pbio::facerec::Liveness2DEstimatorImpl*
const the_impl =
2165 _dll_handle->FacerecService_createLiveness2DEstimatorE(
2168 overridden_keys.size(),
2169 overridden_keys.empty() ? NULL : &(overridden_keys[0]),
2170 overridden_values.empty() ? NULL : &(overridden_values[0]),
2173 checkException(exception, *_dll_handle);
2175 return Liveness2DEstimator::Ptr::make(_dll_handle, the_impl);
2180 const std::string ini_file)
const
2182 const std::string file_path = _facerec_conf_dir + ini_file;
2184 void* exception = NULL;
2186 pbio::facerec::FaceAttributesEstimatorImpl*
const the_impl =
2187 _dll_handle->FacerecService_createFaceAttributesEstimator(
2195 checkException(exception, *_dll_handle);
2197 return FaceAttributesEstimator::Ptr::make(_dll_handle, the_impl);
2203 ProcessingUnit::Ptr FacerecService::createProcessingUnit(
2204 const int block_type,
2205 const char* serializedConfig)
const
2207 return ProcessingUnit::Ptr::make(_dll_handle, block_type, serializedConfig);
2210 #ifndef WITHOUT_PROCESSING_BLOCK
2211 inline Context FacerecService::createContext()
const
2216 inline Context FacerecService::createContextFromEncodedImage(
const uint8_t* data, uint64_t dataSize)
const
2218 return Context(_dll_handle, data, dataSize);
2221 inline Context FacerecService::createContextFromEncodedImage(
const std::vector<uint8_t>& data)
const
2223 return Context(_dll_handle, data.data(), data.size());
2226 inline Context FacerecService::createContextFromEncodedImage(
const std::string& data)
const
2228 return Context(_dll_handle, reinterpret_cast<const uint8_t*>(data.data()), data.size());
2231 inline Context FacerecService::createContextFromEncodedImage(
const std::vector<char>& data)
const
2233 return Context(_dll_handle, reinterpret_cast<const uint8_t*>(data.data()), data.size());
2236 inline Context FacerecService::createContextFromFrame(uint8_t* data, int32_t width, int32_t height, Context::Format format, int32_t baseAngle)
const
2238 return Context(_dll_handle, data, width, height, format, baseAngle);
2241 inline Context FacerecService::createContextFromJsonFile(
const char* path)
2243 return Context(_dll_handle, path);
2246 inline Context FacerecService::createContextFromJsonFile(std::string path)
2248 return Context(_dll_handle, path.c_str());
2262 void* exception = NULL;
2264 void* struct_storage_impl = _dll_handle->FacerecService_getLicenseState(_impl, &exception);
2266 checkException(exception, *_dll_handle);
2268 const StructStorage struct_storage(_dll_handle, struct_storage_impl);
2272 result.
online = struct_storage.get_int64(StructStorageFields::license_state_online_t);
2274 result.
android_app_id = (
char const*) struct_storage.get_pointer(StructStorageFields::license_state_android_app_id_t);
2275 result.
android_serial = (
char const*) struct_storage.get_pointer(StructStorageFields::license_state_android_serial_t);
2276 result.
ios_app_id = (
char const*) struct_storage.get_pointer(StructStorageFields::license_state_ios_app_id_t);
2277 result.
hardware_reg = (
char const*) struct_storage.get_pointer(StructStorageFields::license_state_hardware_reg_t);
2279 result.
counters.resize( struct_storage.get_int64(
2280 StructStorageFields::license_state_licenses_count_t) );
2282 for(
size_t i = 0; i < result.
counters.size(); ++i)
2284 result.
counters[i].name = (
char const*) struct_storage.get_pointer(
2285 (i << 16) |
size_t(StructStorageFields::license_state_licenses_names_int16_t) );
2287 result.
counters[i].max_value = struct_storage.get_int64(
2288 (i << 16) |
size_t(StructStorageFields::license_state_licenses_total_counts_int16_t) );
2290 result.
counters[i].value = struct_storage.get_int64(
2291 (i << 16) |
size_t(StructStorageFields::license_state_licenses_in_use_counts_int16_t) );
2301 void* exception = NULL;
2303 _dll_handle->FacerecService_toggleAlgorithmsCacheKepp(1, &exception);
2305 checkException(exception, *_dll_handle);
2311 void* exception = NULL;
2313 _dll_handle->FacerecService_toggleAlgorithmsCacheKepp(0, &exception);
2315 checkException(exception, *_dll_handle);
2326 void* exception = NULL;
2330 void* imagetptr_ptr;
2332 void*
const the_impl = _dll_handle->InternalImageBuffer_constructor(
2341 checkException(exception, *_dll_handle);
2343 return InternalImageBuffer::Ptr::make(
2346 (
unsigned char*) data_ptr,
2359 jobject android_media_image)
2361 void* exception = NULL;
2368 void* imagetptr_ptr;
2370 void*
const the_impl = _dll_handle->InternalImageBuffer_constructor_from_android_image(
2372 android_media_image,
2381 checkException(exception, *_dll_handle);
2383 return InternalImageBuffer::Ptr::make(
2386 (
unsigned char*) data_ptr,
2398 const bool downscale_x2,
2399 void*
const result_buffer)
2401 void* exception = NULL;
2403 const RawImage::CapiData cdata = image.makeCapiData();
2405 _dll_handle->RawImage_convertYUV2ARGB(
2411 cdata.crop_info_offset_x,
2412 cdata.crop_info_offset_y,
2413 cdata.crop_info_data_image_width,
2414 cdata.crop_info_data_image_height,
2419 checkException(exception, *_dll_handle);
2423 void FacerecService::convertYUV2RGB(
2425 const bool downscale_x2,
2426 const int base_angle,
2427 void*
const result_buffer)
2429 void* exception = NULL;
2431 const RawImage::CapiData cdata = image.makeCapiData();
2433 _dll_handle->RawImage_convertYUV2RGB(
2439 cdata.crop_info_offset_x,
2440 cdata.crop_info_offset_y,
2441 cdata.crop_info_data_image_width,
2442 cdata.crop_info_data_image_height,
2448 checkException(exception, *_dll_handle);
2452 void FacerecService::convertBGRA88882RGB(
2454 const bool downscale_x2,
2455 const int base_angle,
2456 void*
const result_buffer)
2458 void* exception = NULL;
2460 const RawImage::CapiData cdata = image.makeCapiData();
2462 _dll_handle->RawImage_convertYUV2RGB(
2468 cdata.crop_info_offset_x,
2469 cdata.crop_info_offset_y,
2470 cdata.crop_info_data_image_width,
2471 cdata.crop_info_data_image_height,
2477 checkException(exception, *_dll_handle);
2486 #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:1798
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:1424
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:2179
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:2081
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:1669
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:2396
CameraCalibrator::Ptr createCameraCalibrator() const
Creates a CameraCalibrator object. Thread-safe.
Definition: FacerecService.h:2014
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:1550
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:1538
AgeGenderEstimator::Ptr createAgeGenderEstimator(const std::string ini_file) const
Creates a AgeGenderEstimator object. Thread-safe.
Definition: FacerecService.h:1577
void freeAlgorithmsCache() const
Disable keeping algorithms data in memory. Thread-safe.
Definition: FacerecService.h:2309
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:2321
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:2299
Liveness2DEstimator::Ptr createLiveness2DEstimator(const std::string ini_file) const
Creates an Liveness2DEstimator object. Thread-safe.
Definition: FacerecService.h:2130
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:1615
std::string getVersion() const
Get version of face recognition library. Thread-safe.
Definition: FacerecService.h:1519
QualityEstimator::Ptr createQualityEstimator(const std::string ini_file) const
Creates a QualityEstimator object. Thread-safe.
Definition: FacerecService.h:1596
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:2260
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:1879
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:1904
EmotionsEstimator::Ptr createEmotionsEstimator(const std::string ini_file) const
Creates a EmotionsEstimator object. Thread-safe.
Definition: FacerecService.h:1649
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:1633
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:2031
License status.
Definition: FacerecService.h:97
LightSmartPtr< DepthLivenessEstimator >::tPtr Ptr
Alias for the type of a smart pointer to DepthLivenessEstimator.
Definition: DepthLivenessEstimator.h:43