3DiVi Face SDK  3.24.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Groups
VideoWorker.h
1 
11 #ifndef __PBIO_API__PBIO__VIDEOWORKER_H_
12 #define __PBIO_API__PBIO__VIDEOWORKER_H_
13 
14 
15 #include <iostream>
16 #include <istream>
17 #include <sstream>
18 #include <vector>
19 #include <stdexcept>
20 
21 
22 
23 #include "ComplexObject.h"
24 #include "deprecated_macro.h"
25 #include "Error.h"
26 #include "ExceptionCheck.h"
27 #include "RawSample.h"
28 #include "Recognizer.h"
29 #include "SmartPtr.h"
30 #include "stl_wraps_impls/WrapIStreamBufferImpl.h"
31 #include "stl_wraps_impls/WrapIStreamImpl.h"
32 #include "stl_wraps_impls/WrapOStreamImpl.h"
33 #include "AgeGenderEstimator.h"
34 #include "EmotionsEstimator.h"
35 #include "Template.h"
36 #include "DepthLivenessEstimator.h"
37 #include "DepthMapRaw.h"
38 #include "IRLivenessEstimator.h"
39 #include "IRFrameRaw.h"
40 #include "StructStorageFields.h"
41 #include "SampleCheckStatus.h"
42 #include "Config.h"
43 #include "ActiveLiveness.h"
44 #include "util693bcd72/util.h"
45 
46 namespace pbio
47 {
48 
49 class FacerecService;
50 
63 class VideoWorker : public ComplexObject
64 {
65 public:
66 
72  typedef LightSmartPtr<VideoWorker>::tPtr Ptr;
73 
81  static const uint64_t MATCH_NOT_FOUND_ID = (uint64_t) (-1);
82 
83 
89  struct Params
90  {
95  Params();
96 
101  def_param_field_693bcd72(Params, pbio::Config , video_worker_config);
102 
107  def_param_field_693bcd72(Params, std::string , recognizer_ini_file);
108 
113  def_param_field_693bcd72(Params, pbio::Config , recognizer_config);
114 
119  def_param_field_693bcd72(Params, int , streams_count);
120 
125  def_param_field_693bcd72(Params, int , processing_threads_count);
126 
131  def_param_field_693bcd72(Params, int , matching_threads_count);
132 
137  def_param_field_693bcd72(Params, int , age_gender_estimation_threads_count);
138 
143  def_param_field_693bcd72(Params, int , emotions_estimation_threads_count);
144 
149  def_param_field_693bcd72(Params, bool , short_time_identification_enabled);
150 
155  def_param_field_693bcd72(Params, float , short_time_identification_distance_threshold);
156 
161  def_param_field_693bcd72(Params, float , short_time_identification_outdate_time_seconds);
162 
167  def_param_field_693bcd72(Params, std::vector<ActiveLiveness::CheckType> , active_liveness_checks_order);
168 
169  };
170 
171 
178  {
186  uint64_t person_id;
187 
195  uint64_t element_id;
196 
203  };
204 
205 
257  typedef
259  const int stream_id,
260  const int frame_id,
261  const std::vector<RawSample::Ptr> &samples,
262  const std::vector<bool> &samples_weak,
263  const std::vector<float> &samples_quality,
264  void* const userdata);
265 
275  {
286  int64_t stream_id;
287 
298  int64_t frame_id;
299 
320  std::vector<RawSample::Ptr> samples;
321 
334  std::vector<int> samples_track_id;
335 
356  std::vector<bool> samples_weak;
357 
370  std::vector<float> samples_quality;
371 
382  std::vector<SampleCheckStatus::Verdict> samples_good_light_and_blur;
383 
394  std::vector<SampleCheckStatus::Verdict> samples_good_angles;
395 
408  std::vector<SampleCheckStatus::Verdict> samples_good_face_size;
409 
420  std::vector<SampleCheckStatus::Verdict> samples_detector_confirmed;
421 
436  std::vector<DepthLivenessEstimator::Liveness> samples_depth_liveness_confirmed;
437 
452  std::vector<IRLivenessEstimator::Liveness> samples_ir_liveness_confirmed;
453 
464  std::vector<bool> samples_track_age_gender_set;
465 
476  std::vector<AgeGenderEstimator::AgeGender> samples_track_age_gender;
477 
488  std::vector<bool> samples_track_emotions_set;
489 
500  std::vector<EmotionsEstimator::EstimatedEmotionsVector> samples_track_emotions;
501 
516  std::vector<ActiveLiveness::ActiveLivenessStatus> samples_active_liveness_status;
517  };
518 
563  typedef
565  const TrackingCallbackData &data,
566  void* const userdata);
567 
581  PBIO_API_DEPRECATED_744e321c
582  typedef
584  const TrackingCallbackData &data,
585  void* const userdata);
586 
638  typedef
640  const int stream_id,
641  const int frame_id,
642  const RawSample::Ptr &sample,
643  const float quality,
644  const Template::Ptr &templ,
645  void* const userdata);
646 
656  {
667  int64_t stream_id;
668 
679  int64_t frame_id;
680 
690 
701  double quality;
702 
712  };
713 
714 
750  typedef
752  const TemplateCreatedCallbackData &data,
753  void* const userdata);
754 
768  PBIO_API_DEPRECATED_744e321c
769  typedef
771  const TemplateCreatedCallbackData &data,
772  void* const userdata);
773 
843  typedef
845  const int stream_id,
846  const int frame_id,
847  const uint64_t person_id,
848  const uint64_t element_id,
849  const RawSample::Ptr &sample,
850  const float quality,
851  const Template::Ptr &templ,
852  const Recognizer::MatchResult match_result,
853  void* const userdata);
854 
885  typedef
887  const int stream_id,
888  const int frame_id,
889  const RawSample::Ptr &sample,
890  const float quality,
891  const Template::Ptr &templ,
892  const std::vector<SearchResult> &search_result,
893  void* const userdata);
894 
904  {
915  int64_t stream_id;
916 
927  int64_t frame_id;
928 
938 
949  double quality;
950 
960 
981  std::vector<SearchResult> search_results;
982  };
983 
1057  typedef
1059  const MatchFoundCallbackData &data,
1060  void* const userdata);
1061 
1075  PBIO_API_DEPRECATED_744e321c
1076  typedef
1078  const MatchFoundCallbackData &data,
1079  void* const userdata);
1080 
1146  typedef
1148  const int stream_id,
1149  const int first_frame_id,
1150  const int last_frame_id,
1151  const float best_quality,
1152  const int best_quality_frame_id,
1153  const RawSample::Ptr &best_quality_sample,
1154  const Template::Ptr &best_quality_templ,
1155  void* const userdata);
1156 
1166  {
1177  int64_t stream_id;
1178 
1188 
1197  int64_t last_frame_id;
1198 
1208 
1218 
1232 
1244 
1255  int64_t track_id;
1256 
1268 
1279  int64_t sti_person_id;
1280  };
1281 
1325  typedef
1327  const TrackingLostCallbackData &data,
1328  void* const userdata);
1329 
1345  PBIO_API_DEPRECATED_744e321c
1346  typedef
1348  const TrackingLostCallbackData &data,
1349  void* const userdata);
1350 
1351 
1352 
1362  {
1373  int64_t stream_id;
1374 
1385  int64_t sti_person_id;
1386  };
1387 
1388 
1389 
1413  typedef
1415  const StiPersonOutdatedCallbackData &data,
1416  void* const userdata);
1417 
1418 
1419 
1435  {
1443  uint64_t element_id;
1444 
1452  uint64_t person_id;
1453 
1462 
1482  };
1483 
1484 
1502  std::string getMethodName() const;
1503 
1504 
1522  int getStreamsCount() const;
1523 
1524 
1556  int getTrackingConveyorSize(const int stream_id) const;
1557 
1558 
1584  void setDatabase(
1585  const std::vector<DatabaseElement> &elements,
1587  acceleration = Recognizer::SEARCH_ACCELERATION_1);
1588 
1636  int addVideoFrame(
1637  const RawImage frame,
1638  const int stream_id,
1639  const uint64_t timestamp_microsec = uint64_t(-1));
1640 
1673  void addDepthFrame(
1674  const DepthMapRaw &depth_frame,
1675  const int stream_id,
1676  const uint64_t timestamp_microsec);
1677 
1710  void addIRFrame(
1711  const IRFrameRaw &ir_frame,
1712  const int stream_id,
1713  const uint64_t timestamp_microsec);
1714 
1734  void resetTrackerOnStream(const int stream_id);
1735 
1736 
1737 
1779  int resetStream(const int stream_id);
1780 
1781 
1795  void checkExceptions();
1796 
1834  PBIO_API_DEPRECATED_744e321c
1835  int addTrackingCallback(
1836  const TrackingCallbackFunc callback,
1837  void* const userdata);
1838 
1873  const TrackingCallbackU callback,
1874  void* const userdata);
1875 
1913  PBIO_API_DEPRECATED_744e321c
1915  const TemplateCreatedCallbackFunc callback,
1916  void* const userdata);
1917 
1952  const TemplateCreatedCallbackU callback,
1953  void* const userdata);
1954 
1992  PBIO_API_DEPRECATED_744e321c
1994  const MatchFoundCallbackFunc callback,
1995  void* const userdata);
1996 
1997 
2035  PBIO_API_DEPRECATED_744e321c
2037  const MatchFoundCallbackFuncExt callback,
2038  void* const userdata);
2039 
2074  const MatchFoundCallbackU callback,
2075  void* const userdata);
2076 
2077 
2112  const StiPersonOutdatedCallbackU callback,
2113  void* const userdata);
2114 
2115 
2153  PBIO_API_DEPRECATED_744e321c
2155  const TrackingLostCallbackFunc callback,
2156  void* const userdata);
2157 
2192  const TrackingLostCallbackU callback,
2193  void* const userdata);
2194 
2212  void removeTrackingCallback(const int callback_id);
2213 
2214 
2232  void removeTemplateCreatedCallback(const int callback_id);
2233 
2234 
2254  void removeMatchFoundCallback(const int callback_id);
2255 
2256 
2274  void removeStiPersonOutdatedCallback(const int callback_id);
2275 
2293  void removeTrackingLostCallback(const int callback_id);
2294 
2295 
2317  void disableProcessingOnStream(const int stream_id);
2318 
2319 
2341  void enableProcessingOnStream(const int stream_id);
2342 
2343 
2344 
2364  void disableAgeGenderEstimationOnStream(const int stream_id);
2365 
2366 
2367 
2387  void enableAgeGenderEstimationOnStream(const int stream_id);
2388 
2408  void disableEmotionsEstimationOnStream(const int stream_id);
2409 
2410 
2411 
2431  void enableEmotionsEstimationOnStream(const int stream_id);
2432 
2434  void setParameter(
2435  const std::string parameter,
2436  const double value);
2438 
2439 
2440 // add callbacks for functor objects (lambda, for example)
2441 public:
2442 
2443  template<typename T>
2444  int addTrackingCallbackU(T* functor)
2445  {
2446  return addTrackingCallbackU(
2447  callCallbackFunctor<T, TrackingCallbackData>,
2448  (void*)functor);
2449  }
2450 
2451  template<typename T>
2452  int addTemplateCreatedCallbackU(T* functor)
2453  {
2455  callCallbackFunctor<T, TemplateCreatedCallbackData>,
2456  (void*)functor);
2457  }
2458 
2459  template<typename T>
2460  int addMatchFoundCallbackU(T* functor)
2461  {
2462  return addMatchFoundCallbackU(
2463  callCallbackFunctor<T, MatchFoundCallbackData>,
2464  (void*)functor);
2465  }
2466 
2467  template<typename T>
2468  int addStiPersonOutdatedCallbackU(T* functor)
2469  {
2471  callCallbackFunctor<T, StiPersonOutdatedCallbackData>,
2472  (void*)functor);
2473  }
2474 
2475  template<typename T>
2476  int addTrackingLostCallbackU(T* functor)
2477  {
2478  return addTrackingLostCallbackU(
2479  callCallbackFunctor<T, TrackingLostCallbackData>,
2480  (void*)functor);
2481  }
2482 
2483 private:
2484 
2485  template<typename T, typename DT>
2486  static
2487  void callCallbackFunctor(
2488  const DT &data,
2489  void* const userdata)
2490  {
2491  (*reinterpret_cast<T*>(userdata))(data);
2492  }
2493 
2494 
2495 
2496  static
2497  void STrackingCallback(
2498  void* err_stream,
2499  void* this_vw,
2500  void const* callback_data,
2501 
2502  const int32_t callbacks_count,
2503  void* const* const callbacks_func,
2504  void* const* const callbacks_userdata,
2505  const int32_t u_callbacks_count,
2506  void* const* const u_callbacks_func,
2507  void* const* const u_callbacks_userdata);
2508 
2509  static
2510  void STemplateCreatedCallback(
2511  void* err_stream,
2512  void* this_vw,
2513  void const* callback_data,
2514 
2515  const int32_t callbacks_count,
2516  void* const* const callbacks_func,
2517  void* const* const callbacks_userdata,
2518  const int32_t u_callbacks_count,
2519  void* const* const u_callbacks_func,
2520  void* const* const u_callbacks_userdata);
2521 
2522  static
2523  void SMatchFoundCallback(
2524  void* err_stream,
2525  void* this_vw,
2526  void const* callback_data,
2527 
2528  const int32_t callbacks_count,
2529  void* const* const callbacks_func,
2530  void* const* const callbacks_userdata,
2531  const int32_t ext_callbacks_count,
2532  void* const* const ext_callbacks_func,
2533  void* const* const ext_callbacks_userdata,
2534  const int32_t u_callbacks_count,
2535  void* const* const u_callbacks_func,
2536  void* const* const u_callbacks_userdata);
2537 
2538 
2539  static
2540  void STrackingLostCallback(
2541  void* err_stream,
2542  void* this_vw,
2543  void const* callback_data,
2544 
2545  const int32_t callbacks_count,
2546  void* const* const callbacks_func,
2547  void* const* const callbacks_userdata,
2548  const int32_t u_callbacks_count,
2549  void* const* const u_callbacks_func,
2550  void* const* const u_callbacks_userdata);
2551 
2552  static
2553  void SStiPersonOutdatedCallback(
2554  void* err_stream,
2555  void* this_vw__,
2556  void const* callback_data,
2557 
2558  const int32_t callbacks_count,
2559  void* const* const callbacks_func,
2560  void* const* const callbacks_userdata);
2561 
2562 
2563  void toggleSomething(
2564  const int stream_id,
2565  const int something);
2566 
2567  VideoWorker(
2568  const DHPtr &dll_handle,
2569  void* impl);
2570 
2571  friend class FacerecService;
2572  friend class object_with_ref_counter<VideoWorker>;
2573 };
2574 
2575 } // pbio namespace
2576 
2577 
2578 
2582 
2583 namespace pbio
2584 {
2585 
2586 
2587 
2588 inline
2589 VideoWorker::VideoWorker(
2590  const DHPtr &dll_handle,
2591  void* impl):
2592 ComplexObject(dll_handle, impl)
2593 {
2594  void* exception = NULL;
2595 
2596  _dll_handle->VideoWorker_setThisVW(
2597  _impl,
2598  this,
2599  &exception);
2600 
2601  checkException(exception, *_dll_handle);
2602 }
2603 
2604 inline
2605 std::string VideoWorker::getMethodName() const
2606 {
2607  std::ostringstream name_stream;
2608  pbio::stl_wraps::WrapOStreamImpl name_stream_wrap(name_stream);
2609 
2610  void* exception = NULL;
2611 
2612  _dll_handle->VideoWorker_getMethodName(
2613  _impl,
2614  &name_stream_wrap,
2615  pbio::stl_wraps::WrapOStream::write_func,
2616  &exception);
2617 
2618  checkException(exception, *_dll_handle);
2619 
2620  return name_stream.str();
2621 }
2622 
2623 
2624 inline
2626 {
2627  void* exception = NULL;
2628 
2629  const int result = _dll_handle->VideoWorker_getStreamsCount(
2630  _impl,
2631  &exception);
2632 
2633  checkException(exception, *_dll_handle);
2634 
2635  return result;
2636 }
2637 
2638 
2639 inline
2640 int VideoWorker::getTrackingConveyorSize(const int stream_id) const
2641 {
2642  void* exception = NULL;
2643 
2644  const int result = _dll_handle->VideoWorker_getTrackingConveyorSize(
2645  _impl,
2646  stream_id,
2647  &exception);
2648 
2649  checkException(exception, *_dll_handle);
2650 
2651  return result;
2652 }
2653 
2654 
2655 inline
2657  const std::vector<DatabaseElement> &elements,
2658  const Recognizer::SearchAccelerationType acceleration)
2659 {
2660  std::vector<uint64_t> element_ids_v(elements.size());
2661  std::vector<uint64_t> person_ids_v(elements.size());
2662  std::vector<pbio::facerec::TemplateImpl const*> templates_v(elements.size());
2663  std::vector<float> thresholds_v(elements.size());
2664 
2665  for(size_t i = 0; i < elements.size(); ++i)
2666  {
2667  element_ids_v[i] = elements[i].element_id;
2668  person_ids_v[i] = elements[i].person_id;
2669  templates_v[i] = (pbio::facerec::TemplateImpl const*) elements[i].face_template->_impl;
2670  thresholds_v[i] = elements[i].distance_threshold;
2671  }
2672 
2673  void* exception = NULL;
2674 
2675  _dll_handle->VideoWorker_setDatabase(
2676  _impl,
2677  acceleration,
2678  elements.size(),
2679  element_ids_v.data(),
2680  person_ids_v.data(),
2681  templates_v.data(),
2682  thresholds_v.data(),
2683  &exception);
2684 
2685  checkException(exception, *_dll_handle);
2686 }
2687 
2688 inline
2690  const RawImage frame,
2691  const int stream_id,
2692  const uint64_t timestamp_microsec)
2693 {
2694  void* exception = NULL;
2695 
2696  const RawImage::CapiData cdata = frame.makeCapiData();
2697 
2698  const int result = _dll_handle->VideoWorker_addVideoFrameWithTimestamp_with_crop(
2699  _impl,
2700 
2701  cdata.data,
2702  cdata.width,
2703  cdata.height,
2704  cdata.format,
2705 
2706  cdata.with_crop,
2707  cdata.crop_info_offset_x,
2708  cdata.crop_info_offset_y,
2709  cdata.crop_info_data_image_width,
2710  cdata.crop_info_data_image_height,
2711 
2712  stream_id,
2713  timestamp_microsec,
2714  &exception);
2715 
2716  checkException(exception, *_dll_handle);
2717 
2718  return result;
2719 }
2720 
2721 inline
2723  const DepthMapRaw &depth_frame,
2724  const int stream_id,
2725  const uint64_t timestamp_microsec)
2726 {
2727  void* exception = NULL;
2728 
2729  _dll_handle->VideoWorker_addDepthFrame(
2730  _impl,
2731  depth_frame.depth_map_rows,
2732  depth_frame.depth_map_cols,
2733  depth_frame.depth_map_2_image_offset_x,
2734  depth_frame.depth_map_2_image_offset_y,
2735  depth_frame.depth_map_2_image_scale_x,
2736  depth_frame.depth_map_2_image_scale_y,
2737  depth_frame.horizontal_fov,
2738  depth_frame.vertical_fov,
2739  depth_frame.depth_unit_in_millimeters,
2740  depth_frame.depth_data,
2741  depth_frame.depth_data_stride_in_bytes,
2742  stream_id,
2743  timestamp_microsec,
2744  &exception);
2745 
2746  checkException(exception, *_dll_handle);
2747 }
2748 
2749 inline
2751  const IRFrameRaw &ir_frame,
2752  const int stream_id,
2753  const uint64_t timestamp_microsec)
2754 {
2755  void* exception = NULL;
2756 
2757  _dll_handle->VideoWorker_addIRFrame(
2758  _impl,
2759  ir_frame.ir_frame_rows,
2760  ir_frame.ir_frame_cols,
2761  ir_frame.ir_frame_2_image_offset_x,
2762  ir_frame.ir_frame_2_image_offset_y,
2763  ir_frame.ir_frame_2_image_scale_x,
2764  ir_frame.ir_frame_2_image_scale_y,
2765  ir_frame.ir_horizontal_fov,
2766  ir_frame.ir_vertical_fov,
2767  ir_frame.ir_frame_data,
2768  ir_frame.ir_data_stride_in_bytes,
2769  stream_id,
2770  timestamp_microsec,
2771  &exception);
2772 
2773  checkException(exception, *_dll_handle);
2774 }
2775 
2776 inline
2777 void VideoWorker::resetTrackerOnStream(const int stream_id)
2778 {
2779  void* exception = NULL;
2780 
2781  _dll_handle->VideoWorker_resetTrackerOnStream(
2782  _impl,
2783  stream_id,
2784  &exception);
2785 
2786  checkException(exception, *_dll_handle);
2787 }
2788 
2789 
2790 inline
2791 int VideoWorker::resetStream(const int stream_id)
2792 {
2793  void* exception = NULL;
2794 
2795  const int threshold_track_id = _dll_handle->VideoWorker_resetStream(
2796  _impl,
2797  stream_id,
2798  &exception);
2799 
2800  checkException(exception, *_dll_handle);
2801 
2802  return threshold_track_id;
2803 }
2804 
2805 
2806 inline
2808 {
2809  void* exception = NULL;
2810 
2811  _dll_handle->VideoWorker_checkExceptions(
2812  _impl,
2813  &exception);
2814 
2815  checkException(exception, *_dll_handle);
2816 }
2817 
2818 inline
2820  const TrackingCallbackFunc callback,
2821  void* const userdata)
2822 {
2823  void* exception = NULL;
2824 
2825  const int result = _dll_handle->VideoWorker_addTrackingCallback(
2826  _impl,
2827  reinterpret_cast<void*>(callback),
2828  userdata,
2829  &exception);
2830 
2831  checkException(exception, *_dll_handle);
2832 
2833  return result;
2834 }
2835 
2836 inline
2838  const TrackingCallbackU callback,
2839  void* const userdata)
2840 {
2841  void* exception = NULL;
2842 
2843  const int result = _dll_handle->VideoWorker_addTrackingCallbackU(
2844  _impl,
2845  reinterpret_cast<void*>(callback),
2846  userdata,
2847  &exception);
2848 
2849  checkException(exception, *_dll_handle);
2850 
2851  return result;
2852 }
2853 
2854 
2855 
2856 inline
2858  const TemplateCreatedCallbackFunc callback,
2859  void* const userdata)
2860 {
2861  void* exception = NULL;
2862 
2863  const int result = _dll_handle->VideoWorker_addTemplateCreatedCallback(
2864  _impl,
2865  reinterpret_cast<void*>(callback),
2866  userdata,
2867  &exception);
2868 
2869  checkException(exception, *_dll_handle);
2870 
2871  return result;
2872 }
2873 
2874 inline
2876  const TemplateCreatedCallbackU callback,
2877  void* const userdata)
2878 {
2879  void* exception = NULL;
2880 
2881  const int result = _dll_handle->VideoWorker_addTemplateCreatedCallbackU(
2882  _impl,
2883  reinterpret_cast<void*>(callback),
2884  userdata,
2885  &exception);
2886 
2887  checkException(exception, *_dll_handle);
2888 
2889  return result;
2890 }
2891 
2892 
2893 inline
2895  const MatchFoundCallbackFunc callback,
2896  void* const userdata)
2897 {
2898  void* exception = NULL;
2899 
2900  const int result = _dll_handle->VideoWorker_addMatchFoundCallback(
2901  _impl,
2902  reinterpret_cast<void*>(callback),
2903  userdata,
2904  &exception);
2905 
2906  checkException(exception, *_dll_handle);
2907 
2908  return result;
2909 }
2910 
2911 
2912 inline
2914  const MatchFoundCallbackFuncExt callback,
2915  void* const userdata)
2916 {
2917  void* exception = NULL;
2918 
2919  const int result = _dll_handle->VideoWorker_addMatchFoundCallbackExt(
2920  _impl,
2921  reinterpret_cast<void*>(callback),
2922  userdata,
2923  &exception);
2924 
2925  checkException(exception, *_dll_handle);
2926 
2927  return result;
2928 }
2929 
2930 inline
2932  const MatchFoundCallbackU callback,
2933  void* const userdata)
2934 {
2935  void* exception = NULL;
2936 
2937  const int result = _dll_handle->VideoWorker_addMatchFoundCallbackU(
2938  _impl,
2939  reinterpret_cast<void*>(callback),
2940  userdata,
2941  &exception);
2942 
2943  checkException(exception, *_dll_handle);
2944 
2945  return result;
2946 }
2947 
2948 
2949 inline
2951  const TrackingLostCallbackFunc callback,
2952  void* const userdata)
2953 {
2954  void* exception = NULL;
2955 
2956  const int result = _dll_handle->VideoWorker_addTrackingLostCallback(
2957  _impl,
2958  reinterpret_cast<void*>(callback),
2959  userdata,
2960  &exception);
2961 
2962  checkException(exception, *_dll_handle);
2963 
2964  return result;
2965 }
2966 
2967 inline
2969  const TrackingLostCallbackU callback,
2970  void* const userdata)
2971 {
2972  void* exception = NULL;
2973 
2974  const int result = _dll_handle->VideoWorker_addTrackingLostCallbackU(
2975  _impl,
2976  reinterpret_cast<void*>(callback),
2977  userdata,
2978  &exception);
2979 
2980  checkException(exception, *_dll_handle);
2981 
2982  return result;
2983 }
2984 
2985 inline
2987  const StiPersonOutdatedCallbackU callback,
2988  void* const userdata)
2989 {
2990  void* exception = NULL;
2991 
2992  const int result = _dll_handle->VideoWorker_addStiPersonOutdatedCallbackU(
2993  _impl,
2994  reinterpret_cast<void*>(callback),
2995  userdata,
2996  &exception);
2997 
2998  checkException(exception, *_dll_handle);
2999 
3000  return result;
3001 }
3002 
3003 
3004 
3005 inline
3007  const int callback_id)
3008 {
3009  void* exception = NULL;
3010 
3011  _dll_handle->VideoWorker_removeTrackingCallback(
3012  _impl,
3013  callback_id,
3014  &exception);
3015 
3016  checkException(exception, *_dll_handle);
3017 }
3018 
3019 inline
3021  const int callback_id)
3022 {
3023  void* exception = NULL;
3024 
3025  _dll_handle->VideoWorker_removeTemplateCreatedCallback(
3026  _impl,
3027  callback_id,
3028  &exception);
3029 
3030  checkException(exception, *_dll_handle);
3031 }
3032 
3033 inline
3035  const int callback_id)
3036 {
3037  void* exception = NULL;
3038 
3039  _dll_handle->VideoWorker_removeMatchFoundCallback(
3040  _impl,
3041  callback_id,
3042  &exception);
3043 
3044  checkException(exception, *_dll_handle);
3045 }
3046 
3047 
3048 inline
3050  const int callback_id)
3051 {
3052  void* exception = NULL;
3053 
3054  _dll_handle->VideoWorker_removeStiPersonOutdatedCallback(
3055  _impl,
3056  callback_id,
3057  &exception);
3058 
3059  checkException(exception, *_dll_handle);
3060 }
3061 
3062 inline
3064  const int callback_id)
3065 {
3066  void* exception = NULL;
3067 
3068  _dll_handle->VideoWorker_removeTrackingLostCallback(
3069  _impl,
3070  callback_id,
3071  &exception);
3072 
3073  checkException(exception, *_dll_handle);
3074 }
3075 
3076 
3077 
3078 #define __0x6ce24ef9_VideoWorker_static_callback_functions_catch_exceptions(name) \
3079  catch(const std::exception &e) \
3080  { \
3081  const std::string error = \
3082  "VideoWorker " name " catch std::excetion: '" + \
3083  std::string( e.what() ) + "'."; \
3084  const VideoWorker &this_vw = *reinterpret_cast<VideoWorker const*>(this_vw__); \
3085  this_vw._dll_handle->VideoWorker_errStreamWriteFunc(err_stream, error.c_str(), error.length()); \
3086  } \
3087  catch(...) \
3088  { \
3089  const std::string error = "VideoWorker " name " catch '...'."; \
3090  const VideoWorker &this_vw = *reinterpret_cast<VideoWorker const*>(this_vw__); \
3091  this_vw._dll_handle->VideoWorker_errStreamWriteFunc(err_stream, error.c_str(), error.length()); \
3092  }
3093 
3094 
3095 // static
3096 inline
3097 void VideoWorker::STrackingCallback(
3098  void* err_stream,
3099  void* this_vw__,
3100  void const* callback_data,
3101 
3102  const int32_t callbacks_count,
3103  void* const* const callbacks_func,
3104  void* const* const callbacks_userdata,
3105  const int32_t u_callbacks_count,
3106  void* const* const u_callbacks_func,
3107  void* const* const u_callbacks_userdata)
3108 {
3109  try
3110  {
3111  const VideoWorker &this_vw = *reinterpret_cast<VideoWorker const*>(this_vw__);
3112 
3113  void* exception = NULL;
3114 
3115  const int64_t stream_id = this_vw._dll_handle->StructStorage_get_int64(
3116  callback_data,
3117  StructStorageFields::video_worker_stream_id_t,
3118  &exception);
3119 
3120  checkException(exception, *this_vw._dll_handle);
3121 
3122  const int64_t frame_id = this_vw._dll_handle->StructStorage_get_int64(
3123  callback_data,
3124  StructStorageFields::video_worker_frame_id_t,
3125  &exception);
3126 
3127  checkException(exception, *this_vw._dll_handle);
3128 
3129  const int64_t samples_count = this_vw._dll_handle->StructStorage_get_int64(
3130  callback_data,
3131  StructStorageFields::video_worker_samples_count_t,
3132  &exception);
3133 
3134  checkException(exception, *this_vw._dll_handle);
3135 
3136  pbio::facerec::RawSampleImpl* const* const samples_impls = static_cast<pbio::facerec::RawSampleImpl* const* const>(
3137  this_vw._dll_handle->StructStorage_get_pointer(
3138  callback_data,
3139  StructStorageFields::video_worker_samples_t,
3140  &exception));
3141 
3142  checkException(exception, *this_vw._dll_handle);
3143 
3144  int32_t const* const weak_samples = static_cast<int32_t const* const>(
3145  this_vw._dll_handle->StructStorage_get_pointer(
3146  callback_data,
3147  pbio::StructStorageFields::video_worker_weak_samples_t,
3148  &exception));
3149 
3150  checkException(exception, *this_vw._dll_handle);
3151 
3152  float const* const samples_quality = static_cast<float const* const>(
3153  this_vw._dll_handle->StructStorage_get_pointer(
3154  callback_data,
3155  StructStorageFields::video_worker_samples_quality_t,
3156  &exception));
3157 
3158  checkException(exception, *this_vw._dll_handle);
3159 
3160  int32_t const* const samples_good_light_and_blur = static_cast<int32_t const* const>(
3161  this_vw._dll_handle->StructStorage_get_pointer(
3162  callback_data,
3163  pbio::StructStorageFields::video_worker_good_light_and_blur_samples_t,
3164  &exception));
3165 
3166  checkException(exception, *this_vw._dll_handle);
3167 
3168  int32_t const* const samples_good_angles = static_cast<int32_t const* const>(
3169  this_vw._dll_handle->StructStorage_get_pointer(
3170  callback_data,
3171  pbio::StructStorageFields::video_worker_good_angles_samples_t,
3172  &exception));
3173 
3174  checkException(exception, *this_vw._dll_handle);
3175 
3176  int32_t const* const samples_good_face_size = static_cast<int32_t const* const>(
3177  this_vw._dll_handle->StructStorage_get_pointer(
3178  callback_data,
3179  pbio::StructStorageFields::video_worker_good_face_size_samples_t,
3180  &exception));
3181 
3182  checkException(exception, *this_vw._dll_handle);
3183 
3184 
3185  int32_t const* const samples_detector_confirmed = static_cast<int32_t const* const>(
3186  this_vw._dll_handle->StructStorage_get_pointer(
3187  callback_data,
3188  pbio::StructStorageFields::video_worker_detector_confirmed_samples_t,
3189  &exception));
3190 
3191  checkException(exception, *this_vw._dll_handle);
3192 
3193  int32_t const* const samples_depth_liveness_confirmed = static_cast<int32_t const* const>(
3194  this_vw._dll_handle->StructStorage_get_pointer(
3195  callback_data,
3196  pbio::StructStorageFields::video_worker_depth_liveness_confirmed_samples_t,
3197  &exception));
3198 
3199  checkException(exception, *this_vw._dll_handle);
3200 
3201  int32_t const* const samples_ir_liveness_confirmed = static_cast<int32_t const* const>(
3202  this_vw._dll_handle->StructStorage_get_pointer(
3203  callback_data,
3204  pbio::StructStorageFields::video_worker_ir_liveness_confirmed_samples_t,
3205  &exception));
3206 
3207  checkException(exception, *this_vw._dll_handle);
3208 
3209 
3210  int32_t const* const samples_track_age_gender_set = static_cast<int32_t const* const>(
3211  this_vw._dll_handle->StructStorage_get_pointer(
3212  callback_data,
3213  pbio::StructStorageFields::video_worker_samples_track_age_gender_set_t,
3214  &exception));
3215  checkException(exception, *this_vw._dll_handle);
3216 
3217  int32_t const* const samples_track_gender = static_cast<int32_t const* const>(
3218  this_vw._dll_handle->StructStorage_get_pointer(
3219  callback_data,
3220  pbio::StructStorageFields::video_worker_samples_track_gender_t,
3221  &exception));
3222  checkException(exception, *this_vw._dll_handle);
3223 
3224  int32_t const* const samples_track_age = static_cast<int32_t const* const>(
3225  this_vw._dll_handle->StructStorage_get_pointer(
3226  callback_data,
3227  pbio::StructStorageFields::video_worker_samples_track_age_t,
3228  &exception));
3229  checkException(exception, *this_vw._dll_handle);
3230 
3231  float const* const samples_track_age_years = static_cast<float const* const>(
3232  this_vw._dll_handle->StructStorage_get_pointer(
3233  callback_data,
3234  pbio::StructStorageFields::video_worker_samples_track_age_years_t,
3235  &exception));
3236  checkException(exception, *this_vw._dll_handle);
3237 
3238  int32_t const* const samples_track_emotions_set = static_cast<int32_t const* const>(
3239  this_vw._dll_handle->StructStorage_get_pointer(
3240  callback_data,
3241  pbio::StructStorageFields::video_worker_samples_track_emotions_set_t,
3242  &exception));
3243  checkException(exception, *this_vw._dll_handle);
3244 
3245  int32_t const* const samples_track_emotions_count = static_cast<int32_t const* const>(
3246  this_vw._dll_handle->StructStorage_get_pointer(
3247  callback_data,
3248  pbio::StructStorageFields::video_worker_samples_track_emotions_count_t,
3249  &exception));
3250  checkException(exception, *this_vw._dll_handle);
3251 
3252  float const* const samples_track_emotions_confidence = static_cast<float const* const>(
3253  this_vw._dll_handle->StructStorage_get_pointer(
3254  callback_data,
3255  pbio::StructStorageFields::video_worker_samples_track_emotions_confidence_t,
3256  &exception));
3257  checkException(exception, *this_vw._dll_handle);
3258 
3259  int32_t const* const samples_track_emotions_emotion = static_cast<int32_t const* const>(
3260  this_vw._dll_handle->StructStorage_get_pointer(
3261  callback_data,
3262  pbio::StructStorageFields::video_worker_samples_track_emotions_emotion_t,
3263  &exception));
3264  checkException(exception, *this_vw._dll_handle);
3265 
3266  int32_t const* const samples_track_active_liveness_type = static_cast<int32_t const* const>(
3267  this_vw._dll_handle->StructStorage_get_pointer(
3268  callback_data,
3269  pbio::StructStorageFields::video_worker_active_liveness_type_samples_t,
3270  &exception));
3271  checkException(exception, *this_vw._dll_handle);
3272 
3273  int32_t const* const samples_track_active_liveness_confirmed = static_cast<int32_t const* const>(
3274  this_vw._dll_handle->StructStorage_get_pointer(
3275  callback_data,
3276  pbio::StructStorageFields::video_worker_active_liveness_confirmed_samples_t,
3277  &exception));
3278  checkException(exception, *this_vw._dll_handle);
3279 
3280  float const* const samples_track_active_liveness_progress = static_cast<float const* const>(
3281  this_vw._dll_handle->StructStorage_get_pointer(
3282  callback_data,
3283  pbio::StructStorageFields::video_worker_active_liveness_score_samples_t,
3284  &exception));
3285  checkException(exception, *this_vw._dll_handle);
3286 
3287 
3288  TrackingCallbackData data;
3289 
3290  data.stream_id = stream_id;
3291  data.frame_id = frame_id;
3292  data.samples.resize(samples_count);
3293  data.samples_track_id.resize(samples_count);
3294  data.samples_weak.resize(samples_count);
3295  data.samples_quality.resize(samples_count);
3296  data.samples_good_light_and_blur.resize(samples_count);
3297  data.samples_good_angles.resize(samples_count);
3298  data.samples_good_face_size.resize(samples_count);
3299  data.samples_detector_confirmed.resize(samples_count);
3300  data.samples_depth_liveness_confirmed.resize(samples_count);
3301  data.samples_ir_liveness_confirmed.resize(samples_count);
3302  data.samples_track_age_gender_set.resize(samples_count);
3303  data.samples_track_age_gender.resize(samples_count);
3304  data.samples_track_emotions_set.resize(samples_count);
3305  data.samples_track_emotions.resize(samples_count);
3306  data.samples_active_liveness_status.resize(samples_count);
3307 
3308  for(int i = 0, emotions_i = 0; i < samples_count; ++i)
3309  {
3310  data.samples[i] = RawSample::Ptr( RawSample::Ptr::make(this_vw._dll_handle, samples_impls[i]) );
3311  data.samples_track_id[i] = data.samples[i]->getID();
3312 
3313  data.samples_weak[i] = weak_samples[i];
3314  data.samples_quality[i] = samples_quality[i];
3315 
3316  data.samples_good_light_and_blur[i] = (SampleCheckStatus::Verdict)samples_good_light_and_blur[i];
3317  data.samples_good_angles[i] = (SampleCheckStatus::Verdict)samples_good_angles[i];
3318  data.samples_good_face_size[i] = (SampleCheckStatus::Verdict)samples_good_face_size[i];
3319  data.samples_detector_confirmed[i] = (SampleCheckStatus::Verdict)samples_detector_confirmed[i];
3320 
3321  data.samples_depth_liveness_confirmed[i] = (DepthLivenessEstimator::Liveness)samples_depth_liveness_confirmed[i];
3322 
3323  data.samples_ir_liveness_confirmed[i] = (IRLivenessEstimator::Liveness)samples_ir_liveness_confirmed[i];
3324 
3325  data.samples_active_liveness_status[i].check_type = (ActiveLiveness::CheckType)samples_track_active_liveness_type[i];
3326  data.samples_active_liveness_status[i].verdict = (ActiveLiveness::Liveness)samples_track_active_liveness_confirmed[i];
3327  data.samples_active_liveness_status[i].progress_level = samples_track_active_liveness_progress[i];
3328 
3329  data.samples_track_age_gender_set[i] = samples_track_age_gender_set[i];
3330 
3331  data.samples_track_age_gender[i].gender = (AgeGenderEstimator::Gender) samples_track_gender[i];
3332  data.samples_track_age_gender[i].age = (AgeGenderEstimator::Age) samples_track_age[i];
3333  data.samples_track_age_gender[i].age_years = samples_track_age_years[i];
3334 
3335  data.samples_track_emotions_set[i] = samples_track_emotions_set[i];
3336 
3337  const int emotions_count = samples_track_emotions_count[i];
3338 
3339  for(int k = 0; k < emotions_count; ++k, ++emotions_i)
3340  {
3342 
3343  ec.emotion = (EmotionsEstimator::Emotion) samples_track_emotions_emotion[emotions_i];
3344  ec.confidence = samples_track_emotions_confidence[emotions_i];
3345 
3346  data.samples_track_emotions[i].push_back(ec);
3347  }
3348  }
3349 
3350 
3351  for(int i = 0; i < u_callbacks_count; ++i)
3352  {
3353  try
3354  {
3355  const TrackingCallbackU u_callback_function_i =
3356  reinterpret_cast<TrackingCallbackU>(u_callbacks_func[i]);
3357 
3358  u_callback_function_i(
3359  data,
3360  u_callbacks_userdata[i]);
3361  }
3362  __0x6ce24ef9_VideoWorker_static_callback_functions_catch_exceptions("TrackingCallbackU")
3363  }
3364 
3365 
3366  for(int i = 0; i < callbacks_count; ++i)
3367  {
3368  try
3369  {
3370  const TrackingCallbackFunc callback_function_i =
3371  reinterpret_cast<TrackingCallbackFunc>(callbacks_func[i]);
3372 
3373  callback_function_i(
3374  data.stream_id,
3375  data.frame_id,
3376  data.samples,
3377  data.samples_weak,
3378  data.samples_quality,
3379  callbacks_userdata[i]);
3380  }
3381  __0x6ce24ef9_VideoWorker_static_callback_functions_catch_exceptions("TrackingCallback")
3382  }
3383  }
3384  __0x6ce24ef9_VideoWorker_static_callback_functions_catch_exceptions("TrackingCallback_")
3385 }
3386 
3387 
3388 
3389 
3390 // static
3391 inline
3392 void VideoWorker::STemplateCreatedCallback(
3393  void* err_stream,
3394  void* this_vw__,
3395  void const* callback_data,
3396 
3397  const int32_t callbacks_count,
3398  void* const* const callbacks_func,
3399  void* const* const callbacks_userdata,
3400  const int32_t u_callbacks_count,
3401  void* const* const u_callbacks_func,
3402  void* const* const u_callbacks_userdata)
3403 {
3404  try
3405  {
3406  const VideoWorker &this_vw = *reinterpret_cast<VideoWorker const*>(this_vw__);
3407 
3408  void* exception = NULL;
3409 
3410  const int64_t stream_id = this_vw._dll_handle->StructStorage_get_int64(
3411  callback_data,
3412  StructStorageFields::video_worker_stream_id_t,
3413  &exception);
3414 
3415  checkException(exception, *this_vw._dll_handle);
3416 
3417  const int64_t frame_id = this_vw._dll_handle->StructStorage_get_int64(
3418  callback_data,
3419  StructStorageFields::video_worker_frame_id_t,
3420  &exception);
3421 
3422  checkException(exception, *this_vw._dll_handle);
3423 
3424  const double quality = this_vw._dll_handle->StructStorage_get_double(
3425  callback_data,
3426  StructStorageFields::video_worker_quality_t,
3427  &exception);
3428 
3429  checkException(exception, *this_vw._dll_handle);
3430 
3431  pbio::facerec::RawSampleImpl* const sample_impl = static_cast<pbio::facerec::RawSampleImpl* const>(
3432  this_vw._dll_handle->StructStorage_get_pointer(
3433  callback_data,
3434  StructStorageFields::video_worker_samples_t,
3435  &exception));
3436 
3437  checkException(exception, *this_vw._dll_handle);
3438 
3439  pbio::facerec::TemplateImpl* const templ_impl = static_cast<pbio::facerec::TemplateImpl* const>(
3440  this_vw._dll_handle->StructStorage_get_pointer(
3441  callback_data,
3442  StructStorageFields::video_worker_templ_t,
3443  &exception));
3444 
3445  checkException(exception, *this_vw._dll_handle);
3446 
3447  const RawSample::Ptr sample( RawSample::Ptr::make(this_vw._dll_handle, sample_impl));
3448 
3449  const Template::Ptr templ( Template::Ptr::make(this_vw._dll_handle, templ_impl));
3450 
3451  TemplateCreatedCallbackData data;
3452 
3453  data.stream_id = stream_id;
3454  data.frame_id = frame_id;
3455  data.quality = quality;
3456  data.sample = sample;
3457  data.templ = templ;
3458 
3459 
3460 
3461 
3462  for(int i = 0; i < u_callbacks_count; ++i)
3463  {
3464  try
3465  {
3466  const TemplateCreatedCallbackU u_callback_function_i =
3467  reinterpret_cast<TemplateCreatedCallbackU>(u_callbacks_func[i]);
3468 
3469  u_callback_function_i(
3470  data,
3471  u_callbacks_userdata[i]);
3472  }
3473  __0x6ce24ef9_VideoWorker_static_callback_functions_catch_exceptions("TemplateCreatedCallbackU")
3474  }
3475 
3476 
3477 
3478  for(int i = 0; i < callbacks_count; ++i)
3479  {
3480  try
3481  {
3482  const TemplateCreatedCallbackFunc callback_function_i =
3483  reinterpret_cast<TemplateCreatedCallbackFunc>(callbacks_func[i]);
3484 
3485  callback_function_i(
3486  data.stream_id,
3487  data.frame_id,
3488  data.sample,
3489  data.quality,
3490  data.templ,
3491  callbacks_userdata[i]);
3492  }
3493  __0x6ce24ef9_VideoWorker_static_callback_functions_catch_exceptions("TemplateCreatedCallback")
3494  }
3495 
3496 
3497  }
3498  __0x6ce24ef9_VideoWorker_static_callback_functions_catch_exceptions("TemplateCreatedCallback_")
3499 }
3500 
3501 
3502 
3503 
3504 
3505 // static
3506 inline
3507 void VideoWorker::SMatchFoundCallback(
3508  void* err_stream,
3509  void* this_vw__,
3510  void const* callback_data,
3511 
3512  const int32_t callbacks_count,
3513  void* const* const callbacks_func,
3514  void* const* const callbacks_userdata,
3515  const int32_t ext_callbacks_count,
3516  void* const* const ext_callbacks_func,
3517  void* const* const ext_callbacks_userdata,
3518  const int32_t u_callbacks_count,
3519  void* const* const u_callbacks_func,
3520  void* const* const u_callbacks_userdata)
3521 {
3522  try
3523  {
3524  const VideoWorker &this_vw = *reinterpret_cast<VideoWorker const*>(this_vw__);
3525 
3526  void* exception = NULL;
3527 
3528  const int64_t stream_id = this_vw._dll_handle->StructStorage_get_int64(
3529  callback_data,
3530  StructStorageFields::video_worker_stream_id_t,
3531  &exception);
3532 
3533  checkException(exception, *this_vw._dll_handle);
3534 
3535  const int64_t frame_id = this_vw._dll_handle->StructStorage_get_int64(
3536  callback_data,
3537  StructStorageFields::video_worker_frame_id_t,
3538  &exception);
3539 
3540  checkException(exception, *this_vw._dll_handle);
3541 
3542  const double quality = this_vw._dll_handle->StructStorage_get_double(
3543  callback_data,
3544  StructStorageFields::video_worker_quality_t,
3545  &exception);
3546 
3547  checkException(exception, *this_vw._dll_handle);
3548 
3549  pbio::facerec::RawSampleImpl* const sample_impl = static_cast<pbio::facerec::RawSampleImpl* const>(
3550  this_vw._dll_handle->StructStorage_get_pointer(
3551  callback_data,
3552  StructStorageFields::video_worker_samples_t,
3553  &exception));
3554 
3555  checkException(exception, *this_vw._dll_handle);
3556 
3557  pbio::facerec::TemplateImpl* const templ_impl = static_cast<pbio::facerec::TemplateImpl* const>(
3558  this_vw._dll_handle->StructStorage_get_pointer(
3559  callback_data,
3560  StructStorageFields::video_worker_templ_t,
3561  &exception));
3562 
3563  checkException(exception, *this_vw._dll_handle);
3564 
3565  const int64_t search_result_size = this_vw._dll_handle->StructStorage_get_int64(
3566  callback_data,
3567  StructStorageFields::video_worker_search_result_size_t,
3568  &exception);
3569 
3570  checkException(exception, *this_vw._dll_handle);
3571 
3572  uint64_t const* const search_result_person_ids = static_cast<uint64_t const* const>(
3573  this_vw._dll_handle->StructStorage_get_pointer(
3574  callback_data,
3575  StructStorageFields::video_worker_search_result_person_ids_t,
3576  &exception));
3577 
3578  checkException(exception, *this_vw._dll_handle);
3579 
3580  uint64_t const* const search_result_element_ids = static_cast<uint64_t const* const>(
3581  this_vw._dll_handle->StructStorage_get_pointer(
3582  callback_data,
3583  StructStorageFields::video_worker_search_result_element_ids_t,
3584  &exception));
3585 
3586  checkException(exception, *this_vw._dll_handle);
3587 
3588  float const* const search_result_match_result_distances = static_cast<float const* const>(
3589  this_vw._dll_handle->StructStorage_get_pointer(
3590  callback_data,
3591  StructStorageFields::video_worker_search_result_match_result_distance_t,
3592  &exception));
3593 
3594  checkException(exception, *this_vw._dll_handle);
3595 
3596  float const* const search_result_match_result_far_s = static_cast<float const* const>(
3597  this_vw._dll_handle->StructStorage_get_pointer(
3598  callback_data,
3599  StructStorageFields::video_worker_search_result_match_result_fa_r_t,
3600  &exception));
3601 
3602  checkException(exception, *this_vw._dll_handle);
3603 
3604  float const* const search_result_match_result_frr_s = static_cast<float const* const>(
3605  this_vw._dll_handle->StructStorage_get_pointer(
3606  callback_data,
3607  StructStorageFields::video_worker_search_result_match_result_fr_r_t,
3608  &exception));
3609 
3610  checkException(exception, *this_vw._dll_handle);
3611 
3612  float const* const search_result_match_result_scores = static_cast<float const* const>(
3613  this_vw._dll_handle->StructStorage_get_pointer(
3614  callback_data,
3615  StructStorageFields::video_worker_search_result_match_result_score_t,
3616  &exception));
3617 
3618  checkException(exception, *this_vw._dll_handle);
3619 
3620 
3621  const RawSample::Ptr sample( RawSample::Ptr::make(this_vw._dll_handle, sample_impl));
3622 
3623  const Template::Ptr templ( Template::Ptr::make(this_vw._dll_handle, templ_impl));
3624 
3625  std::vector<SearchResult> search_results(search_result_size);
3626 
3627  for(int i = 0; i < search_result_size; ++i)
3628  {
3629  search_results[i].person_id = search_result_person_ids[i];
3630  search_results[i].element_id = search_result_element_ids[i];
3631  search_results[i].match_result.distance = search_result_match_result_distances[i];
3632  search_results[i].match_result.fa_r = search_result_match_result_far_s[i];
3633  search_results[i].match_result.fr_r = search_result_match_result_frr_s[i];
3634  search_results[i].match_result.score = search_result_match_result_scores[i];
3635  }
3636 
3638  data.stream_id = stream_id;
3639  data.frame_id = frame_id;
3640  data.quality = quality;
3641  data.sample = sample;
3642  data.templ = templ;
3643  data.search_results = search_results;
3644 
3645 
3646 
3647 
3648 
3649  for(int i = 0; i < u_callbacks_count; ++i)
3650  {
3651  try
3652  {
3653  const MatchFoundCallbackU u_callback_function_i =
3654  reinterpret_cast<MatchFoundCallbackU>(u_callbacks_func[i]);
3655 
3656  u_callback_function_i(
3657  data,
3658  u_callbacks_userdata[i]);
3659  }
3660  __0x6ce24ef9_VideoWorker_static_callback_functions_catch_exceptions("MatchFoundCallbackU")
3661  }
3662 
3663 
3664  for(int i = 0; i < ext_callbacks_count; ++i)
3665  {
3666  try
3667  {
3668  const MatchFoundCallbackFuncExt ext_callback_function_i =
3669  reinterpret_cast<MatchFoundCallbackFuncExt>(ext_callbacks_func[i]);
3670 
3671  ext_callback_function_i(
3672  data.stream_id,
3673  data.frame_id,
3674  data.sample,
3675  data.quality,
3676  data.templ,
3677  data.search_results,
3678  ext_callbacks_userdata[i]);
3679  }
3680  __0x6ce24ef9_VideoWorker_static_callback_functions_catch_exceptions("MatchFoundCallbackExt")
3681  }
3682 
3683 
3684  for(int i = 0; i < callbacks_count; ++i)
3685  {
3686  try
3687  {
3688  const MatchFoundCallbackFunc callback_function_i =
3689  reinterpret_cast<MatchFoundCallbackFunc>(callbacks_func[i]);
3690 
3691  callback_function_i(
3692  data.stream_id,
3693  data.frame_id,
3694  data.search_results[0].person_id,
3695  data.search_results[0].element_id,
3696  data.sample,
3697  data.quality,
3698  data.templ,
3699  data.search_results[0].match_result,
3700  callbacks_userdata[i]);
3701  }
3702  __0x6ce24ef9_VideoWorker_static_callback_functions_catch_exceptions("MatchFoundCallback")
3703  }
3704 
3705  }
3706  __0x6ce24ef9_VideoWorker_static_callback_functions_catch_exceptions("MatchFoundCallback_")
3707 }
3708 
3709 
3710 // static
3711 inline
3712 void VideoWorker::SStiPersonOutdatedCallback(
3713  void* err_stream,
3714  void* this_vw__,
3715  void const* callback_data,
3716 
3717  const int32_t callbacks_count,
3718  void* const* const callbacks_func,
3719  void* const* const callbacks_userdata)
3720 {
3721  try
3722  {
3723  const VideoWorker &this_vw = *reinterpret_cast<VideoWorker const*>(this_vw__);
3724 
3725  void* exception = NULL;
3726 
3727  const int64_t stream_id = this_vw._dll_handle->StructStorage_get_int64(
3728  callback_data,
3729  StructStorageFields::video_worker_stream_id_t,
3730  &exception);
3731 
3732  checkException(exception, *this_vw._dll_handle);
3733 
3734  const int64_t sti_person_id = this_vw._dll_handle->StructStorage_get_int64(
3735  callback_data,
3736  StructStorageFields::video_worker_sti_person_id_t,
3737  &exception);
3738 
3739  checkException(exception, *this_vw._dll_handle);
3740 
3741 
3742  StiPersonOutdatedCallbackData data;
3743  data.stream_id = stream_id;
3744  data.sti_person_id = sti_person_id;
3745 
3746  for(int i = 0; i < callbacks_count; ++i)
3747  {
3748  try
3749  {
3750  const StiPersonOutdatedCallbackU callback_function_i =
3751  reinterpret_cast<StiPersonOutdatedCallbackU>(callbacks_func[i]);
3752 
3753  callback_function_i(
3754  data,
3755  callbacks_userdata[i]);
3756  }
3757  __0x6ce24ef9_VideoWorker_static_callback_functions_catch_exceptions("StiPersonOutdated")
3758  }
3759  }
3760  __0x6ce24ef9_VideoWorker_static_callback_functions_catch_exceptions("StiPersonOutdated")
3761 }
3762 
3763 // static
3764 inline
3765 void VideoWorker::STrackingLostCallback(
3766  void* err_stream,
3767  void* this_vw__,
3768  void const* callback_data,
3769 
3770  const int32_t callbacks_count,
3771  void* const* const callbacks_func,
3772  void* const* const callbacks_userdata,
3773  const int32_t u_callbacks_count,
3774  void* const* const u_callbacks_func,
3775  void* const* const u_callbacks_userdata)
3776 {
3777  try
3778  {
3779  const VideoWorker &this_vw = *reinterpret_cast<VideoWorker const*>(this_vw__);
3780 
3781  void* exception = NULL;
3782 
3783  const int64_t stream_id = this_vw._dll_handle->StructStorage_get_int64(
3784  callback_data,
3785  StructStorageFields::video_worker_stream_id_t,
3786  &exception);
3787 
3788  checkException(exception, *this_vw._dll_handle);
3789 
3790  const int64_t first_frame_id = this_vw._dll_handle->StructStorage_get_int64(
3791  callback_data,
3792  StructStorageFields::video_worker_first_frame_id_t,
3793  &exception);
3794 
3795  checkException(exception, *this_vw._dll_handle);
3796 
3797  const int64_t last_frame_id = this_vw._dll_handle->StructStorage_get_int64(
3798  callback_data,
3799  StructStorageFields::video_worker_last_frame_id_t,
3800  &exception);
3801 
3802  checkException(exception, *this_vw._dll_handle);
3803 
3804  const double best_quality = this_vw._dll_handle->StructStorage_get_double(
3805  callback_data,
3806  StructStorageFields::video_worker_best_quality_t,
3807  &exception);
3808 
3809  checkException(exception, *this_vw._dll_handle);
3810 
3811  const int64_t best_quality_frame_id = this_vw._dll_handle->StructStorage_get_int64(
3812  callback_data,
3813  StructStorageFields::video_worker_best_qaulity_frame_id_t,
3814  &exception);
3815 
3816  checkException(exception, *this_vw._dll_handle);
3817 
3818  pbio::facerec::RawSampleImpl* const best_quality_sample_impl = static_cast<pbio::facerec::RawSampleImpl* const>(
3819  this_vw._dll_handle->StructStorage_get_pointer(
3820  callback_data,
3821  StructStorageFields::video_worker_samples_t,
3822  &exception));
3823 
3824  checkException(exception, *this_vw._dll_handle);
3825 
3826  const RawSample::Ptr sample =
3827  best_quality_sample_impl ?
3828  RawSample::Ptr::make(this_vw._dll_handle, best_quality_sample_impl) :
3829  RawSample::Ptr();
3830 
3831 
3832  pbio::facerec::TemplateImpl* const best_quality_template_impl = static_cast<pbio::facerec::TemplateImpl* const>(
3833  this_vw._dll_handle->StructStorage_get_pointer(
3834  callback_data,
3835  StructStorageFields::video_worker_templ_t,
3836  &exception));
3837 
3838  checkException(exception, *this_vw._dll_handle);
3839 
3840  const Template::Ptr templ =
3841  best_quality_template_impl ?
3842  Template::Ptr( Template::Ptr::make(this_vw._dll_handle, best_quality_template_impl)) :
3843  Template::Ptr();
3844 
3845 
3846  const int64_t track_id = this_vw._dll_handle->StructStorage_get_int64(
3847  callback_data,
3848  StructStorageFields::video_worker_track_id_t,
3849  &exception);
3850 
3851  checkException(exception, *this_vw._dll_handle);
3852 
3853 
3854  const int64_t sti_person_id = this_vw._dll_handle->StructStorage_get_int64(
3855  callback_data,
3856  StructStorageFields::video_worker_sti_person_id_t,
3857  &exception);
3858 
3859  checkException(exception, *this_vw._dll_handle);
3860 
3861 
3862  const bool sti_person_id_set = this_vw._dll_handle->StructStorage_get_int64(
3863  callback_data,
3864  StructStorageFields::video_worker_sti_person_id_set_t,
3865  &exception);
3866 
3867  checkException(exception, *this_vw._dll_handle);
3868 
3869 
3870 
3871  TrackingLostCallbackData data;
3872  data.stream_id = stream_id;
3873  data.first_frame_id = first_frame_id;
3874  data.last_frame_id = last_frame_id;
3875  data.best_quality = best_quality;
3876  data.best_quality_frame_id = best_quality_frame_id;
3877  data.best_quality_sample = sample;
3878  data.best_quality_templ = templ;
3879  data.track_id = track_id;
3880  data.sti_person_id = sti_person_id;
3881  data.sti_person_id_set = sti_person_id_set;
3882 
3883 
3884 
3885 
3886 
3887  for(int i = 0; i < u_callbacks_count; ++i)
3888  {
3889  try
3890  {
3891  const TrackingLostCallbackU u_callback_function_i =
3892  reinterpret_cast<TrackingLostCallbackU>(u_callbacks_func[i]);
3893 
3894  u_callback_function_i(
3895  data,
3896  u_callbacks_userdata[i]);
3897  }
3898  __0x6ce24ef9_VideoWorker_static_callback_functions_catch_exceptions("TrackingLostCallbackU")
3899  }
3900 
3901 
3902  for(int i = 0; i < callbacks_count; ++i)
3903  {
3904  try
3905  {
3906  const TrackingLostCallbackFunc callback_function_i =
3907  reinterpret_cast<TrackingLostCallbackFunc>(callbacks_func[i]);
3908 
3909  callback_function_i(
3910  data.stream_id,
3911  data.first_frame_id,
3912  data.last_frame_id,
3913  data.best_quality,
3914  data.best_quality_frame_id,
3915  data.best_quality_sample,
3916  data.best_quality_templ,
3917  callbacks_userdata[i]);
3918  }
3919  __0x6ce24ef9_VideoWorker_static_callback_functions_catch_exceptions("TrackingLostCallback")
3920  }
3921 
3922  }
3923  __0x6ce24ef9_VideoWorker_static_callback_functions_catch_exceptions("TrackingLostCallback_")
3924 }
3925 
3926 
3927 inline
3928 void VideoWorker::toggleSomething(
3929  const int stream_id,
3930  const int something)
3931 {
3932  void* exception = NULL;
3933 
3934  _dll_handle->VideoWorker_toggleSomething(
3935  _impl,
3936  stream_id,
3937  something,
3938  &exception);
3939 
3940  checkException(exception, *_dll_handle);
3941 }
3942 
3943 
3944 inline
3946 {
3947  toggleSomething(stream_id, pbio::facerec::capi::VideoWorker_something_Processing_Disable);
3948 }
3949 
3950 
3951 inline
3952 void VideoWorker::enableProcessingOnStream(const int stream_id)
3953 {
3954  toggleSomething(stream_id, pbio::facerec::capi::VideoWorker_something_Processing_Enable);
3955 }
3956 
3957 
3958 inline
3960 {
3961  toggleSomething(stream_id, pbio::facerec::capi::VideoWorker_something_AgeGender_Disable);
3962 }
3963 
3964 inline
3966 {
3967  toggleSomething(stream_id, pbio::facerec::capi::VideoWorker_something_AgeGender_Enable);
3968 }
3969 
3970 inline
3972 {
3973  toggleSomething(stream_id, pbio::facerec::capi::VideoWorker_something_Emotions_Disable);
3974 }
3975 
3976 inline
3978 {
3979  toggleSomething(stream_id, pbio::facerec::capi::VideoWorker_something_Emotions_Enable);
3980 }
3981 
3982 
3983 
3984 
3985 inline
3987 : _video_worker_config(std::string())
3988 , _recognizer_ini_file()
3989 , _recognizer_config(std::string())
3990 , _streams_count(0)
3991 , _processing_threads_count(0)
3992 , _matching_threads_count(0)
3993 , _age_gender_estimation_threads_count(0)
3994 , _emotions_estimation_threads_count(0)
3995 , _short_time_identification_enabled(false)
3996 , _short_time_identification_distance_threshold(0)
3997 , _short_time_identification_outdate_time_seconds(0)
3998 , _active_liveness_checks_order()
3999 {
4000  // nothing else
4001 }
4002 
4003 
4004 inline
4005 void VideoWorker::setParameter(
4006  const std::string parameter,
4007  const double value)
4008 {
4009  void* exception = NULL;
4010 
4011  _dll_handle->VideoWorker_setParameter(
4012  _impl,
4013  parameter.c_str(),
4014  value,
4015  &exception);
4016 
4017  checkException(exception, *_dll_handle);
4018 }
4019 
4020 
4021 } // pbio namespace
4022 
4023 
4024 #endif // __PBIO_API__PBIO__VIDEOWORKER_H_
int64_t frame_id
Integer id of the frame (that was returned by VideoWorker::addVideoFrame).
Definition: VideoWorker.h:679
float depth_map_2_image_scale_x
Parameter of correspondence between the coordinates of the original image and depth map...
Definition: DepthMapRaw.h:56
void checkExceptions()
Exceptions from the callbacks and inner threads are rethrown when this method is called. Thread-safe.
Definition: VideoWorker.h:2807
int64_t sti_person_id
ID of "sti_person", which is a set of tracks formed by short time identification. sti_person_id is eq...
Definition: VideoWorker.h:1279
Liveness
Estimated liveness.
Definition: IRLivenessEstimator.h:50
int64_t last_frame_id
Integer id of the frame after which the face tracking was lost.
Definition: VideoWorker.h:1197
std::vector< SampleCheckStatus::Verdict > samples_good_angles
The result of checking the sample for absence of too high yaw/pitch angles (samples_good_angles.size() == samples.size())
Definition: VideoWorker.h:394
Struct that provides raw image data and optional cropping information.
Definition: RawImage.h:28
void(* TrackingLostCallbackU)(const TrackingLostCallbackData &data, void *const userdata)
Callback function type for a TrackingLost event (e.g. when a person leaves the frame).
Definition: VideoWorker.h:1326
Template search result (for VideoWorker::MatchFoundCallbackFuncU).
Definition: VideoWorker.h:177
void(* TemplateCreatedCallbackU)(const TemplateCreatedCallbackData &data, void *const userdata)
Callback function type for a TemplateCreated event.
Definition: VideoWorker.h:751
double quality
Face sample quality. The same as from the FaceQualityEstimator.
Definition: VideoWorker.h:949
Liveness
Active liveness check state.
Definition: ActiveLiveness.h:47
float depth_unit_in_millimeters
Scale of values stored in the depth_data.
Definition: DepthMapRaw.h:84
std::vector< float > samples_quality
Quality value for the face sample. The same as from the FaceQualityEstimator (samples_quality.size() == samples.size())
Definition: VideoWorker.h:370
int depth_data_stride_in_bytes
Stride in bytes.
Definition: DepthMapRaw.h:98
float horizontal_fov
The horizontal viewing angle of the depth map in degrees.
Definition: DepthMapRaw.h:70
int depth_map_cols
Width of the depth map.
Definition: DepthMapRaw.h:35
Template::Ptr templ
Template created for this sample.
Definition: VideoWorker.h:711
void setDatabase(const std::vector< DatabaseElement > &elements, const Recognizer::SearchAccelerationType acceleration=Recognizer::SEARCH_ACCELERATION_1)
Set / replace the database (can be called at any time). Available only if matching_threads_count > 0...
Definition: VideoWorker.h:2656
void enableProcessingOnStream(const int stream_id)
Enable the creation of templates for a given stream. After that, the matching is resumed as well...
Definition: VideoWorker.h:3952
Params & short_time_identification_enabled(const bool value)
Set the flag enabling short time identification.
Definition: VideoWorker.h:149
int addTemplateCreatedCallback(const TemplateCreatedCallbackFunc callback, void *const userdata)
Add a handler for a TemplateCreated event. Thread-safe.
Definition: VideoWorker.h:2857
Definition: CallbackData.h:106
int64_t first_frame_id
Integer id of the frame on which the face was first detected.
Definition: VideoWorker.h:1187
int64_t stream_id
Integer id of the video stream (0 <= stream_id < streams_count).
Definition: VideoWorker.h:667
float depth_map_2_image_offset_y
Parameter of correspondence between the coordinates of the original image and depth map...
Definition: DepthMapRaw.h:49
uint64_t element_id
Unique id of the element.
Definition: VideoWorker.h:1443
void resetTrackerOnStream(const int stream_id)
Reset tracker state for a specified video stream. Thread-safe.
Definition: VideoWorker.h:2777
An IR frame aligned with an original color image. Correspondence between the coordinates of the ori...
Definition: IRFrameRaw.h:21
int getTrackingConveyorSize(const int stream_id) const
Get a size N of tracking conveyor. Tracking callback will be called with frame_id = X not earlier tha...
Definition: VideoWorker.h:2640
int addTemplateCreatedCallbackU(const TemplateCreatedCallbackU callback, void *const userdata)
Add a handler for a TemplateCreated event. Thread-safe.
Definition: VideoWorker.h:2875
LightSmartPtr< VideoWorker >::tPtr Ptr
Alias for the type of a smart pointer to VideoWorker.
Definition: VideoWorker.h:72
Heuristically accelerated linear search. Heuristics reduces TAR (true acceptance rate) on the 1:N tes...
Definition: Recognizer.h:143
std::vector< int > samples_track_id
Vector of face IDs (track_id). track_id is equal to sample.getID() for the sample given in any VideoW...
Definition: VideoWorker.h:334
void(* TrackingCallbackFuncU)(const TrackingCallbackData &data, void *const userdata)
Callback function type for a Tracking event.
Definition: VideoWorker.h:583
int64_t stream_id
Integer id of the video stream (0 <= stream_id < streams_count).
Definition: VideoWorker.h:1177
void enableAgeGenderEstimationOnStream(const int stream_id)
Enable age and gender estimation for a given stream. Thread-safe.
Definition: VideoWorker.h:3965
std::vector< SampleCheckStatus::Verdict > samples_detector_confirmed
The result of checking the sample with the frontal face detector (samples_detector_confirmed.size() == samples.size())
Definition: VideoWorker.h:420
std::vector< IRLivenessEstimator::Liveness > samples_ir_liveness_confirmed
The result of checking the sample with IRLivenessEstimator, IR frames are required, see VideoWorker::addIRFrame. See IRLivenessEstimator::Liveness for details. (samples_ir_liveness_confirmed.size() == samples.size())
Definition: VideoWorker.h:452
void enableEmotionsEstimationOnStream(const int stream_id)
Enable estimation of emotions for a given stream. Thread-safe.
Definition: VideoWorker.h:3977
RawSample::Ptr sample
Face sample.
Definition: VideoWorker.h:689
Parameters of the VideoWorker constructor.
Definition: VideoWorker.h:89
LightSmartPtr< Template >::tPtr Ptr
Alias for the type of a smart pointer to Template.
Definition: Template.h:46
std::vector< RawSample::Ptr > samples
Vector of face samples found by the tracker. Most of the samples are received from the frame_id fra...
Definition: VideoWorker.h:320
bool sti_person_id_set
Flag indicating that sti_person_id is set. sti_person_id is not set, if short time identification is ...
Definition: VideoWorker.h:1267
DepthLivenessEstimator - Interface object used to estimate face liveness in order to prevent spoofing...
Age
Age groups.
Definition: AgeGenderEstimator.h:62
Interface object for saving the face template.
Definition: Template.h:13
Verdict
Definition: SampleCheckStatus.h:17
std::vector< ActiveLiveness::ActiveLivenessStatus > samples_active_liveness_status
Face active liveness check status. See ActiveLiveness::ActiveLivenessStatus for details. (samples_active_liveness_status.size() == samples.size())
Definition: VideoWorker.h:516
EmotionsEstimator - Interface object for estimation of emotions.
int addMatchFoundCallbackU(const MatchFoundCallbackU callback, void *const userdata)
Add a handler for a MatchFound event. Thread-safe.
Definition: VideoWorker.h:2931
A class used to override the configuration parameters at runtime.
Definition: Config.h:19
TrackingLost callback data.
Definition: VideoWorker.h:1165
void(* MatchFoundCallbackFunc)(const int stream_id, const int frame_id, const uint64_t person_id, const uint64_t element_id, const RawSample::Ptr &sample, const float quality, const Template::Ptr &templ, const Recognizer::MatchResult match_result, void *const userdata)
Callback function type for a MatchFound event.
Definition: VideoWorker.h:844
float ir_vertical_fov
The vertical viewing angle of an IR frame in degrees.
Definition: IRFrameRaw.h:77
void removeStiPersonOutdatedCallback(const int callback_id)
Remove a handler for an StiPersonOutdated event. Thread-safe.
Definition: VideoWorker.h:3049
LightSmartPtr< RawSample >::tPtr Ptr
Alias for the type of a smart pointer to RawSample.
Definition: RawSample.h:58
Definition: CallbackData.h:150
uint16_t const * ir_frame_data
Pointer to IR data.
Definition: IRFrameRaw.h:84
int getStreamsCount() const
Get a number of video streams. Thread-safe.
Definition: VideoWorker.h:2625
int depth_map_rows
Height of the depth map.
Definition: DepthMapRaw.h:28
void(* MatchFoundCallbackFuncU)(const MatchFoundCallbackData &data, void *const userdata)
Callback function type for a MatchFound event.
Definition: VideoWorker.h:1077
int64_t stream_id
Integer id of the video stream (0 <= stream_id < streams_count).
Definition: VideoWorker.h:286
int resetStream(const int stream_id)
Reset work state for the stream. It waits for the callbacks, which are currently being executed...
Definition: VideoWorker.h:2791
int addStiPersonOutdatedCallbackU(const StiPersonOutdatedCallbackU callback, void *const userdata)
Add a handler for an StiPersonOutdated event. Thread-safe.
Definition: VideoWorker.h:2986
float ir_frame_2_image_offset_x
Parameter of correspondence between the coordinates of an original image and an IR frame...
Definition: IRFrameRaw.h:42
void(* TrackingCallbackU)(const TrackingCallbackData &data, void *const userdata)
Callback function type for a Tracking event. This callback is called every time the frame has been pr...
Definition: VideoWorker.h:564
Error - the class of exceptions thrown when errors occur.
int64_t stream_id
Integer id of the video stream (0 <= stream_id < streams_count).
Definition: VideoWorker.h:1373
VideoWorker is an interface object for tracking, processing and matching faces on multiple video stre...
Definition: VideoWorker.h:63
int addTrackingCallbackU(const TrackingCallbackU callback, void *const userdata)
Add a handler for a Tracking event. Thread-safe.
Definition: VideoWorker.h:2837
AgeGenderEstimator - interface object for age and gender estimation.
Template::Ptr best_quality_templ
Template created from best_quality_sample. Will be NULL if processing_threads_count is zero or best_q...
Definition: VideoWorker.h:1243
SearchAccelerationType
Types of search acceleration.
Definition: Recognizer.h:119
Result of template matching.
Definition: Recognizer.h:53
MatchFound callback data.
Definition: VideoWorker.h:903
Emotion with confidence.
Definition: EmotionsEstimator.h:114
std::vector< EmotionsEstimator::EstimatedEmotionsVector > samples_track_emotions
Estimated emotions for this track. (samples_track_emotions.size() == samples.size()) ...
Definition: VideoWorker.h:500
float ir_horizontal_fov
The horizontal viewing angle of an IR frame in degrees.
Definition: IRFrameRaw.h:70
RawSample::Ptr sample
Face sample.
Definition: VideoWorker.h:937
int64_t frame_id
Integer id of the frame (that was returned by VideoWorker::addVideoFrame).
Definition: VideoWorker.h:927
void disableEmotionsEstimationOnStream(const int stream_id)
Disable estimation of emotions for a given stream. Thread-safe.
Definition: VideoWorker.h:3971
uint64_t person_id
Unique id of the person.
Definition: VideoWorker.h:186
Params & recognizer_ini_file(const std::string value)
Set the name of the configuration file for Recognizer that will be used inside VideoWorker.
Definition: VideoWorker.h:107
Params & matching_threads_count(const int value)
Set the number of threads for matching templates with the database.
Definition: VideoWorker.h:131
void disableProcessingOnStream(const int stream_id)
Disable the creation of templates for a given stream. After that, the matching stops as well...
Definition: VideoWorker.h:3945
float ir_frame_2_image_scale_y
Parameter of correspondence between the coordinates of an original image and an IR frame...
Definition: IRFrameRaw.h:63
Recognizer::MatchResult match_result
Result of template matching.
Definition: VideoWorker.h:202
static const uint64_t MATCH_NOT_FOUND_ID
A special value for the person_id and element_id parameters in the MatchFoundCallback.
Definition: VideoWorker.h:81
Params & processing_threads_count(const int value)
Set the number of threads for creating templates.
Definition: VideoWorker.h:125
std::vector< DepthLivenessEstimator::Liveness > samples_depth_liveness_confirmed
The result of checking the sample with DepthLivenessEstimator, depth frames are required, see VideoWorker::addDepthFrame. See DepthLivenessEstimator::Liveness for details. (samples_depth_liveness_confirmed.size() == samples.size())
Definition: VideoWorker.h:436
std::vector< bool > samples_track_age_gender_set
Flag indicating that age and gender were estimated for this track. (samples_track_age_gender_set.size() == samples.size())
Definition: VideoWorker.h:464
void(* TemplateCreatedCallbackFunc)(const int stream_id, const int frame_id, const RawSample::Ptr &sample, const float quality, const Template::Ptr &templ, void *const userdata)
Callback function type for a TemplateCreated event.
Definition: VideoWorker.h:639
RawSample::Ptr best_quality_sample
The best quality sample from the best_quality_frame_id frame. Will be NULL if "weak_tracks_in_trackin...
Definition: VideoWorker.h:1231
void removeTemplateCreatedCallback(const int callback_id)
Remove a handler for TemplateCreated event. Thread-safe.
Definition: VideoWorker.h:3020
std::vector< SampleCheckStatus::Verdict > samples_good_light_and_blur
The result of checking the sample for good lighting conditions and absence of a strong blur (samples_...
Definition: VideoWorker.h:382
uint64_t element_id
Unique id of the element.
Definition: VideoWorker.h:195
std::vector< AgeGenderEstimator::AgeGender > samples_track_age_gender
Estimated age and gender for this track. (samples_track_age_gender.size() == samples.size())
Definition: VideoWorker.h:476
float confidence
Positive real number in the range of [0; 1].
Definition: EmotionsEstimator.h:128
Emotion emotion
Emotion.
Definition: EmotionsEstimator.h:121
void(* MatchFoundCallbackFuncExt)(const int stream_id, const int frame_id, const RawSample::Ptr &sample, const float quality, const Template::Ptr &templ, const std::vector< SearchResult > &search_result, void *const userdata)
Callback function type for a MatchFound event.
Definition: VideoWorker.h:886
A depth map aligned with the original color image. Correspondence between the coordinates of the or...
Definition: DepthMapRaw.h:21
double quality
Face sample quality. The same as from the FaceQualityEstimator.
Definition: VideoWorker.h:701
Params & age_gender_estimation_threads_count(const int value)
Set the number of threads for age_gender estimation.
Definition: VideoWorker.h:137
Params & active_liveness_checks_order(const std::vector< ActiveLiveness::CheckType > value)
Set the order for checking the active liveness.
Definition: VideoWorker.h:167
Emotion
Emotions.
Definition: EmotionsEstimator.h:57
void(* StiPersonOutdatedCallbackU)(const StiPersonOutdatedCallbackData &data, void *const userdata)
Callback function type for an StiPersonOutdated event.
Definition: VideoWorker.h:1414
void(* TrackingLostCallbackFunc)(const int stream_id, const int first_frame_id, const int last_frame_id, const float best_quality, const int best_quality_frame_id, const RawSample::Ptr &best_quality_sample, const Template::Ptr &best_quality_templ, void *const userdata)
Callback function type for a TrackingLost event (e.g. when a person leaves the frame).
Definition: VideoWorker.h:1147
VideoWorker is an interface object for tracking, processing and matching faces on multiple video stre...
Definition: VideoWorker.h:105
void(* TemplateCreatedCallbackFuncU)(const TemplateCreatedCallbackData &data, void *const userdata)
Callback function type for a TemplateCreated event.
Definition: VideoWorker.h:770
void removeTrackingCallback(const int callback_id)
Remove a handler for Tracking event. Thread-safe.
Definition: VideoWorker.h:3006
float ir_frame_2_image_offset_y
Parameter of correspondence between the coordinates of an original image and an IR frame...
Definition: IRFrameRaw.h:49
int addTrackingLostCallbackU(const TrackingLostCallbackU callback, void *const userdata)
Add a handler for a TrackingLost event. Thread-safe.
Definition: VideoWorker.h:2968
int addMatchFoundCallbackExt(const MatchFoundCallbackFuncExt callback, void *const userdata)
Add a handler for a MatchFound event. Thread-safe.
Definition: VideoWorker.h:2913
TemplateCreated callback data.
Definition: VideoWorker.h:655
Interface object that stores a captured face sample.
Definition: RawSample.h:125
std::vector< SampleCheckStatus::Verdict > samples_good_face_size
The result of checking the sample for suitable face size, see the min_template_generation_face_size p...
Definition: VideoWorker.h:408
int addMatchFoundCallback(const MatchFoundCallbackFunc callback, void *const userdata)
Add a handler for a MatchFound event. Thread-safe.
Definition: VideoWorker.h:2894
Params & video_worker_config(const pbio::Config value)
Set the VideoWorker configuration file with optionally overridden parameters.
Definition: VideoWorker.h:101
int32_t ir_data_stride_in_bytes
Stride in bytes.
Definition: IRFrameRaw.h:91
int ir_frame_cols
Width of an IR frame.
Definition: IRFrameRaw.h:35
SmartPtr.
void removeTrackingLostCallback(const int callback_id)
Remove a handler for TrackingLost event. Thread-safe.
Definition: VideoWorker.h:3063
float distance_threshold
Distance threshold for a MatchFound event.
Definition: VideoWorker.h:1481
Params & emotions_estimation_threads_count(const int value)
Set the number of threads for estimation of emotions.
Definition: VideoWorker.h:143
int64_t stream_id
Integer id of the video stream (0 <= stream_id < streams_count).
Definition: VideoWorker.h:915
IRLivenessEstimator is an interface object used to estimate face liveness in order to prevent spoofin...
int64_t track_id
ID of the lost face (track_id). track_id is equal to sample.getID() for a sample given in any VideoWo...
Definition: VideoWorker.h:1255
std::vector< bool > samples_weak
Since this is tracking, some samples may be false, so we mark the samples with the "weak" flag if the...
Definition: VideoWorker.h:356
Gender
Gender groups.
Definition: AgeGenderEstimator.h:98
float ir_frame_2_image_scale_x
Parameter of correspondence between the coordinates of an original image and an IR frame...
Definition: IRFrameRaw.h:56
int64_t sti_person_id
ID of "sti_person", which is a set of tracks formed by short time identification. sti_person_id is eq...
Definition: VideoWorker.h:1385
Params & short_time_identification_outdate_time_seconds(const float value)
Set outdate_time in seconds for short time identification.
Definition: VideoWorker.h:161
void disableAgeGenderEstimationOnStream(const int stream_id)
Disable age and gender estimation for a given stream. Thread-safe.
Definition: VideoWorker.h:3959
float depth_map_2_image_scale_y
Parameter of correspondence between the coordinates of the original image and depth map...
Definition: DepthMapRaw.h:63
float depth_map_2_image_offset_x
Parameter of correspondence between the coordinates of the original image and depth map...
Definition: DepthMapRaw.h:42
Definition: FacerecService.mm:79
Database element. If you have several face templates for one person, you should create one element fo...
Definition: VideoWorker.h:1434
float vertical_fov
The vertical viewing angle of the depth map in degrees.
Definition: DepthMapRaw.h:77
StiPersonOutdated callback data.
Definition: VideoWorker.h:1361
void(* MatchFoundCallbackU)(const MatchFoundCallbackData &data, void *const userdata)
Callback function type for a MatchFound event.
Definition: VideoWorker.h:1058
int addVideoFrame(const RawImage frame, const int stream_id, const uint64_t timestamp_microsec=uint64_t(-1))
Add a new video frame for a specific video stream. Tracking and recognition results will be returned ...
Definition: VideoWorker.h:2689
std::vector< SearchResult > search_results
Found elements with a distance less than distance_threshold (but not more than k nearest elements...
Definition: VideoWorker.h:981
double best_quality
Best sample quality over all frames.
Definition: VideoWorker.h:1207
CheckType
Check type for active liveness.
Definition: ActiveLiveness.h:14
int64_t best_quality_frame_id
Integer id of the frame of the best quality.
Definition: VideoWorker.h:1217
uint64_t person_id
Unique id of the person.
Definition: VideoWorker.h:1452
void addIRFrame(const IRFrameRaw &ir_frame, const int stream_id, const uint64_t timestamp_microsec)
Add a new IR frame for a specific stream. Thread-safe.
Definition: VideoWorker.h:2750
Params & streams_count(const int value)
Set the number of video streams.
Definition: VideoWorker.h:119
Tracking callback data.
Definition: VideoWorker.h:274
int addTrackingCallback(const TrackingCallbackFunc callback, void *const userdata)
Add a handler for a Tracking event. Thread-safe.
Definition: VideoWorker.h:2819
void(* TrackingLostCallbackFuncU)(const TrackingLostCallbackData &data, void *const userdata)
Callback function type for a TrackingLost event (e.g. when a person leaves the frame).
Definition: VideoWorker.h:1347
Template::Ptr templ
Template created for this sample.
Definition: VideoWorker.h:959
std::string getMethodName() const
Get a method name of the recognizer used. Thread-safe.
Definition: VideoWorker.h:2605
Params()
Default constructor, set strings to empty, numbers to zero, flags to false.
Definition: VideoWorker.h:3986
void addDepthFrame(const DepthMapRaw &depth_frame, const int stream_id, const uint64_t timestamp_microsec)
Add a new depth frame for a specific stream. Thread-safe.
Definition: VideoWorker.h:2722
int ir_frame_rows
Height of an IR frame.
Definition: IRFrameRaw.h:28
void(* TrackingCallbackFunc)(const int stream_id, const int frame_id, const std::vector< RawSample::Ptr > &samples, const std::vector< bool > &samples_weak, const std::vector< float > &samples_quality, void *const userdata)
Callback function type for a Tracking event.
Definition: VideoWorker.h:258
int64_t frame_id
Integer id of the frame (that was returned by VideoWorker::addVideoFrame).
Definition: VideoWorker.h:298
std::vector< bool > samples_track_emotions_set
Flag indicating that emotions were estimated for this track. (samples_track_emotions_set.size() == samples.size())
Definition: VideoWorker.h:488
int addTrackingLostCallback(const TrackingLostCallbackFunc callback, void *const userdata)
Add a handler for a TrackingLost event. Thread-safe.
Definition: VideoWorker.h:2950
Template::Ptr face_template
Face template.
Definition: VideoWorker.h:1461
Params & short_time_identification_distance_threshold(const float value)
Set the recognition distance threshold for short time identification.
Definition: VideoWorker.h:155
Liveness
Estimated liveness.
Definition: DepthLivenessEstimator.h:50
void removeMatchFoundCallback(const int callback_id)
Remove a handler for MatchFound event. Thread-safe.
Definition: VideoWorker.h:3034
uint16_t const * depth_data
Pointer to the depth raw data.
Definition: DepthMapRaw.h:91
Params & recognizer_config(const pbio::Config value)
Set the Recognizer configuration file with optionally overridden parameters.
Definition: VideoWorker.h:113