DarkHelp  v1.9.2-1
C++ API for the neural network framework Darknet
Looking for a C++ dev who knows OpenCV?
I'm looking for work. Hire me!
DarkHelpUtils.hpp File Reference
#include "DarkHelp.hpp"
Include dependency graph for DarkHelpUtils.hpp:
This graph shows which files directly or indirectly include this file:

Namespaces

 DarkHelp
 The DarkHelp namespace contains (almost) everything in the DarkHelp library.
 

Functions

std::filesystem::path DarkHelp::combine (const std::string &key, const std::filesystem::path &cfg_filename, const std::filesystem::path &names_filename, const std::filesystem::path &weights_filename)
 Combine together the 3 files that make up a neural network, and obfuscate them using the given key phrase. More...
 
std::string DarkHelp::duration_string (const std::chrono::high_resolution_clock::duration duration)
 Format a duration as a text string which is typically added to images or video frames during annotation. More...
 
size_t DarkHelp::edit_cfg_file (const std::string &cfg_filename, MStr m)
 This is used to insert lines into the [net] section of the configuration file. More...
 
void DarkHelp::extract (const std::string &key, const std::filesystem::path &bundle, std::filesystem::path &cfg_filename, std::filesystem::path &names_filename, std::filesystem::path &weights_filename)
 Extract the 3 files that make up a neural network. More...
 
cv::Mat DarkHelp::fast_resize_ignore_aspect_ratio (const cv::Mat &mat, const cv::Size &desired_size)
 Resize the given image as quickly as possible to the given dimensions. More...
 
void DarkHelp::fix_out_of_bound_normalized_rect (float &cx, float &cy, float &w, float &h)
 Automatically called by DarkHelp::NN::predict_internal() when DarkHelp::Config::fix_out_of_bound_values has been set. More...
 
VColours DarkHelp::get_default_annotation_colours ()
 Obtain a vector of at least 25 different bright colours that may be used to annotate images. More...
 
void DarkHelp::pixelate_rectangle (const cv::Mat &src, cv::Mat &dst, const cv::Rect &r, const int size=15)
 Pixelate the given rectangle. More...
 
void DarkHelp::pixelate_rectangles (const cv::Mat &src, cv::Mat &dst, const PredictionResults &prediction_results, const int size=15)
 Pixelate all of the predictions. More...
 
void DarkHelp::pixelate_rectangles (const cv::Mat &src, cv::Mat &dst, const PredictionResults &prediction_results, const std::set< int > &class_filter, const int size=15)
 Pixelate only the predictions where the class ID matches a value in the class filter. More...
 
void DarkHelp::pixelate_rectangles (const cv::Mat &src, cv::Mat &dst, const VRect &rects, const int size=15)
 Pixelate all of the rectangles. More...
 
cv::Mat DarkHelp::resize_keeping_aspect_ratio (cv::Mat mat, const cv::Size &desired_size)
 Convenience function to resize an image yet retain the exact original aspect ratio. More...
 
cv::Mat DarkHelp::slow_resize_ignore_aspect_ratio (const cv::Mat &mat, const cv::Size &desired_size)
 Similar to DarkHelp::fast_resize_ignore_aspect_ratio() but uses OpenCV algorithms that result in better quality images at a cost of slower speed. More...
 
void DarkHelp::toggle_output_redirection ()
 Toggle STDOUT and STDERR output redirection. More...
 
MStr DarkHelp::verify_cfg_and_weights (std::string &cfg_filename, std::string &weights_filename, std::string &names_filename)
 Look at the names and/or the contents of all 3 files and swap the filenames around if necessary so the .cfg, .weights, and .names are assigned where they should be. More...
 
std::string DarkHelp::version ()
 Get a version string for the DarkHelp library. E.g., could be 1.0.0-123. More...
 
bool DarkHelp::yolo_annotations_file_exists (const std::string &image_filename)
 Check to see if the given image has a corresponding .txt file for YOLO annotations. More...
 
std::string DarkHelp::yolo_annotations_filename (const std::string &image_filename)
 Given an image filename, get the corresponding filename where the YOLO annotations should be saved. More...
 
PredictionResults DarkHelp::yolo_load_annotations (const cv::Size &image_size, const std::string &filename)
 Load the YOLO annotations from file. More...
 
cv::Mat DarkHelp::yolo_load_image_and_annotations (const std::string &image_filename, PredictionResults &annotations)
 Load the given image and read in the corresponding YOLO annotations from the .txt file. More...
 
std::string DarkHelp::yolo_save_annotations (const std::string &filename, const PredictionResults &annotations)
 Save the given annotations to the .txt file. More...
 

Detailed Description

DarkHelp's utility functions.