Cpp-Processing
CommonParameters.h
1 #pragma once
2 #include <filesystem>
3 #include "CPUInfo.h"
4 #include <opencv4/opencv2/core.hpp>
5 // Ignore the warning for the unused include, it is here for the backward compatibility
6 #include <variant>
7 #include "CompilationParams.h"
8 #include "CelanturExceptions.h"
9 
10 namespace celantur {
35 enum class DetectionType {
36  Auto = 0,
37  None = 1,
38  BBox = 2,
39  Segmentation = 3,
40 };
41 
47 enum class BlurType {
48  None = 0,
49  BBox_Oval = 1,
50  BBox_Rectangle = 2,
51  Segmentation = 3,
52 };
53 
59 enum class CelanturClassId {
60  LicensePlate = 101,
61  Person = 102,
62  Face = 103,
63  Vehicle = 104,
64 };
65 
66 
85  float gradient_start{0.3};
86 
96  float gradient_stop{0.0};
106  float kernel_size{0.2f};
107 
114  bool beautify_blur{true};
115 
121 };
122 
129 typedef std::map<CelanturClassId, DetectionProcessingConfig> PerTypeProcessingConfig;
130 
135 {
136  {
140  0.3f,
141  0.0f,
142  1.0f,
143  true,
145  }
146  },
147  {
149  {
152  0.3f,
153  0.0f,
154  0.2f,
155  false,
157  }
158  }
159  },
160  {
164  0.3f,
165  0.0f,
166  0.2f,
167  true,
169  }
170  },
171  {
173  {
176  0.3f,
177  0.0f,
178  0.2f,
179  false,
181  }
182  }
183  },
184 };
185 
188  {
192  0.3f,
193  0.0f,
194  1.0f,
195  true,
197  }
198  },
199  {
203  0.3f,
204  0.0f,
205  0.2f,
206  false,
208  }
209  },
210  {
214  0.3f,
215  0.0f,
216  0.2f,
217  true,
219  }
220  },
221  {
225  0.3f,
226  0.0f,
227  0.2f,
228  false,
230  }
231  },
232 };
233 
235  {
239  0.3f,
240  0.0f,
241  1.0f,
242  true,
244  }
245  },
246  {
250  0.3f,
251  0.0f,
252  0.2f,
253  false,
255  }
256  },
257  {
261  0.3f,
262  0.0f,
263  0.2f,
264  true,
266  }
267  },
268  {
272  0.3f,
273  0.0f,
274  0.2f,
275  false,
277  }
278 
279  },
280 };
281 
293  std::filesystem::path inference_plugin;
295  int n_tiles_x{1};
297  int n_tiles_y{1};
299  float ol_x{0.0f};
301  float ol_y{0.0f};
303  bool swapRB{false};
305  cv::Rect_<float> roi{0.0f, 0.0f, 1.0f, 1.0f};
312  float nms_threshold{0.5f};
322  int queue_size{std::numeric_limits<int>::max()};
327 };
328 
329 
336 enum class Rotation {
337  None = 0,
338  Rotated90Clockwise = 1,
339  Rotated180 = 2,
341 };
347 
348 };
349 
355  int frame_number{-1};
356  int source_id{0};
357  bool vertical_flip{false};
358  bool horizontal_flip{false};
360 };
361 
366 struct MatContainer {
367  cv::Mat mat;
368  std::variant<ImageMetadata, FrameMetadata> metadata;
369 };
376 std::ostream& operator<<(std::ostream& os, const celantur::BlurType& blur_type);
377 std::istream& operator>>(std::istream& os, celantur::BlurType& blur_type);
378 
379 std::ostream& operator<<(std::ostream& os, const celantur::DetectionType& blur_type);
380 std::istream& operator>>(std::istream& os, celantur::DetectionType& blur_type);
381 
382 std::ostream& operator<<(std::ostream& os, const celantur::CelanturClassId& id);
383 std::istream& operator>>(std::istream& os, celantur::CelanturClassId& id);
386 } // namespace celantur
387 
388 
389 
const PerTypeProcessingConfig FACE_LICENSE_PLATE_PROCESSING_CONFIG
Default per-type processing configuration.
Definition: CommonParameters.h:134
std::istream & operator>>(std::istream &os, celantur::BlurType &blur_type)
Definition: CommonParameters.cpp:23
std::ostream & operator<<(std::ostream &os, const celantur::BlurType &blur_type)
Definition: CommonParameters.cpp:5
const PerTypeProcessingConfig DEFAULT_PER_TYPE_PROCESSING_CONFIG
Definition: CommonParameters.h:186
const PerTypeProcessingConfig PERSON_VEHICLE_PROCESSING_CONFIG
Definition: CommonParameters.h:187
Rotation
Enum to represent image rotation states. is used in celantur::FrameMetadata to describe the rotation ...
Definition: CommonParameters.h:336
const PerTypeProcessingConfig DETECT_ONLY_CONFIG
Definition: CommonParameters.h:234
DetectionType
Enum to describe the detection type in celantur::DetectionProcessingConfig.
Definition: CommonParameters.h:35
BlurType
Enum to describe the blur in celantur::DetectionProcessingConfig.
Definition: CommonParameters.h:47
std::map< CelanturClassId, DetectionProcessingConfig > PerTypeProcessingConfig
Configuration map for processing different detection types. This map associates each CelanturClassId ...
Definition: CommonParameters.h:129
CelanturClassId
Class ids enum that is used in celantur::CelanturDetection and celantur::DetectionProcessingConfig to...
Definition: CommonParameters.h:59
Definition: CelanturDetection.h:6
Configuration that describes processing of a particular class This structure contains the type of blu...
Definition: CommonParameters.h:73
bool beautify_blur
If true, applies additional beautification to the blur effect, making it visually more appealing....
Definition: CommonParameters.h:114
float gradient_stop
Responsible for the point where the blur is absolute. Value of 0.0 guarantees that the blur will be a...
Definition: CommonParameters.h:96
float kernel_size
Responsible for strength of the blur applied. Values between 0.0 and 1.0 are considered relative to t...
Definition: CommonParameters.h:106
BlurType blur_type
celantur::BlurType of blur to be applied to the detection.
Definition: CommonParameters.h:78
DetectionType detection_type
celantur::DetectionType of blur to be applied to the detection.
Definition: CommonParameters.h:120
float gradient_start
Responsible for the starting point of the gradient blur. Larger values mean that the blur starts furh...
Definition: CommonParameters.h:85
Metadata associated with a video frame. for now, just a placeholder.
Definition: CommonParameters.h:354
int frame_number
Definition: CommonParameters.h:355
int source_id
Definition: CommonParameters.h:356
bool vertical_flip
Definition: CommonParameters.h:357
Rotation rotation
Definition: CommonParameters.h:359
bool horizontal_flip
Definition: CommonParameters.h:358
Metadata associated with an image or frame. for now, just a placeholder.
Definition: CommonParameters.h:346
Container for an image and its associated metadata. for now, just a placeholder.
Definition: CommonParameters.h:366
std::variant< ImageMetadata, FrameMetadata > metadata
Definition: CommonParameters.h:368
cv::Mat mat
Definition: CommonParameters.h:367
Structure to hold model threshold values for different object classes. This structure contains thresh...
Definition: CompilationParams.h:93
Structure to hold parameters for the image processor. This structure contains various settings for co...
Definition: CommonParameters.h:287
bool swapRB
Swap Red and Blue channels. Useful when input data is in BGR format (when its loaded with OpenCV for ...
Definition: CommonParameters.h:303
int queue_size
Specifies the maximum size of the queue.
Definition: CommonParameters.h:322
float ol_y
Overlap of tiles in vertical direction as a fraction of image height.
Definition: CommonParameters.h:301
int n_tiles_x
Number of tiles in horizontal direction.
Definition: CommonParameters.h:295
cv::Rect_< float > roi
Region of interest. Measured from 0 to 1 The region of interest is a rectangle that defines the area ...
Definition: CommonParameters.h:305
std::filesystem::path inference_plugin
Definition: CommonParameters.h:293
ModelThresholds thresholds
The thresholds for the model.
Definition: CommonParameters.h:307
float ol_x
Overlap of tiles in horizontal direction as a fraction of image width.
Definition: CommonParameters.h:299
float nms_threshold
The NMS threshold (Non-Maximum Suppression threshold) is used during the process to eliminate redunda...
Definition: CommonParameters.h:312
PerTypeProcessingConfig per_type_processing_config
Fine-tuning the processing of detections based on their class.
Definition: CommonParameters.h:326
int n_tiles_y
Number of tiles in vertical direction.
Definition: CommonParameters.h:297