diff options
author | Michael Welter <michael@welter-4d.de> | 2022-05-17 07:50:55 +0200 |
---|---|---|
committer | Michael Welter <michael@welter-4d.de> | 2022-05-19 20:47:11 +0200 |
commit | f788d94a9ea446c7b687b4a8f3d4cfae41a61296 (patch) | |
tree | 7be48dd4e36cb8ece4f165defa425f16f8f08e38 /tracker-neuralnet/ftnoir_tracker_neuralnet.h | |
parent | 4d6e80a6c585f6929f6bf4bf319932732160ce84 (diff) |
tracker/nn: Add resolution setting and tooltips
Tooltips only for half of the settings or so. When hovering over the
actual input boxes.
Diffstat (limited to 'tracker-neuralnet/ftnoir_tracker_neuralnet.h')
-rw-r--r-- | tracker-neuralnet/ftnoir_tracker_neuralnet.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tracker-neuralnet/ftnoir_tracker_neuralnet.h b/tracker-neuralnet/ftnoir_tracker_neuralnet.h index 25f1a0a2..ace16528 100644 --- a/tracker-neuralnet/ftnoir_tracker_neuralnet.h +++ b/tracker-neuralnet/ftnoir_tracker_neuralnet.h @@ -25,6 +25,7 @@ #include <memory> #include <cinttypes> +#include <array> #include <onnxruntime_cxx_api.h> @@ -49,6 +50,23 @@ enum fps_choices fps_MAX = 3 }; +struct resolution_tuple +{ + int width; + int height; +}; + +static const std::array<resolution_tuple, 7> resolution_choices = +{{ + { 320, 240 }, + { 640, 480 }, + { 800, 600 }, + { 1024, 768 }, + { 1280, 720 }, + { 1920, 1080}, + { 0, 0 } +}}; + struct Settings : opts { value<int> offset_fwd { b, "offset-fwd", 200 }, // Millimeters @@ -62,6 +80,7 @@ struct Settings : opts { value<double> roi_zoom{ b, "roi-zoom", 1. }; value<bool> use_mjpeg { b, "use-mjpeg", false }; value<int> num_threads { b, "num-threads", 1 }; + value<int> resolution { b, "force-resolution", 0 }; Settings(); }; @@ -159,6 +178,7 @@ private: bool detect(); bool open_camera(); void set_intrinsics(); + cv::Mat prepare_input_image(const video::frame& frame); bool load_and_initialize_model(); void draw_gizmos( cv::Mat frame, @@ -176,6 +196,7 @@ private: CamIntrinsics intrinsics{}; cv::Mat frame, grayscale; + std::array<cv::Mat,2> downsized_original_images_ = {}; // Image pyramid std::optional<cv::Rect2f> last_localizer_roi; std::optional<cv::Rect2f> last_roi; static constexpr float head_size_mm = 200.f; @@ -202,6 +223,7 @@ public: void unregister_tracker() override; private: void make_fps_combobox(); + void make_resolution_combobox(); Ui::Form ui; Settings settings; |