summaryrefslogtreecommitdiffhomepage
path: root/tracker-pt/module/camera.h
diff options
context:
space:
mode:
Diffstat (limited to 'tracker-pt/module/camera.h')
-rw-r--r--tracker-pt/module/camera.h30
1 files changed, 9 insertions, 21 deletions
diff --git a/tracker-pt/module/camera.h b/tracker-pt/module/camera.h
index 79e3dca0..e4772178 100644
--- a/tracker-pt/module/camera.h
+++ b/tracker-pt/module/camera.h
@@ -8,15 +8,10 @@
#pragma once
#include "pt-api.hpp"
-
#include "compat/timer.hpp"
+#include "video/camera.hpp"
-#include <functional>
#include <memory>
-#include <tuple>
-
-#include <opencv2/core.hpp>
-#include <opencv2/videoio.hpp>
#include <QString>
@@ -26,7 +21,7 @@ struct Camera final : pt_camera
{
Camera(const QString& module_name);
- bool start(int idx, int fps, int res_x, int res_y) override;
+ bool start(const pt_settings& s) override;
void stop() override;
result get_frame(pt_frame& Frame) override;
@@ -36,30 +31,23 @@ struct Camera final : pt_camera
QString get_desired_name() const override;
QString get_active_name() const override;
- void set_fov(double value) override { fov = value; }
+ void set_fov(f value) override { fov = value; }
void show_camera_settings() override;
private:
- warn_result_unused bool _get_frame(cv::Mat& Frame);
+ using camera = video::impl::camera;
+
+ [[nodiscard]] bool get_frame_(cv::Mat& frame);
- double dt_mean = 0, fov = 30;
+ f dt_mean = 0, fov = 30;
Timer t;
pt_camera_info cam_info;
pt_camera_info cam_desired;
- QString desired_name, active_name;
-
- struct camera_deleter final
- {
- void operator()(cv::VideoCapture* cap);
- };
-
- using camera_ptr = std::unique_ptr<cv::VideoCapture, camera_deleter>;
-
- camera_ptr cap;
+ std::unique_ptr<camera> cap;
pt_settings s;
- static constexpr inline double dt_eps = 1./384;
+ static constexpr f dt_eps = f{1}/256;
};
} // ns pt_module