diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2021-08-29 03:15:32 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2021-08-29 03:54:17 +0200 |
commit | e2405afeae0adfa32bde63a182e5f605ac8e8f16 (patch) | |
tree | aa5f8ddcfd289cca521915a0487538e3cdf3f3b6 /tracker-pt | |
parent | 48d1d1a06eb6acad0b0f436dcc73a19b408edb32 (diff) |
tracker/pt, video/opencv: allow mjpeg media type
Diffstat (limited to 'tracker-pt')
-rw-r--r-- | tracker-pt/ftnoir_tracker_pt_dialog.cpp | 3 | ||||
-rw-r--r-- | tracker-pt/module/camera.cpp | 8 | ||||
-rw-r--r-- | tracker-pt/pt-api.hpp | 1 | ||||
-rw-r--r-- | tracker-pt/pt-settings.hpp | 1 |
4 files changed, 10 insertions, 3 deletions
diff --git a/tracker-pt/ftnoir_tracker_pt_dialog.cpp b/tracker-pt/ftnoir_tracker_pt_dialog.cpp index 32916cc5..0f056e82 100644 --- a/tracker-pt/ftnoir_tracker_pt_dialog.cpp +++ b/tracker-pt/ftnoir_tracker_pt_dialog.cpp @@ -10,8 +10,6 @@ #include "compat/math.hpp" #include "video/camera.hpp" -#include <opencv2/core.hpp> - #include <QString> #include <QtGlobal> #include <QDebug> @@ -39,6 +37,7 @@ TrackerDialog_PT::TrackerDialog_PT(const QString& module_name) : tie_setting(s.cam_res_x, ui.res_x_spin); tie_setting(s.cam_res_y, ui.res_y_spin); tie_setting(s.cam_fps, ui.fps_spin); + tie_setting(s.use_mjpeg, ui.use_mjpeg); tie_setting(s.threshold_slider, ui.threshold_slider); diff --git a/tracker-pt/module/camera.cpp b/tracker-pt/module/camera.cpp index 99bea617..62b23ea9 100644 --- a/tracker-pt/module/camera.cpp +++ b/tracker-pt/module/camera.cpp @@ -77,6 +77,7 @@ bool Camera::start(const pt_settings& s) { int fps = s.cam_fps, res_x = s.cam_res_x, res_y = s.cam_res_y; QString name = s.camera_name; + bool use_mjpeg = s.use_mjpeg; if (fps >= 0 && res_x >= 0 && res_y >= 0) { @@ -84,15 +85,17 @@ bool Camera::start(const pt_settings& s) (int)cam_desired.fps != fps || cam_desired.res_x != res_x || cam_desired.res_y != res_y || + cam_desired.use_mjpeg != use_mjpeg || !cap || !cap->is_open()) { stop(); cam_desired.name = name; - cam_desired.fps = fps; + cam_desired.fps = (f)fps; cam_desired.res_x = res_x; cam_desired.res_y = res_y; cam_desired.fov = fov; + cam_desired.use_mjpeg = use_mjpeg; cap = video::make_camera(name); @@ -103,12 +106,15 @@ bool Camera::start(const pt_settings& s) info.fps = fps; info.width = res_x; info.height = res_y; + info.use_mjpeg = use_mjpeg; if (!cap->start(info)) goto fail; cam_info = pt_camera_info(); cam_info.name = name; + cam_info.use_mjpeg = use_mjpeg; + cam_info.fov = (f)s.fov; dt_mean = 0; cv::Mat tmp; diff --git a/tracker-pt/pt-api.hpp b/tracker-pt/pt-api.hpp index 95152772..ded5ef57 100644 --- a/tracker-pt/pt-api.hpp +++ b/tracker-pt/pt-api.hpp @@ -32,6 +32,7 @@ struct pt_camera_info final int res_x = 0; int res_y = 0; QString name; + bool use_mjpeg = false; }; struct pt_pixel_pos_mixin diff --git a/tracker-pt/pt-settings.hpp b/tracker-pt/pt-settings.hpp index ed13a1ec..e2004ad7 100644 --- a/tracker-pt/pt-settings.hpp +++ b/tracker-pt/pt-settings.hpp @@ -64,6 +64,7 @@ struct pt_settings final : options::opts value<int> init_phase_timeout { b, "init-phase-timeout", 250 }; value<bool> auto_threshold { b, "automatic-threshold", true }; value<pt_color_type> blob_color { b, "blob-color", pt_color_natural }; + value<bool> use_mjpeg { b, "use-mjpeg", false }; value<slider_value> threshold_slider { b, "threshold-slider", { 128, 0, 255 } }; |