Cpp-Processing
Functions
Detection Utilities

Utilities to work with celantur::CelanturDetection. More...

Collaboration diagram for Detection Utilities:

Functions

void celantur::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. More...
 
std::vector< CelanturDetectioncelantur::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 vector of CelanturDetection objects and filters them according to the specified thresholds for each class. More...
 
std::vector< CelanturDetectioncelantur::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 objects and filters them to include only those whose class names are present in the provided set. More...
 
std::vector< CelanturDetectioncelantur::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 to include only those whose class IDs are present in the provided set. More...
 
cv::Mat celantur::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 CelanturDetection objects, and draws bounding boxes and class labels on the image to visualize the detections. Can be used for debug purposes. More...
 

Detailed Description

Utilities to work with celantur::CelanturDetection.

Function Documentation

◆ filter_detections_by_class()

std::vector< CelanturDetection > celantur::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 to include only those whose class IDs are present in the provided set.

Parameters
detectionsThe vector of CelanturDetection objects to be filtered.
classesA set of CelanturClassId to filter by.
Returns
A vector of CelanturDetection objects whose class IDs are in the provided set.

References celantur::CelanturDetection::class_id.

◆ filter_detections_by_class_name()

std::vector< CelanturDetection > celantur::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 objects and filters them to include only those whose class names are present in the provided set.

Parameters
detectionsThe vector of CelanturDetection objects to be filtered.
classesA set of class names to filter by.
Returns
A vector of CelanturDetection objects whose class names are in the provided set.

References celantur::CelanturDetection::class_name.

◆ filter_detections_by_threshold()

std::vector< CelanturDetection > celantur::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 vector of CelanturDetection objects and filters them according to the specified thresholds for each class.

Parameters
detectionsThe vector of CelanturDetection objects to be filtered.
thresholdsThe ModelThresholds object containing the confidence thresholds for each class.
Returns
A vector of CelanturDetection objects that meet or exceed the specified thresholds.

References celantur::CelanturDetection::class_id, celantur::CelanturDetection::confidence, celantur::ModelThresholds::face, celantur::ModelThresholds::license_plate, celantur::ModelThresholds::person, and celantur::ModelThresholds::vehicle.

◆ serialise_image_metrics_to_json()

void celantur::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.

Parameters
imageThe input image as a cv::Mat object.
detectionsThe vector of CelanturDetection objects to be serialized.
image_nameThe name of the image (filename or custom identifier).
input_folderThe input folder path where the image is located.
osThe output stream where the JSON will be written.

◆ visualise_detections()

cv::Mat celantur::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 CelanturDetection objects, and draws bounding boxes and class labels on the image to visualize the detections. Can be used for debug purposes.

Parameters
imageThe input image as a cv::Mat object.
detectionsThe vector of CelanturDetection objects to be visualized.
Returns
A new cv::Mat object with the detections drawn on it.

References celantur::CelanturDetection::box, celantur::CelanturDetection::class_name, and celantur::CelanturDetection::segm_mask.