Cpp-Processing
CelanturSDKInterface.h
1 #pragma once
2 
3 #include <filesystem>
4 #include <opencv4/opencv2/core/types.hpp>
5 #include "CelanturDetection.h"
6 #include "CommonParameters.h"
7 
8 namespace celantur {
9  class Processor;
10 }
11 
12 
13 namespace CelanturSDK {
17  class Processor;
18 
25  int context_width = 1280;
26  int context_height = 1280;
27  };
28 
34  std::filesystem::path inference_plugin;
35  };
36 
44  class License {
45  friend class Processor;
46  public:
47  License(std::filesystem::path license_path);
48  License(const License& other);
49  License& operator=(const License& other);
50  License(License&& other) noexcept;
51  License& operator=(License&& other) noexcept;
52  ~License();
53  public:
54  void* _pimpl;
55  };
56 
57 
64  class ModelCompiler {
65  public:
66  ModelCompiler(std::filesystem::path license, ModelCompilerParams params);
67  ModelCompiler(const ModelCompiler& other);
68  ModelCompiler& operator=(const ModelCompiler& other);
69  ModelCompiler(ModelCompiler&& other) noexcept;
70  ModelCompiler& operator=(ModelCompiler&& other) noexcept;
72 
80  celantur::InferenceEnginePluginCompileSettings preload_model(std::filesystem::path model_path);
81 
92  void compile_model(celantur::InferenceEnginePluginCompileSettings settings, std::filesystem::path output_path);
93  private:
94  License _license;
95  void* _pimpl;
96  };
97 
98 
106  class Processor {
107  public:
118  Processor(celantur::ProcessorParams params, std::filesystem::path license_path);
119  Processor(const Processor& other);
120  Processor& operator=(const Processor& other);
121  Processor(Processor&& other);
122  Processor& operator=(Processor&& other);
123 
129  celantur::InferenceEnginePluginSettings get_inference_settings(std::filesystem::path model_path);
130 
139 
145  [[deprecated("Using this method does not allow for model-specific settings that are needed for OpenVINO and TensorRT plugins\n \
146  use celantur::InferenceEnginePluginSettings get_inference_settings(std::filesystem::path model_path instead\n \
147  To get better access to the new features for all inference plugins")]]
149 
159  [[deprecated("Using this method does not allow for model-specific settings that are needed for OpenVINO and TensorRT plugins\n \
160  use celantur::InferenceEnginePluginSettings get_inference_settings(std::filesystem::path model_path instead\n \
161  To get better access to the new features for all inference plugins")]]
163 
164  ~Processor();
165 
173  void process(cv::Mat mat);
174 
183  cv::Mat get_result();
184 
191  std::vector<celantur::CelanturDetection> get_detections();
192 
193  private:
194  void* _pimpl;
195  License _license;
196  };
197 } // namespace CelanturSDK
198 //
This class represents a loaded into memory license file;.
Definition: CelanturSDKInterface.h:44
License & operator=(const License &other)
Definition: CelanturSDKInterface.cpp:49
~License()
Definition: CelanturSDKInterface.cpp:69
void * _pimpl
Definition: CelanturSDKInterface.h:54
License(std::filesystem::path license_path)
Definition: CelanturSDKInterface.cpp:25
This class is used to compile the model for the inference engine plugin;.
Definition: CelanturSDKInterface.h:64
~ModelCompiler()
Definition: CelanturSDKInterface.cpp:264
ModelCompiler(std::filesystem::path license, ModelCompilerParams params)
Definition: CelanturSDKInterface.cpp:222
void compile_model(celantur::InferenceEnginePluginCompileSettings settings, std::filesystem::path output_path)
Compile the preloaded model with the given settings and save it to the given output path;.
Definition: CelanturSDKInterface.cpp:294
ModelCompiler & operator=(const ModelCompiler &other)
Definition: CelanturSDKInterface.cpp:242
celantur::InferenceEnginePluginCompileSettings preload_model(std::filesystem::path model_path)
Preload the model from the given path and return the settings that are needed to compile the model;.
Definition: CelanturSDKInterface.cpp:273
This the main class of SDK is used to process images and obtain the results.
Definition: CelanturSDKInterface.h:106
Processor & operator=(const Processor &other)
Definition: CelanturSDKInterface.cpp:139
Processor(celantur::ProcessorParams params, std::filesystem::path license_path)
Construct the processor object with the given Processor parameters and a path to the license file;.
Definition: CelanturSDKInterface.cpp:115
cv::Mat get_result()
get anonymised image that was processed by process() method
Definition: CelanturSDKInterface.cpp:105
std::vector< celantur::CelanturDetection > get_detections()
get the detections that were found in the last image that was processed; Note that this is necessary ...
Definition: CelanturSDKInterface.cpp:99
void process(cv::Mat mat)
Enqueue the given image (mat) for processing; This function is non-blocking and returns immediately;.
Definition: CelanturSDKInterface.cpp:110
celantur::InferenceEnginePluginSettings get_inference_settings()
Get the inference engine plugin settings;.
Definition: CelanturSDKInterface.cpp:184
~Processor()
Definition: CelanturSDKInterface.cpp:162
void load_inference_model(celantur::InferenceEnginePluginSettings settings, AdditionalProcessorParams params=AdditionalProcessorParams())
Load the preloaded inference model with the given settings;.
Definition: CelanturSDKInterface.cpp:215
std::map< std::string, std::any > InferenceEnginePluginCompileSettings
The settings for compiling the model for the inference engine. The settings are passed as a map of ke...
Definition: CompilationParams.h:107
std::map< std::string, std::any > InferenceEnginePluginSettings
The settings for the inference engine used during runtime. The settings are passed as a map of key-va...
Definition: CompilationParams.h:101
Definition: CelanturSDKInterface.h:13
Definition: CelanturDetection.h:6
This struct contains the parameters for the Processor class.
Definition: CelanturSDKInterface.h:24
int context_width
Definition: CelanturSDKInterface.h:25
int context_height
Definition: CelanturSDKInterface.h:26
This struct contains the parameters for the ModelCompiler class.
Definition: CelanturSDKInterface.h:33
std::filesystem::path inference_plugin
Definition: CelanturSDKInterface.h:34
Structure to hold parameters for the image processor. This structure contains various settings for co...
Definition: CommonParameters.h:134