#include <filesystem>
#include <fstream>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <opencv2/opencv.hpp>
Functions | |
void | find_all_images (const std::filesystem::path &root_directory) |
Perform a recursive directory search to find all the images. More... | |
std::string | lowercase (const std::string &raw) |
int | main (int argc, char *argv[]) |
void | parse_names_file (const std::filesystem::path &names_file) |
Read the .names file and find all of the corner indexes we need to resize. More... | |
void | process_images () |
Loop through all of the images and resize the corner annotations. More... | |
Variables | |
std::vector< std::string > | annotated_image_filenames |
These are all of the images with annotations that we need to process. More... | |
const int | corner_size = 16 |
Size to use for corner rectangles. More... | |
std::map< int, std::string > | corners |
Annotation indexes, such as 0 -> "tl", 1 -> "tr", ... More... | |
std::map< std::string, int > | indexes |
Annotation indexes, such as "tl" -> 0, "tr" -> 1, ... More... | |
This simple tool looks for classes named "TL", "TR", "BL", and "BR". This is typically used to indicate the corners of objects, where "TL" is "top-left", "BR is "bottom-right", etc. If it finds any of these classes, the tool will then read through all of the existing annotations, resize the corners to a specific size, and re-write the annotation files with the new sizes.
void find_all_images | ( | const std::filesystem::path & | root_directory | ) |
Perform a recursive directory search to find all the images.
Then we exclude anything in DarkMark's image cache or which doesn't have an annotation file. Results are stored in the global variable annotated_image_filenames.
References annotated_image_filenames, and lowercase().
Referenced by main().
std::string lowercase | ( | const std::string & | raw | ) |
Referenced by find_all_images(), and parse_names_file().
int main | ( | int | argc, |
char * | argv[] | ||
) |
References find_all_images(), parse_names_file(), and process_images().
void parse_names_file | ( | const std::filesystem::path & | names_file | ) |
Read the .names file and find all of the corner indexes we need to resize.
These classes will have names such as TL
, TR
, BR
, and BL
. The search for names is case-insensitive.
References corners, indexes, and lowercase().
Referenced by main().
void process_images | ( | ) |
Loop through all of the images and resize the corner annotations.
References annotated_image_filenames, corner_size, and corners.
Referenced by main().
std::vector<std::string> annotated_image_filenames |
These are all of the images with annotations that we need to process.
Referenced by find_all_images(), and process_images().
const int corner_size = 16 |
Size to use for corner rectangles.
Referenced by process_images().
std::map<int, std::string> corners |
Annotation indexes, such as 0 -> "tl", 1 -> "tr", ...
Referenced by parse_names_file(), and process_images().
std::map<std::string, int> indexes |
Annotation indexes, such as "tl" -> 0, "tr" -> 1, ...
Referenced by parse_names_file().