3DiVi Face SDK  3.25.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Groups
FacerecService.h
1 
9 #ifndef __PBIO_API__PBIO__FACEREC_SERVICE_H_
10 #define __PBIO_API__PBIO__FACEREC_SERVICE_H_
11 
12 
13 #include <istream>
14 #include <stdexcept>
15 #include <utility>
16 #include <vector>
17 #include <facerec/libfacerec.h>
18 
19 #ifdef ANDROID
20 #include <jni.h>
21 #endif
22 
23 #include "stl_wraps_impls/WrapIStreamImpl.h"
24 #include "stl_wraps_impls/WrapOStreamImpl.h"
25 
26 
27 #include "AgeGenderEstimator.h"
28 #include "CameraCalibrator.h"
29 #include "Capturer.h"
30 #include "ComplexObject.h"
31 #include "DepthLivenessEstimator.h"
32 #include "IRLivenessEstimator.h"
33 #include "ActiveLiveness.h"
34 #include "Liveness2DEstimator.h"
36 #include "EmotionsEstimator.h"
37 #include "Error.h"
38 #include "ExceptionCheck.h"
39 #include "FaceQualityEstimator.h"
40 #include "LivenessEstimator.h"
41 #include "QualityEstimator.h"
42 #include "RawSample.h"
43 #include "Recognizer.h"
44 #include "SmartPtr.h"
45 #include "Template.h"
46 #include "VideoWorker.h"
47 #include "StructStorage.h"
48 #include "Config.h"
49 #include "ProcessingUnit.h"
50 
51 #ifndef WITHOUT_PROCESSING_BLOCK
52 #include "Context.h"
53 #include "ProcessingBlock.h"
54 #endif
55 
56 namespace pbio
57 {
58 
64 class FacerecService : ComplexObject
65 {
66 public:
67 
73  typedef LightSmartPtr<FacerecService>::tPtr Ptr;
74 
75  typedef pbio::Config Config;
76 
81  struct License
82  {
87  const std::string license_body;
88 
89  License(std::string license_body) : license_body(license_body) { }
90  };
91 
97  struct LicenseState
98  {
104  {
109  std::string name;
110 
115  int64_t max_value;
116 
121  int64_t value;
122  };
123 
128  bool online;
129 
130 
135  std::string android_app_id;
136 
141  std::string android_serial;
142 
147  std::string ios_app_id;
148 
153  std::string hardware_reg;
154 
159  std::vector<CounterState> counters;
160  };
161 
200  const std::string dll_path,
201  std::string facerec_conf_dir,
202  const std::string license_dir = std::string());
203 
238  const std::string dll_path,
239  std::string facerec_conf_dir,
240  const pbio::FacerecService::License license);
241 
243 
244  // internal usage only
246  void* const ae_ptr,
247  const std::string dll_path,
248  std::string facerec_conf_dir,
249  const std::string license,
250  const bool is_license_dir);
251 
253 
254 
272  std::string getVersion() const;
273 
283  void forceOnlineLicenseUpdate() const;
284 
311 
335  AgeGenderEstimator::Ptr createAgeGenderEstimator(const std::string ini_file) const;
336 
360  QualityEstimator::Ptr createQualityEstimator(const std::string ini_file) const;
361 
385  FaceQualityEstimator::Ptr createFaceQualityEstimator(const std::string ini_file) const;
386 
405 
429  EmotionsEstimator::Ptr createEmotionsEstimator(const std::string ini_file) const;
430 
475  const char* ini_file,
476  const bool processing = true,
477  const bool matching = true,
478  const bool processing_less_memory_consumption = false) const;
479 
480 
481 #ifndef WITHOUT_PROCESSING_BLOCK
482  DynamicTemplateIndex::Ptr createDynamicTemplateIndex(
483  const std::vector<pbio::ContextTemplate::Ptr>& templates,
484  const std::vector<std::string>& uuids,
485  const Context& config) const;
486 
487  DynamicTemplateIndex::Ptr createDynamicTemplateIndex(const Context& config) const;
488 
489  ContextTemplate::Ptr loadContextTemplate(std::istream& stream) const;
490 
491  ContextTemplate::Ptr loadContextTemplate(pbio::stl_wraps::WrapIStream &stream) const;
492 
493  ContextTemplate::Ptr convertTemplate(const pbio::Context& templateContext) const;
494 #endif
495 
540  const pbio::FacerecService::Config recognizer_config,
541  const bool processing = true,
542  const bool matching = true,
543  const bool processing_less_memory_consumption = false) const;
544 
577  const pbio::VideoWorker::Params params) const;
578 
579 
622  const pbio::FacerecService::Config video_worker_config,
623  const char* recognizer_ini_file,
624  const int streams_count,
625  const int processing_threads_count,
626  const int matching_threads_count) const;
627 
628 
671  const pbio::FacerecService::Config video_worker_config,
672  const pbio::FacerecService::Config recognizer_config,
673  const int streams_count,
674  const int processing_threads_count,
675  const int matching_threads_count) const;
676 
677 
678 
706  RawSample::Ptr loadRawSample(std::istream &binary_stream) const;
707 
735  RawSample::Ptr loadRawSample(pbio::stl_wraps::WrapIStream &binary_stream) const;
736 
737 
801  pbio::stl_wraps::WrapIStream &binary_stream,
802  const RawImage image,
803  const double space_translation_x = 0,
804  const double space_translation_y = 0,
805  const double space_scale = 1) const;
806 
811  std::istream &binary_stream,
812  const RawImage image,
813  const double space_translation_x = 0,
814  const double space_translation_y = 0,
815  const double space_scale = 1) const;
816 
871  pbio::stl_wraps::WrapIStream &binary_stream,
872  const unsigned char *image_data,
873  int image_data_size,
874  const double space_translation_x = 0,
875  const double space_translation_y = 0,
876  const double space_scale = 1) const;
877 
883  std::istream &binary_stream,
884  const unsigned char *image_data,
885  int image_data_size,
886  const double space_translation_x = 0,
887  const double space_translation_y = 0,
888  const double space_scale = 1) const;
889 
890 
909 
910 
935  const std::string ini_file) const;
936 
937 
962  const pbio::FacerecService::Config config) const;
963 
964 
989  const std::string ini_file) const;
990 
991 
1016  const pbio::FacerecService::Config config) const;
1017 
1018 
1043  const std::string ini_file) const;
1044 
1045 
1070  const pbio::FacerecService::Config config) const;
1071 
1096  const std::string ini_file) const;
1097 
1099 
1100  ProcessingUnit::Ptr createProcessingUnit(
1101  const int block_type,
1102  const char* serializedConfig) const;
1103 
1104 #ifndef WITHOUT_PROCESSING_BLOCK
1105 
1113  Context createContext() const;
1114 
1127  Context createContextFromEncodedImage(const uint8_t* data, uint64_t dataSize) const;
1128 
1139  Context createContextFromEncodedImage(const std::vector<uint8_t>& data) const;
1140 
1151  Context createContextFromEncodedImage(const std::string& data) const;
1152 
1153  Context createContextFromEncodedImage(const std::vector<char>& data) const;
1154 
1173  Context createContextFromFrame(uint8_t* data, int32_t width, int32_t height, Context::Format format = Context::Format::FORMAT_BGR, int32_t baseAngle = 0) const;
1174 
1175  Context createContextFromJsonFile(const char* path);
1176 
1187  Context createContextFromJsonFile(std::string path);
1188 
1199  ProcessingBlock createProcessingBlock(const Context& config) const;
1200 #endif
1201 
1203 
1221  LicenseState getLicenseState() const;
1222 
1223 
1237  void keepAlgorithmsCache() const;
1238 
1250  void freeAlgorithmsCache() const;
1251 
1252 
1293  const int width,
1294  const int height,
1295  const RawImage::Format format);
1296 
1297 
1298 #ifdef ANDROID
1299 
1339  JNIEnv *env,
1340  jobject android_media_image);
1341 #endif // ifdef ANDROID
1342 
1343 
1384  void convertYUV2ARGB(
1385  const RawImage image,
1386  const bool downscale_x2,
1387  void* const result_buffer);
1388 
1389 
1390  void convertYUV2RGB(
1391  const RawImage image,
1392  const bool downscale_x2,
1393  const int base_angle,
1394  void* const result_buffer);
1395 
1396 
1397  void convertBGRA88882RGB(
1398  const RawImage image,
1399  const bool downscale_x2,
1400  const int base_angle,
1401  void* const result_buffer);
1402 
1403 
1404 private:
1405 
1406  const std::string _facerec_conf_dir;
1407 
1408  friend class object_with_ref_counter<FacerecService>;
1409 protected:
1411  const DHPtr &dll_handle,
1412  const std::string &facerec_conf_dir,
1413  void* impl);
1414 };
1415 
1416 } // pbio namespace
1417 
1418 
1419 
1420 
1424 
1425 
1426 namespace pbio
1427 {
1428 
1429 
1430 // static
1431 inline
1433  const std::string dll_path,
1434  std::string facerec_conf_dir,
1435  const std::string license_dir)
1436 {
1437  return createService(NULL, dll_path, facerec_conf_dir, license_dir, true);
1438 }
1439 
1440 // static
1441 inline
1443  const std::string dll_path,
1444  std::string facerec_conf_dir,
1445  const pbio::FacerecService::License license)
1446 {
1447  return createService(NULL, dll_path, facerec_conf_dir, license.license_body, false);
1448 }
1449 
1450 // static
1451 inline
1453  void* const ae_ptr,
1454  const std::string dll_path,
1455  std::string facerec_conf_dir,
1456  const std::string license,
1457  const bool is_license_dir)
1458 {
1459 
1460 #ifdef __STATIC_LIBFACEREC_BUILD__
1461  (void) dll_path;
1462 
1463  const DHPtr dll_handle( DHPtr::make() );
1464 #else
1465  const DHPtr dll_handle( DHPtr::make(dll_path.c_str()) );
1466 #endif
1467 
1468  if(facerec_conf_dir.empty())
1469  {
1470  facerec_conf_dir = "./";
1471  }
1472  else if(facerec_conf_dir[facerec_conf_dir.length() - 1] != '/')
1473  {
1474  facerec_conf_dir += '/';
1475  }
1476 
1477  void* exception = NULL;
1478 
1479  void* the_impl;
1480 
1481  if (is_license_dir)
1482  {
1483  the_impl = dll_handle->FacerecService_constructor3(
1484  ae_ptr,
1485  facerec_conf_dir.c_str(),
1486  license.empty() ?
1487  NULL :
1488  license.c_str(),
1489  dll_path.c_str(),
1490  &exception);
1491  }else
1492  {
1493  the_impl = dll_handle->FacerecService_constructor5(
1494  ae_ptr,
1495  facerec_conf_dir.c_str(),
1496  license.c_str(),
1497  dll_path.c_str(),
1498  &exception);
1499  }
1500 
1501  checkException(exception, *dll_handle);
1502 
1503  return FacerecService::Ptr::make(
1504  dll_handle,
1505  facerec_conf_dir,
1506  the_impl);
1507 }
1508 
1509 
1510 inline
1511 FacerecService::FacerecService(
1512  const DHPtr &dll_handle,
1513  const std::string &facerec_conf_dir,
1514  void* impl):
1515 ComplexObject(dll_handle, impl),
1516 _facerec_conf_dir(facerec_conf_dir)
1517 {
1518  std::string lib_version = getVersion();
1519 
1520  if (LIBFACEREC_VERSION != lib_version)
1521  std::cerr << "WARNING: The version in the header does not match the version in the library. Header version: "
1522  << LIBFACEREC_VERSION << ", library version: " << lib_version << std::endl;
1523 }
1524 
1525 
1526 inline
1527 std::string FacerecService::getVersion() const
1528 {
1529  std::ostringstream version_stream;
1530  pbio::stl_wraps::WrapOStreamImpl version_stream_wrap(version_stream);
1531 
1532  void* exception = NULL;
1533 
1534  _dll_handle->get_version(
1535  &version_stream_wrap,
1536  pbio::stl_wraps::WrapOStream::write_func,
1537  &exception);
1538 
1539  checkException(exception, *_dll_handle);
1540 
1541  return version_stream.str();
1542 }
1543 
1544 
1545 inline
1547 {
1548  void* exception = NULL;
1549 
1550  _dll_handle->FacerecService_forceOnlineLicenseUpdate(
1551  _impl,
1552  &exception);
1553 
1554  checkException(exception, *_dll_handle);
1555 }
1556 
1557 inline
1559  const pbio::FacerecService::Config config) const
1560 {
1561  const std::string file_path = _facerec_conf_dir + config.config_filepath;
1562 
1563  std::vector<char const*> overridden_keys;
1564  std::vector<double> overridden_values;
1565 
1566  config.prepare(overridden_keys, overridden_values);
1567 
1568  void* exception = NULL;
1569 
1570  pbio::facerec::CapturerImpl* const capturer_impl =
1571  _dll_handle->FacerecService_createCapturerE(
1572  _impl,
1573  file_path.c_str(),
1574  overridden_keys.size(),
1575  overridden_keys.empty() ? NULL : &(overridden_keys[0]),
1576  overridden_values.empty() ? NULL : &(overridden_values[0]),
1577  &exception);
1578 
1579  checkException(exception, *_dll_handle);
1580 
1581  return Capturer::Ptr::make(_dll_handle, capturer_impl);
1582 }
1583 
1584 inline
1586 {
1587  const std::string file_path = _facerec_conf_dir + ini_file;
1588 
1589  void* exception = NULL;
1590 
1591  pbio::facerec::AgeGenderEstimatorImpl* const the_impl =
1592  _dll_handle->FacerecService_createAgeGenderEstimator(
1593  _impl,
1594  file_path.c_str(),
1595  &exception);
1596 
1597  checkException(exception, *_dll_handle);
1598 
1599  return AgeGenderEstimator::Ptr::make(_dll_handle, the_impl);
1600 }
1601 
1602 
1603 inline
1605 {
1606  const std::string file_path = _facerec_conf_dir + ini_file;
1607 
1608  void* exception = NULL;
1609 
1610  pbio::facerec::QualityEstimatorImpl* const the_impl =
1611  _dll_handle->FacerecService_createQualityEstimator(
1612  _impl,
1613  file_path.c_str(),
1614  &exception);
1615 
1616  checkException(exception, *_dll_handle);
1617 
1618  return QualityEstimator::Ptr::make(_dll_handle, the_impl);
1619 }
1620 
1621 
1622 inline
1624 {
1625  const std::string file_path = _facerec_conf_dir + ini_file;
1626 
1627  void* exception = NULL;
1628 
1629  pbio::facerec::FaceQualityEstimatorImpl* const the_impl =
1630  _dll_handle->FacerecService_createFaceQualityEstimator(
1631  _impl,
1632  file_path.c_str(),
1633  &exception);
1634 
1635  checkException(exception, *_dll_handle);
1636 
1637  return FaceQualityEstimator::Ptr::make(_dll_handle, the_impl);
1638 }
1639 
1640 inline
1642 {
1643  void* exception = NULL;
1644 
1645  pbio::facerec::LivenessEstimatorImpl* const the_impl =
1646  _dll_handle->FacerecService_createLivenessEstimator(
1647  _impl,
1648  &exception);
1649 
1650  checkException(exception, *_dll_handle);
1651 
1652  return LivenessEstimator::Ptr::make(_dll_handle, the_impl);
1653 }
1654 
1655 
1656 inline
1658  const std::string ini_file) const
1659 {
1660  const std::string file_path = _facerec_conf_dir + ini_file;
1661 
1662  void* exception = NULL;
1663 
1664  pbio::facerec::EmotionsEstimatorImpl* const the_impl =
1665  _dll_handle->FacerecService_createEmotionsEstimator(
1666  _impl,
1667  file_path.c_str(),
1668  &exception);
1669 
1670  checkException(exception, *_dll_handle);
1671 
1672  return EmotionsEstimator::Ptr::make(_dll_handle, the_impl);
1673 }
1674 
1675 
1676 inline
1678  const char* ini_file,
1679  const bool processing,
1680  const bool matching,
1681  const bool processing_less_memory_consumption) const
1682 {
1683  const std::string file_path = _facerec_conf_dir + ini_file;
1684 
1685  void* exception = NULL;
1686 
1687  pbio::facerec::RecognizerImpl* const recognizer_impl =
1688  _dll_handle->FacerecService_createRecognizer2(
1689  _impl,
1690  file_path.c_str(),
1691  0,
1692  NULL,
1693  NULL,
1694  (int) processing,
1695  (int) matching,
1696  (int) processing_less_memory_consumption,
1697  &exception);
1698 
1699  checkException(exception, *_dll_handle);
1700 
1701  return Recognizer::Ptr::make(_dll_handle, recognizer_impl);
1702 }
1703 
1704 #ifndef WITHOUT_PROCESSING_BLOCK
1705 inline DynamicTemplateIndex::Ptr FacerecService::createDynamicTemplateIndex(
1706  const std::vector<pbio::ContextTemplate::Ptr>& templates,
1707  const std::vector<std::string>& uuids,
1708  const Context& config
1709 ) const
1710 {
1711  void* exception = nullptr;
1712 
1713  std::vector<const void*> tempTemplates;
1714  std::vector<const char*> tempUuids;
1715 
1716  tempTemplates.reserve(templates.size());
1717  tempUuids.reserve(uuids.size());
1718 
1719  std::transform
1720  (
1721  templates.begin(), templates.end(), std::back_inserter(tempTemplates),
1722  [](pbio::ContextTemplate::Ptr templ) { return templ->_impl; }
1723  );
1724  std::transform(uuids.begin(), uuids.end(), std::back_inserter(tempUuids), [](const std::string& uuid) { return uuid.data(); });
1725 
1726  void* indexImplementation = _dll_handle->FacerecService_createDynamicTemplateIndex_1
1727  (
1728  _impl,
1729  tempTemplates.data(),
1730  tempUuids.data(),
1731  templates.size(),
1732  config.getHandle(),
1733  &exception
1734  );
1735 
1736  checkException(exception, *_dll_handle);
1737 
1738  return DynamicTemplateIndex::Ptr::make(_dll_handle, indexImplementation);
1739 }
1740 
1741 inline DynamicTemplateIndex::Ptr FacerecService::createDynamicTemplateIndex(const Context& config) const
1742 {
1743  void* exception = nullptr;
1744 
1745  void* indexImplementation = _dll_handle->FacerecService_createDynamicTemplateIndex_2(_impl, config.getHandle(), &exception);
1746 
1747  checkException(exception, *_dll_handle);
1748 
1749  return DynamicTemplateIndex::Ptr::make(_dll_handle, indexImplementation);
1750 }
1751 
1752 inline ContextTemplate::Ptr FacerecService::loadContextTemplate(std::istream& stream) const
1753 {
1754  pbio::stl_wraps::WrapIStreamImpl streamWrap(stream);
1755  return loadContextTemplate(streamWrap);
1756 }
1757 
1758 inline ContextTemplate::Ptr FacerecService::loadContextTemplate(pbio::stl_wraps::WrapIStream& stream) const
1759 {
1760  void* exception = nullptr;
1761  void* templateImplementation = _dll_handle->ContextTemplate_loadTemplate(&stream, pbio::stl_wraps::WrapIStream::read_func, &exception);
1762 
1763  checkException(exception, *_dll_handle);
1764 
1765  return ContextTemplate::Ptr::make(_dll_handle, templateImplementation);
1766 }
1767 
1768 inline ContextTemplate::Ptr FacerecService::convertTemplate(const pbio::Context& templateContext) const
1769 {
1770  void* exception = nullptr;
1771  void* templateImplementation = _dll_handle->ContextTemplate_convert(templateContext.handle_, &exception);
1772 
1773  checkException(exception, *_dll_handle);
1774 
1775  return ContextTemplate::Ptr::make(_dll_handle, templateImplementation);
1776 }
1777 #endif
1778 
1779 inline
1781  const pbio::FacerecService::Config recognizer_config,
1782  const bool processing,
1783  const bool matching,
1784  const bool processing_less_memory_consumption) const
1785 {
1786  const std::string file_path = _facerec_conf_dir + recognizer_config.config_filepath;
1787 
1788  std::vector<char const*> overridden_keys;
1789  std::vector<double> overridden_values;
1790 
1791  recognizer_config.prepare(overridden_keys, overridden_values);
1792 
1793  void* exception = NULL;
1794 
1795  pbio::facerec::RecognizerImpl* const recognizer_impl =
1796  _dll_handle->FacerecService_createRecognizer2(
1797  _impl,
1798  file_path.c_str(),
1799  overridden_keys.size(),
1800  overridden_keys.empty() ? NULL : &(overridden_keys[0]),
1801  overridden_values.empty() ? NULL : &(overridden_values[0]),
1802  (int) processing,
1803  (int) matching,
1804  (int) processing_less_memory_consumption,
1805  &exception);
1806 
1807  checkException(exception, *_dll_handle);
1808 
1809  return Recognizer::Ptr::make(_dll_handle, recognizer_impl);
1810 }
1811 
1812 
1813 
1814 inline
1816  const pbio::FacerecService::Config video_worker_ini_file,
1817  const char* recognizer_ini_file,
1818  const int streams_count,
1819  const int processing_threads_count,
1820  const int matching_threads_count) const
1821 {
1822  return createVideoWorker(
1824  .video_worker_config(video_worker_ini_file)
1825  .recognizer_ini_file(recognizer_ini_file)
1826  .streams_count(streams_count)
1827  .processing_threads_count(processing_threads_count)
1828  .matching_threads_count(matching_threads_count)
1829  );
1830 }
1831 
1832 inline
1834  const pbio::FacerecService::Config video_worker_ini_file,
1835  const pbio::FacerecService::Config recognizer_config,
1836  const int streams_count,
1837  const int processing_threads_count,
1838  const int matching_threads_count) const
1839 {
1840  return createVideoWorker(
1842  .video_worker_config(video_worker_ini_file)
1843  .recognizer_config(recognizer_config)
1844  .streams_count(streams_count)
1845  .processing_threads_count(processing_threads_count)
1846  .matching_threads_count(matching_threads_count)
1847  );
1848 }
1849 
1850 inline
1852  const VideoWorker::Params params) const
1853 {
1854  std::vector<char const*> vw_overridden_keys;
1855  std::vector<double> vw_overridden_values;
1856 
1857  params._video_worker_config.prepare(vw_overridden_keys, vw_overridden_values);
1858  std::vector<std::string> extra_over_params;
1859 
1860  if(!params._active_liveness_checks_order.empty()){
1861  bool is_unique = true;
1862  for (auto it = params._active_liveness_checks_order.begin(); it != params._active_liveness_checks_order.end(); ++it)
1863  if (std::find(it + 1, params._active_liveness_checks_order.end(), *it) != params._active_liveness_checks_order.end()) {
1864  is_unique = false;
1865  break;
1866  }
1867  if(!is_unique)
1868  throw pbio::Error(0x3302330e,
1869  "Error 0x3302330e: Set a unique order of `active_liveness_checks_order` for Active Liveness.");
1870  for (size_t i = 0; i < params._active_liveness_checks_order.size(); i++){
1871  ActiveLiveness::CheckType check = params._active_liveness_checks_order[i];
1872  std::string check_str = ActiveLiveness::CheckTypeToString(check);
1873  extra_over_params.push_back("active_liveness.check_" + check_str);
1874  vw_overridden_keys.push_back(extra_over_params.back().c_str());
1875  vw_overridden_values.push_back(-(double)(i+1));
1876  }
1877  }
1878 
1879 
1880  if (!params._recognizer_ini_file.empty() && !params._recognizer_config.config_filepath.empty())
1881  throw pbio::Error(0xb3fe4d07, "Error: 0xed877a99 You must use either recognizer_config or recognizer_ini_file.");
1882 
1883  pbio::FacerecService::Config recognizer_config =
1884  params._recognizer_ini_file.empty() ?
1885  params._recognizer_config :
1886  pbio::FacerecService::Config(params._recognizer_ini_file);
1887 
1888  std::vector<char const*> rec_overridden_keys;
1889  std::vector<double> rec_overridden_values;
1890 
1891  recognizer_config.prepare(rec_overridden_keys, rec_overridden_values);
1892 
1893  void* exception = NULL;
1894 
1895  pbio::facerec::VideoWorkerImpl* const vw_impl =
1896  _dll_handle->FacerecService_createVideoWorker_sti_age_gender_emotions(
1897  _impl,
1898 
1899  VideoWorker::STrackingCallback,
1900  VideoWorker::STemplateCreatedCallback,
1901  VideoWorker::SMatchFoundCallback,
1902  VideoWorker::STrackingLostCallback,
1903  VideoWorker::SStiPersonOutdatedCallback,
1904 
1905  (_facerec_conf_dir + params._video_worker_config.config_filepath).c_str(),
1906  vw_overridden_keys.size(),
1907  vw_overridden_keys.empty() ? NULL : &(vw_overridden_keys[0]),
1908  vw_overridden_values.empty() ? NULL : &(vw_overridden_values[0]),
1909 
1910  (_facerec_conf_dir + recognizer_config.config_filepath).c_str(),
1911  rec_overridden_keys.size(),
1912  rec_overridden_keys.empty() ? NULL : &(rec_overridden_keys[0]),
1913  rec_overridden_values.empty() ? NULL : &(rec_overridden_values[0]),
1914 
1915  params._streams_count,
1916  params._processing_threads_count,
1917  params._matching_threads_count,
1918  params._short_time_identification_enabled,
1919  params._short_time_identification_distance_threshold,
1920  params._short_time_identification_outdate_time_seconds,
1921  params._age_gender_estimation_threads_count,
1922  params._emotions_estimation_threads_count,
1923  &exception);
1924 
1925  checkException(exception, *_dll_handle);
1926 
1927  return VideoWorker::Ptr::make(_dll_handle, vw_impl);
1928 }
1929 
1930 
1931 inline
1932 RawSample::Ptr FacerecService::loadRawSample(std::istream &binary_stream) const
1933 {
1934  pbio::stl_wraps::WrapIStreamImpl binary_stream_wrap(binary_stream);
1935 
1936  return loadRawSample(binary_stream_wrap);
1937 }
1938 
1939 inline
1940 RawSample::Ptr FacerecService::loadRawSample(pbio::stl_wraps::WrapIStream &binary_stream) const
1941 {
1942  void* exception = NULL;
1943 
1944  pbio::facerec::RawSampleImpl* const raw_sampl_impl =
1945  _dll_handle->FacerecService_loadRawSample(
1946  _impl,
1947  &binary_stream,
1948  pbio::stl_wraps::WrapIStream::read_func,
1949  &exception);
1950 
1951  checkException(exception, *_dll_handle);
1952 
1953  return RawSample::Ptr::make(_dll_handle, raw_sampl_impl);
1954 }
1955 
1956 inline
1958  pbio::stl_wraps::WrapIStream &binary_stream,
1959  const RawImage image,
1960  const double space_translation_x,
1961  const double space_translation_y,
1962  const double space_scale) const
1963 {
1964  void* exception = NULL;
1965 
1966  const RawImage::CapiData cdata = image.makeCapiData();
1967 
1968  pbio::facerec::RawSampleImpl* const raw_sampl_impl =
1969  _dll_handle->FacerecService_loadRawSampleWithoutImage_raw_image(
1970  _impl,
1971  &binary_stream,
1972  pbio::stl_wraps::WrapIStream::read_func,
1973 
1974  cdata.data,
1975  cdata.width,
1976  cdata.height,
1977  cdata.format,
1978  cdata.with_crop,
1979  cdata.crop_info_offset_x,
1980  cdata.crop_info_offset_y,
1981  cdata.crop_info_data_image_width,
1982  cdata.crop_info_data_image_height,
1983 
1984  space_translation_x,
1985  space_translation_y,
1986  space_scale,
1987 
1988  &exception);
1989 
1990  checkException(exception, *_dll_handle);
1991 
1992  return RawSample::Ptr::make(_dll_handle, raw_sampl_impl);
1993 }
1994 
1995 inline
1997  std::istream &binary_stream,
1998  const RawImage image,
1999  const double space_translation_x,
2000  const double space_translation_y,
2001  const double space_scale) const
2002 {
2003  pbio::stl_wraps::WrapIStreamImpl binary_stream_wrap(binary_stream);
2004 
2006  binary_stream_wrap,
2007  image,
2008  space_translation_x,
2009  space_translation_y,
2010  space_scale);
2011 }
2012 
2013 inline
2015  pbio::stl_wraps::WrapIStream &binary_stream,
2016  const unsigned char *image_data,
2017  int image_data_size,
2018  const double space_translation_x,
2019  const double space_translation_y,
2020  const double space_scale) const
2021 {
2022  void* exception = NULL;
2023 
2024  pbio::facerec::RawSampleImpl* const raw_sampl_impl =
2025  _dll_handle->FacerecService_loadRawSampleWithoutImage_encoded_image(
2026  _impl,
2027  &binary_stream,
2028  pbio::stl_wraps::WrapIStream::read_func,
2029 
2030  image_data,
2031  image_data_size,
2032 
2033  space_translation_x,
2034  space_translation_y,
2035  space_scale,
2036 
2037  &exception);
2038 
2039  checkException(exception, *_dll_handle);
2040 
2041  return RawSample::Ptr::make(_dll_handle, raw_sampl_impl);
2042 }
2043 
2044 inline
2046  std::istream &binary_stream,
2047  const unsigned char *image_data,
2048  int image_data_size,
2049  const double space_translation_x,
2050  const double space_translation_y,
2051  const double space_scale) const
2052 {
2053  pbio::stl_wraps::WrapIStreamImpl binary_stream_wrap(binary_stream);
2054 
2055 
2057  binary_stream_wrap,
2058  image_data,
2059  image_data_size,
2060  space_translation_x,
2061  space_translation_y,
2062  space_scale);
2063 }
2064 
2065 
2066 inline
2068 {
2069  void* exception = NULL;
2070 
2071  pbio::facerec::CameraCalibratorImpl* const calibrator_impl =
2072  _dll_handle->FacerecService_createCameraCalibrator(
2073  _impl,
2074  &exception);
2075 
2076  checkException(exception, *_dll_handle);
2077 
2078  return CameraCalibrator::Ptr::make(_dll_handle, calibrator_impl);
2079 }
2080 
2081 
2082 
2083 inline
2085  const std::string ini_file) const
2086 {
2087  const std::string file_path = _facerec_conf_dir + ini_file;
2088 
2089  void* exception = NULL;
2090 
2091  pbio::facerec::DepthLivenessEstimatorImpl* const the_impl =
2092  _dll_handle->FacerecService_createDepthLivenessEstimatorE(
2093  _impl,
2094  file_path.c_str(),
2095  0, // overridden keys size
2096  NULL, // overridden keys
2097  NULL, // overriden values
2098  &exception);
2099 
2100  checkException(exception, *_dll_handle);
2101 
2102  return DepthLivenessEstimator::Ptr::make(_dll_handle, the_impl);
2103 }
2104 
2105 
2106 inline
2108  const pbio::FacerecService::Config config) const
2109 {
2110  const std::string file_path = _facerec_conf_dir + config.config_filepath;
2111 
2112  std::vector<char const*> overridden_keys;
2113  std::vector<double> overridden_values;
2114 
2115  config.prepare(overridden_keys, overridden_values);
2116 
2117  void* exception = NULL;
2118 
2119  pbio::facerec::DepthLivenessEstimatorImpl* const the_impl =
2120  _dll_handle->FacerecService_createDepthLivenessEstimatorE(
2121  _impl,
2122  file_path.c_str(),
2123  overridden_keys.size(),
2124  overridden_keys.empty() ? NULL : &(overridden_keys[0]),
2125  overridden_values.empty() ? NULL : &(overridden_values[0]),
2126  &exception);
2127 
2128  checkException(exception, *_dll_handle);
2129 
2130  return DepthLivenessEstimator::Ptr::make(_dll_handle, the_impl);
2131 }
2132 
2133 inline
2135  const std::string ini_file) const
2136 {
2137  const std::string file_path = _facerec_conf_dir + ini_file;
2138 
2139  void* exception = NULL;
2140 
2141  pbio::facerec::IRLivenessEstimatorImpl* const the_impl =
2142  _dll_handle->FacerecService_createIRLivenessEstimatorE(
2143  _impl,
2144  file_path.c_str(),
2145  0, // overridden keys size
2146  NULL, // overridden keys
2147  NULL, // overriden values
2148  &exception);
2149 
2150  checkException(exception, *_dll_handle);
2151 
2152  return IRLivenessEstimator::Ptr::make(_dll_handle, the_impl);
2153 }
2154 
2155 inline
2157  const pbio::FacerecService::Config config) const
2158 {
2159  const std::string file_path = _facerec_conf_dir + config.config_filepath;
2160 
2161  std::vector<char const*> overridden_keys;
2162  std::vector<double> overridden_values;
2163 
2164  config.prepare(overridden_keys, overridden_values);
2165 
2166  void* exception = NULL;
2167 
2168  pbio::facerec::IRLivenessEstimatorImpl* const the_impl =
2169  _dll_handle->FacerecService_createIRLivenessEstimatorE(
2170  _impl,
2171  file_path.c_str(),
2172  overridden_keys.size(),
2173  overridden_keys.empty() ? NULL : &(overridden_keys[0]),
2174  overridden_values.empty() ? NULL : &(overridden_values[0]),
2175  &exception);
2176 
2177  checkException(exception, *_dll_handle);
2178 
2179  return IRLivenessEstimator::Ptr::make(_dll_handle, the_impl);
2180 }
2181 
2182 inline
2184  const std::string ini_file) const
2185 {
2186  const std::string file_path = _facerec_conf_dir + ini_file;
2187 
2188  void* exception = NULL;
2189 
2190  pbio::facerec::Liveness2DEstimatorImpl* const the_impl =
2191  _dll_handle->FacerecService_createLiveness2DEstimatorE(
2192  _impl,
2193  file_path.c_str(),
2194  0, // overridden keys size
2195  NULL, // overridden keys
2196  NULL, // overriden values
2197  &exception);
2198 
2199  checkException(exception, *_dll_handle);
2200 
2201  return Liveness2DEstimator::Ptr::make(_dll_handle, the_impl);
2202 }
2203 
2204 inline
2206  const pbio::FacerecService::Config config) const
2207 {
2208  const std::string file_path = _facerec_conf_dir + config.config_filepath;
2209 
2210  std::vector<char const*> overridden_keys;
2211  std::vector<double> overridden_values;
2212 
2213  config.prepare(overridden_keys, overridden_values);
2214 
2215  void* exception = NULL;
2216 
2217  pbio::facerec::Liveness2DEstimatorImpl* const the_impl =
2218  _dll_handle->FacerecService_createLiveness2DEstimatorE(
2219  _impl,
2220  file_path.c_str(),
2221  overridden_keys.size(),
2222  overridden_keys.empty() ? NULL : &(overridden_keys[0]),
2223  overridden_values.empty() ? NULL : &(overridden_values[0]),
2224  &exception);
2225 
2226  checkException(exception, *_dll_handle);
2227 
2228  return Liveness2DEstimator::Ptr::make(_dll_handle, the_impl);
2229 }
2230 
2231 inline
2233  const std::string ini_file) const
2234 {
2235  const std::string file_path = _facerec_conf_dir + ini_file;
2236 
2237  void* exception = NULL;
2238 
2239  pbio::facerec::FaceAttributesEstimatorImpl* const the_impl =
2240  _dll_handle->FacerecService_createFaceAttributesEstimator(
2241  _impl,
2242  file_path.c_str(),
2243  0, // overridden keys size
2244  NULL, // overridden keys
2245  NULL, // overriden values
2246  &exception);
2247 
2248  checkException(exception, *_dll_handle);
2249 
2250  return FaceAttributesEstimator::Ptr::make(_dll_handle, the_impl);
2251 }
2252 
2254 
2255 inline
2256 ProcessingUnit::Ptr FacerecService::createProcessingUnit(
2257  const int block_type,
2258  const char* serializedConfig) const
2259 {
2260  return ProcessingUnit::Ptr::make(_dll_handle, block_type, serializedConfig);
2261 }
2262 
2263 #ifndef WITHOUT_PROCESSING_BLOCK
2264 inline Context FacerecService::createContext() const
2265 {
2266  return Context(_dll_handle);
2267 }
2268 
2269 inline Context FacerecService::createContextFromEncodedImage(const uint8_t* data, uint64_t dataSize) const
2270 {
2271  return Context(_dll_handle, data, dataSize);
2272 }
2273 
2274 inline Context FacerecService::createContextFromEncodedImage(const std::vector<uint8_t>& data) const
2275 {
2276  return Context(_dll_handle, data.data(), data.size());
2277 }
2278 
2279 inline Context FacerecService::createContextFromEncodedImage(const std::string& data) const
2280 {
2281  return Context(_dll_handle, reinterpret_cast<const uint8_t*>(data.data()), data.size());
2282 }
2283 
2284 inline Context FacerecService::createContextFromEncodedImage(const std::vector<char>& data) const
2285 {
2286  return Context(_dll_handle, reinterpret_cast<const uint8_t*>(data.data()), data.size());
2287 }
2288 
2289 inline Context FacerecService::createContextFromFrame(uint8_t* data, int32_t width, int32_t height, Context::Format format, int32_t baseAngle) const
2290 {
2291  return Context(_dll_handle, data, width, height, format, baseAngle);
2292 }
2293 
2294 inline Context FacerecService::createContextFromJsonFile(const char* path)
2295 {
2296  return Context(_dll_handle, path);
2297 }
2298 
2299 inline Context FacerecService::createContextFromJsonFile(std::string path)
2300 {
2301  return Context(_dll_handle, path.c_str());
2302 }
2303 
2304 inline ProcessingBlock FacerecService::createProcessingBlock(const Context& config) const
2305 {
2306  return ProcessingBlock(_impl, _dll_handle, config);
2307 }
2308 #endif
2309 
2311 
2312 inline
2314 {
2315  void* exception = NULL;
2316 
2317  void* struct_storage_impl = _dll_handle->FacerecService_getLicenseState(_impl, &exception);
2318 
2319  checkException(exception, *_dll_handle);
2320 
2321  const StructStorage struct_storage(_dll_handle, struct_storage_impl);
2322 
2323  LicenseState result;
2324 
2325  result.online = struct_storage.get_int64(StructStorageFields::license_state_online_t);
2326 
2327  result.android_app_id = (char const*) struct_storage.get_pointer(StructStorageFields::license_state_android_app_id_t);
2328  result.android_serial = (char const*) struct_storage.get_pointer(StructStorageFields::license_state_android_serial_t);
2329  result.ios_app_id = (char const*) struct_storage.get_pointer(StructStorageFields::license_state_ios_app_id_t);
2330  result.hardware_reg = (char const*) struct_storage.get_pointer(StructStorageFields::license_state_hardware_reg_t);
2331 
2332  result.counters.resize( struct_storage.get_int64(
2333  StructStorageFields::license_state_licenses_count_t) );
2334 
2335  for(size_t i = 0; i < result.counters.size(); ++i)
2336  {
2337  result.counters[i].name = (char const*) struct_storage.get_pointer(
2338  (i << 16) | size_t(StructStorageFields::license_state_licenses_names_int16_t) );
2339 
2340  result.counters[i].max_value = struct_storage.get_int64(
2341  (i << 16) | size_t(StructStorageFields::license_state_licenses_total_counts_int16_t) );
2342 
2343  result.counters[i].value = struct_storage.get_int64(
2344  (i << 16) | size_t(StructStorageFields::license_state_licenses_in_use_counts_int16_t) );
2345  }
2346 
2347  return result;
2348 }
2349 
2350 
2351 inline
2353 {
2354  void* exception = NULL;
2355 
2356  _dll_handle->FacerecService_toggleAlgorithmsCacheKepp(1, &exception);
2357 
2358  checkException(exception, *_dll_handle);
2359 }
2360 
2361 inline
2363 {
2364  void* exception = NULL;
2365 
2366  _dll_handle->FacerecService_toggleAlgorithmsCacheKepp(0, &exception);
2367 
2368  checkException(exception, *_dll_handle);
2369 }
2370 
2371 
2372 
2373 inline
2375  const int width,
2376  const int height,
2377  const RawImage::Format format)
2378 {
2379  void* exception = NULL;
2380 
2381  int32_t data_size;
2382  void* data_ptr;
2383  void* imagetptr_ptr;
2384 
2385  void* const the_impl = _dll_handle->InternalImageBuffer_constructor(
2386  width,
2387  height,
2388  format,
2389  &data_size,
2390  &data_ptr,
2391  &imagetptr_ptr,
2392  &exception);
2393 
2394  checkException(exception, *_dll_handle);
2395 
2396  return InternalImageBuffer::Ptr::make(
2397  _dll_handle,
2398  the_impl,
2399  (unsigned char*) data_ptr,
2400  data_size,
2401  width,
2402  height,
2403  format,
2404  imagetptr_ptr);
2405 }
2406 
2407 
2408 #ifdef ANDROID
2409 inline
2411  JNIEnv *env,
2412  jobject android_media_image)
2413 {
2414  void* exception = NULL;
2415 
2416  int32_t width;
2417  int32_t height;
2418  int32_t format;
2419  int32_t data_size;
2420  void* data_ptr;
2421  void* imagetptr_ptr;
2422 
2423  void* const the_impl = _dll_handle->InternalImageBuffer_constructor_from_android_image(
2424  env,
2425  android_media_image,
2426  &width,
2427  &height,
2428  &format,
2429  &data_size,
2430  &data_ptr,
2431  &imagetptr_ptr,
2432  &exception);
2433 
2434  checkException(exception, *_dll_handle);
2435 
2436  return InternalImageBuffer::Ptr::make(
2437  _dll_handle,
2438  the_impl,
2439  (unsigned char*) data_ptr,
2440  data_size,
2441  width,
2442  height,
2443  (InternalImageBuffer::Format) format,
2444  imagetptr_ptr);
2445 }
2446 #endif
2447 
2448 inline
2450  const RawImage image,
2451  const bool downscale_x2,
2452  void* const result_buffer)
2453 {
2454  void* exception = NULL;
2455 
2456  const RawImage::CapiData cdata = image.makeCapiData();
2457 
2458  _dll_handle->RawImage_convertYUV2ARGB(
2459  cdata.data,
2460  cdata.width,
2461  cdata.height,
2462  cdata.format,
2463  cdata.with_crop,
2464  cdata.crop_info_offset_x,
2465  cdata.crop_info_offset_y,
2466  cdata.crop_info_data_image_width,
2467  cdata.crop_info_data_image_height,
2468  downscale_x2,
2469  result_buffer,
2470  &exception);
2471 
2472  checkException(exception, *_dll_handle);
2473 }
2474 
2475 inline
2476 void FacerecService::convertYUV2RGB(
2477  const RawImage image,
2478  const bool downscale_x2,
2479  const int base_angle,
2480  void* const result_buffer)
2481 {
2482  void* exception = NULL;
2483 
2484  const RawImage::CapiData cdata = image.makeCapiData();
2485 
2486  _dll_handle->RawImage_convertYUV2RGB(
2487  cdata.data,
2488  cdata.width,
2489  cdata.height,
2490  cdata.format,
2491  cdata.with_crop,
2492  cdata.crop_info_offset_x,
2493  cdata.crop_info_offset_y,
2494  cdata.crop_info_data_image_width,
2495  cdata.crop_info_data_image_height,
2496  downscale_x2,
2497  base_angle,
2498  result_buffer,
2499  &exception);
2500 
2501  checkException(exception, *_dll_handle);
2502 }
2503 
2504 inline
2505 void FacerecService::convertBGRA88882RGB(
2506  const RawImage image,
2507  const bool downscale_x2,
2508  const int base_angle,
2509  void* const result_buffer)
2510 {
2511  void* exception = NULL;
2512 
2513  const RawImage::CapiData cdata = image.makeCapiData();
2514 
2515  _dll_handle->RawImage_convertYUV2RGB(
2516  cdata.data,
2517  cdata.width,
2518  cdata.height,
2519  cdata.format,
2520  cdata.with_crop,
2521  cdata.crop_info_offset_x,
2522  cdata.crop_info_offset_y,
2523  cdata.crop_info_data_image_width,
2524  cdata.crop_info_data_image_height,
2525  downscale_x2,
2526  base_angle,
2527  result_buffer,
2528  &exception);
2529 
2530  checkException(exception, *_dll_handle);
2531 }
2532 
2533 } // pbio namespace
2534 
2535 
2536 
2537 
2538 
2539 #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:1851
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:1432
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:2232
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:2134
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:1677
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:2449
CameraCalibrator::Ptr createCameraCalibrator() const
Creates a CameraCalibrator object. Thread-safe.
Definition: FacerecService.h:2067
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:1558
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:1546
AgeGenderEstimator::Ptr createAgeGenderEstimator(const std::string ini_file) const
Creates a AgeGenderEstimator object. Thread-safe.
Definition: FacerecService.h:1585
void freeAlgorithmsCache() const
Disable keeping algorithms data in memory. Thread-safe.
Definition: FacerecService.h:2362
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:2374
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:2352
Main library header.
LightSmartPtr< DynamicTemplateIndex >::tPtr Ptr
Alias for the type of a smart pointer to DynamicTemplateIndex.
Definition: DynamicTemplateIndex.h:34
Liveness2DEstimator::Ptr createLiveness2DEstimator(const std::string ini_file) const
Creates an Liveness2DEstimator object. Thread-safe.
Definition: FacerecService.h:2183
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:1623
std::string getVersion() const
Get version of face recognition library. Thread-safe.
Definition: FacerecService.h:1527
QualityEstimator::Ptr createQualityEstimator(const std::string ini_file) const
Creates a QualityEstimator object. Thread-safe.
Definition: FacerecService.h:1604
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:52
LightSmartPtr< Liveness2DEstimator >::tPtr Ptr
Alias for the type of a smart pointer to Liveness2DEstimator.
Definition: Liveness2DEstimator.h:50
SmartPtr.
LightSmartPtr< ContextTemplate >::tPtr Ptr
Alias for the type of a smart pointer to ContextTemplate.
Definition: ContextTemplate.h:47
Context is an interface object for storing data and interacting with methods from the Processing Bloc...
Definition: Context.h:67
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:2313
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:1932
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:1957
EmotionsEstimator::Ptr createEmotionsEstimator(const std::string ini_file) const
Creates a EmotionsEstimator object. Thread-safe.
Definition: FacerecService.h:1657
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:1641
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:2084
License status.
Definition: FacerecService.h:97
LightSmartPtr< DepthLivenessEstimator >::tPtr Ptr
Alias for the type of a smart pointer to DepthLivenessEstimator.
Definition: DepthLivenessEstimator.h:43