Banuba SDK
recognizer.hpp
Go to the documentation of this file.
1 /// \file
2 /// \addtogroup Recognizer
3 /// @{
4 ///
5 // AUTOGENERATED FILE - DO NOT MODIFY!
6 // This file generated by Djinni from recognizer.djinni
7 
8 #pragma once
9 
11 #include <bnb/utils/defs.hpp>
12 #include <cstdint>
13 #include <memory>
14 #include <optional>
15 #include <unordered_set>
16 
17 namespace bnb { namespace interfaces {
18 
19 class feature;
20 enum class face_search_mode;
21 enum class feature_id;
22 enum class recognizer_mode;
23 
24 class BNB_EXPORT recognizer {
25 public:
26  virtual ~recognizer() {}
27 
28  /**
29  * @param max_tokens If greater than 0: recognizer will run processing on push-ed() frame only if it can "consume" a token -
30  * and will wait for the token to become available if all max_tokens tokens have been used up.
31  * Consumed tokens are "produced" again one-by-one when pop-ping() processed frame(s).
32  * This mode prevents processing frames more often than a consumer(e.g. renderer) can use:
33  * potentially reducing energy consumption at the cost of higher latency.
34  * Only for asynchronous mode.
35  */
36  static std::shared_ptr<recognizer> create(recognizer_mode mode, std::optional<int32_t> max_tokens);
37 
38  static int64_t get_feature_id(feature_id feature);
39 
40  virtual std::shared_ptr<feature> get_feature(feature_id feature) = 0;
41 
42  virtual void set_features(const std::unordered_set<feature_id> & features) = 0;
43 
44  virtual void add_feature(const std::shared_ptr<feature> & feature, const std::unordered_set<feature_id> & dependencies, bool needs_gpu) = 0;
45 
46  virtual void remove_feature(const std::shared_ptr<feature> & feature) = 0;
47 
48  /** sets maximum allowed face results, if face tracking feature is present */
49  virtual void set_max_faces(int32_t num) = 0;
50 
51  virtual void set_offline_mode(bool on) = 0;
52 
53  /**
54  * Set flag which enable NN's features. True by default, if device compatible with NN player
55  * When this flag is false, recognizer will skip NN-dependent features during set_features call.
56  * In case when device have no NN player support (is_device_nn_compatible return false),
57  * setting enable to true have no any effect
58  */
59  virtual void set_nn_enable(bool enable) = 0;
60 
61  virtual bool get_nn_enable() const = 0;
62 
63  /** Check if device compatible with NN player. */
64  virtual bool is_device_nn_compatible() = 0;
65 
66  /** Clear pipeline state and set face search mode */
67  virtual void set_face_search_mode(face_search_mode mode) = 0;
68 
69  virtual void process(const std::shared_ptr<::bnb::interfaces::frame_data> & frame_data) = 0;
70 
71  virtual void push_camera_frame(const std::shared_ptr<::bnb::interfaces::frame_data> & input_frame_data) = 0;
72 
73  virtual bool pop_frame_data(const std::shared_ptr<::bnb::interfaces::frame_data> & output_frame_data) = 0;
74 
75  /** start the recognizer */
76  virtual void start() = 0;
77 
78  /** pause the recognizer */
79  virtual void pause() = 0;
80 
81  /** pause + clear */
82  virtual void stop() = 0;
83 
84  /** clear input and output buffers and pipeline state, also clean cached features */
85  virtual void clear() = 0;
86 };
87 
88 } } // namespace bnb::interfaces
89 /// @}
90 
bnb::interfaces::recognizer::set_max_faces
virtual void set_max_faces(int32_t num)=0
sets maximum allowed face results, if face tracking feature is present
frame_data.hpp
bnb::interfaces::recognizer::stop
virtual void stop()=0
pause + clear
bnb::interfaces::recognizer::is_device_nn_compatible
virtual bool is_device_nn_compatible()=0
Check if device compatible with NN player.
bnb::interfaces::recognizer
Definition: recognizer.hpp:24
bnb::interfaces::recognizer::start
virtual void start()=0
start the recognizer
bnb::interfaces::recognizer::set_face_search_mode
virtual void set_face_search_mode(face_search_mode mode)=0
Clear pipeline state and set face search mode.
bnb::interfaces::recognizer::set_nn_enable
virtual void set_nn_enable(bool enable)=0
Set flag which enable NN's features.
bnb::interfaces::feature
Definition: feature.hpp:18
bnb::interfaces::recognizer::create
static std::shared_ptr< recognizer > create(recognizer_mode mode, std::optional< int32_t > max_tokens)
bnb::interfaces::frame_data
getters throw exceptions when data are not available android NNs usually output gpu masks
Definition: frame_data.hpp:37
bnb::interfaces::recognizer::clear
virtual void clear()=0
clear input and output buffers and pipeline state, also clean cached features
bnb::interfaces::recognizer::pause
virtual void pause()=0
pause the recognizer