#include "DarkHelp.hpp"
#include <random>
#include <chrono>
#include <fstream>
#include <atomic>
#include <map>
#include <vector>
#include <deque>
#include <string>
#include <ctime>
#include <csignal>
#include <tclap/CmdLine.h>
#include "json.hpp"
#include <unistd.h>
#include <magic.h>
Classes | |
class | DirExistConstraint |
class | DriverConstraint |
class | FileExistConstraint |
class | FloatConstraint |
class | IntConstraint |
struct | Options |
class | OutputImageConstraint |
class | WxHConstraint |
Functions | |
void | cli_signal_handler (int sig) |
void | display_current_msg (Options &options, cv::Mat output_image, int &delay_in_milliseconds) |
bool | get_bool (TCLAP::ValueArg< std::string > &arg) |
cv::Size | get_WxH (const std::string &text) |
cv::Size | get_WxH (TCLAP::ValueArg< std::string > &arg) |
void | init (Options &options, int argc, char *argv[]) |
int | main (int argc, char *argv[]) |
void | process_image (Options &options) |
void | process_video (Options &options) |
void | set_msg (Options &options, const std::string &msg) |
void | show_help_window () |
Variables | |
const int | KEY_c = 0x63 |
const int | KEY_COMPLEX_MASK = 0x00ffffff |
const int | KEY_d = 0x64 |
const int | KEY_DOWN = 0x0010ff54 |
const int | KEY_END = 0x0010ff57 |
const int | KEY_ESC = 0x1b |
const int | KEY_g = 0x67 |
const int | KEY_h = 0x68 |
const int | KEY_HOME = 0x0010ff50 |
const int | KEY_l = 0x6c |
const int | KEY_LEFT = 0x0010ff51 |
const int | KEY_p = 0x70 |
const int | KEY_PAGE_DOWN = 0x0010ff56 |
const int | KEY_PAGE_UP = 0x0010ff55 |
const int | KEY_q = 0x71 |
const int | KEY_RIGHT = 0x0010ff53 |
const int | KEY_s = 0x73 |
const int | KEY_SIMPLE_MASK = 0xff |
const int | KEY_t = 0x74 |
const int | KEY_u = 0x75 |
const int | KEY_UP = 0x0010ff52 |
const int | KEY_w = 0x77 |
std::atomic< bool > | signal_raised = false |
void cli_signal_handler | ( | int | sig | ) |
void display_current_msg | ( | Options & | options, |
cv::Mat | output_image, | ||
int & | delay_in_milliseconds | ||
) |
References DarkHelp::Config::annotation_font_face, DarkHelp::Config::annotation_font_scale, DarkHelp::Config::annotation_font_thickness, DarkHelp::NN::config, Options::message_text, Options::message_time, and Options::nn.
Referenced by process_image().
bool get_bool | ( | TCLAP::ValueArg< std::string > & | arg | ) |
cv::Size get_WxH | ( | const std::string & | text | ) |
Referenced by WxHConstraint::check(), get_WxH(), and init().
cv::Size get_WxH | ( | TCLAP::ValueArg< std::string > & | arg | ) |
void init | ( | Options & | options, |
int | argc, | ||
char * | argv[] | ||
) |
References Options::all_files, DarkHelp::Config::annotation_auto_hide_labels, DarkHelp::Config::annotation_font_scale, DarkHelp::Config::annotation_include_duration, DarkHelp::Config::annotation_include_timestamp, DarkHelp::Config::annotation_line_thickness, DarkHelp::Config::annotation_pixelate_enabled, DarkHelp::Config::annotation_shade_predictions, DarkHelp::Config::annotation_suppress_all_labels, Options::cfg_fn, DarkHelp::NN::config, Options::done, DarkHelp::NN::duration_string(), DarkHelp::Config::enable_debug, DarkHelp::Config::enable_tiles, Options::file_index, Options::force_greyscale, get_bool(), get_WxH(), DarkHelp::Config::hierarchy_threshold, Options::image_type, Options::in_slideshow, DarkHelp::NN::init(), Options::json, DarkHelp::kDarknet, Options::keep_annotated_images, DarkHelp::kOpenCV, DarkHelp::kOpenCVCPU, Options::magic_cookie, DarkHelp::NN::names, Options::names_fn, DarkHelp::Config::names_include_percentage, DarkHelp::NN::network_size(), Options::neural_network_name, Options::nn, DarkHelp::Config::non_maximal_suppression_threshold, Options::out_dir, DarkHelp::Config::redirect_darknet_output, signal_raised, Options::size1, Options::size1_is_set, Options::size2, Options::size2_is_set, DarkHelp::Config::snapping_enabled, DarkHelp::Config::snapping_horizontal_tolerance, DarkHelp::Config::snapping_vertical_tolerance, DarkHelp::Config::threshold, DarkHelp::Config::tile_edge_factor, DarkHelp::Config::tile_rect_factor, Options::use_json_output, DarkHelp::verify_cfg_and_weights(), Options::wait_time_in_milliseconds_for_slideshow, and Options::weights_fn.
Referenced by DarkHelp::DHThreads::init(), DarkHelp::NN::init(), and main().
int main | ( | int | argc, |
char * | argv[] | ||
) |
References Options::all_files, cli_signal_handler(), Options::done, Options::file_index, Options::filename, init(), Options::json, Options::keep_annotated_images, Options::magic_cookie, Options::out_dir, process_image(), process_video(), set_msg(), signal_raised, and Options::use_json_output.
void process_image | ( | Options & | options | ) |
References Options::all_files, DarkHelp::NN::annotate(), DarkHelp::Config::annotation_auto_hide_labels, DarkHelp::Config::annotation_include_duration, DarkHelp::Config::annotation_shade_predictions, DarkHelp::Config::annotation_suppress_all_labels, DarkHelp::Config::combine_tile_predictions, DarkHelp::NN::config, display_current_msg(), Options::done, DarkHelp::NN::duration_string(), DarkHelp::Config::enable_tiles, Options::file_index, Options::filename, Options::force_greyscale, DarkHelp::NN::horizontal_tiles, Options::image_type, Options::in_slideshow, Options::json, Options::keep_annotated_images, KEY_c, KEY_COMPLEX_MASK, KEY_d, KEY_DOWN, KEY_END, KEY_ESC, KEY_g, KEY_h, KEY_HOME, KEY_l, KEY_LEFT, KEY_p, KEY_PAGE_DOWN, KEY_PAGE_UP, KEY_q, KEY_s, KEY_SIMPLE_MASK, KEY_t, KEY_u, KEY_UP, KEY_w, DarkHelp::NN::names, Options::neural_network_name, Options::nn, Options::out_dir, DarkHelp::NN::predict(), DarkHelp::resize_keeping_aspect_ratio(), set_msg(), show_help_window(), Options::size1, Options::size1_is_set, Options::size2, Options::size2_is_set, DarkHelp::Config::snapping_enabled, DarkHelp::Config::threshold, DarkHelp::NN::tile_size, Options::use_json_output, DarkHelp::NN::vertical_tiles, and Options::wait_time_in_milliseconds_for_slideshow.
Referenced by main().
void process_video | ( | Options & | options | ) |
References DarkHelp::NN::annotate(), DarkHelp::Config::annotation_include_duration, DarkHelp::NN::config, DarkHelp::NN::duration, Options::file_index, Options::filename, Options::force_greyscale, DarkHelp::NN::horizontal_tiles, Options::json, Options::neural_network_name, Options::nn, Options::out_dir, DarkHelp::NN::predict(), DarkHelp::resize_keeping_aspect_ratio(), signal_raised, Options::size1, Options::size1_is_set, Options::size2, Options::size2_is_set, DarkHelp::NN::tile_size, Options::use_json_output, and DarkHelp::NN::vertical_tiles.
Referenced by main().
void set_msg | ( | Options & | options, |
const std::string & | msg | ||
) |
References Options::message_text, and Options::message_time.
Referenced by main(), and process_image().
void show_help_window | ( | ) |
const int KEY_c = 0x63 |
Referenced by process_image().
const int KEY_COMPLEX_MASK = 0x00ffffff |
Referenced by process_image().
const int KEY_d = 0x64 |
Referenced by process_image().
const int KEY_DOWN = 0x0010ff54 |
Referenced by process_image().
const int KEY_END = 0x0010ff57 |
Referenced by process_image().
const int KEY_ESC = 0x1b |
Referenced by process_image().
const int KEY_g = 0x67 |
Referenced by process_image().
const int KEY_h = 0x68 |
Referenced by process_image().
const int KEY_HOME = 0x0010ff50 |
Referenced by process_image().
const int KEY_l = 0x6c |
Referenced by process_image().
const int KEY_LEFT = 0x0010ff51 |
Referenced by process_image().
const int KEY_p = 0x70 |
Referenced by process_image().
const int KEY_PAGE_DOWN = 0x0010ff56 |
Referenced by process_image().
const int KEY_PAGE_UP = 0x0010ff55 |
Referenced by process_image().
const int KEY_q = 0x71 |
Referenced by process_image().
const int KEY_RIGHT = 0x0010ff53 |
const int KEY_s = 0x73 |
Referenced by process_image().
const int KEY_SIMPLE_MASK = 0xff |
Referenced by process_image().
const int KEY_t = 0x74 |
Referenced by process_image().
const int KEY_u = 0x75 |
Referenced by process_image().
const int KEY_UP = 0x0010ff52 |
Referenced by process_image().
const int KEY_w = 0x77 |
Referenced by process_image().
std::atomic<bool> signal_raised = false |
Referenced by cli_signal_handler(), init(), main(), and process_video().