Cpp-Processing
detections-utils.h
1 #pragma once
2 
3 #include <opencv2/core.hpp>
4 #include <vector>
5 #include "CelanturDetection.h"
6 #include "CommonParameters.h"
7 #include "opencv2/core/mat.hpp"
8 #include <set>
9 
10 
11 namespace celantur {
33  void serialise_image_metrics_to_json(cv::Mat image, std::vector<CelanturDetection> detections, std::string image_name, std::string input_folder, std::ostream &os);
34 
35 
42  std::vector<CelanturDetection> deserialise_image_metrics_from_json(std::string_view is);
43 
44 
53  std::vector<CelanturDetection> filter_detections_by_threshold(const std::vector<CelanturDetection>& detections, const ModelThresholds& thresholds);
54 
63  std::vector<CelanturDetection> filter_detections_by_class_name(const std::vector<CelanturDetection>& detections, const std::set<std::string>& classes);
64 
73  std::vector<CelanturDetection> filter_detections_by_class(const std::vector<CelanturDetection>& detections, const std::set<CelanturClassId>& classes);
74 
75 
76 
86  cv::Mat generate_binary_mask(const cv::Size& image_size, const std::vector<CelanturDetection>& detections, PerTypeProcessingConfig config);
87 
96  cv::Mat visualise_detections(const cv::Mat image, std::vector<CelanturDetection> detections);
97 
98  std::string detection_to_yolo_repr(const CelanturDetection& detection, const cv::Size& image_size);
99  std::string detections_to_yolo_repr(const std::vector<CelanturDetection>& detections, const cv::Size& image_size);
101 }
102 
103 
104 
std::string detection_to_yolo_repr(const CelanturDetection &detection, const cv::Size &image_size)
Definition: detection-utils.cpp:219
std::string detections_to_yolo_repr(const std::vector< CelanturDetection > &detections, const cv::Size &image_size)
Definition: detection-utils.cpp:211
std::map< CelanturClassId, DetectionProcessingConfig > PerTypeProcessingConfig
Configuration map for processing different detection types. This map associates each CelanturClassId ...
Definition: CommonParameters.h:129
cv::Mat generate_binary_mask(const cv::Size &image_size, const std::vector< CelanturDetection > &detections, PerTypeProcessingConfig config)
Generate a binary mask for a specific class from detections. This function creates a binary mask imag...
Definition: detection-utils.cpp:124
std::vector< CelanturDetection > deserialise_image_metrics_from_json(std::string_view is)
Construct detections vector from the JSON string.
Definition: detection-utils.cpp:59
std::vector< CelanturDetection > filter_detections_by_class(const std::vector< CelanturDetection > &detections, const std::set< CelanturClassId > &classes)
Filter detections by type. This function takes a vector of CelanturDetection objects and filters them...
Definition: detection-utils.cpp:112
std::vector< CelanturDetection > filter_detections_by_class_name(const std::vector< CelanturDetection > &detections, const std::set< std::string > &classes)
Filter detections based on a set of class names. This function takes a vector of CelanturDetection ob...
Definition: detection-utils.cpp:100
void serialise_image_metrics_to_json(cv::Mat image, std::vector< CelanturDetection > detections, std::string image_name, std::string input_folder, std::ostream &os)
serialise detections to JSON format. Is identical to the celantur-container functionality.
Definition: detection-utils.cpp:32
std::vector< CelanturDetection > filter_detections_by_threshold(const std::vector< CelanturDetection > &detections, const ModelThresholds &thresholds)
Filter detections based on confidence thresholds for different object classes. This function takes a ...
Definition: detection-utils.cpp:83
cv::Mat visualise_detections(const cv::Mat image, std::vector< CelanturDetection > detections)
Visualise detections on an image. This function takes an input image and a vector of CelanturDetectio...
Definition: detection-utils.cpp:170
Definition: CelanturDetection.h:6