summaryrefslogtreecommitdiffhomepage
path: root/tracker-pt/module/camera.h
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2019-03-18 15:20:09 +0100
committerStanislaw Halik <sthalik@misaki.pl>2019-03-18 15:20:09 +0100
commit5023b54ba76325bb0b5598d59714bdad2d55d81e (patch)
tree15cc639eff7dbfa12eeccaa52d7fd251f18969e6 /tracker-pt/module/camera.h
parent3aababf6fd53a7b0312c2c1492bab6b43584b613 (diff)
video: add support for camera modules
Issue: #910
Diffstat (limited to 'tracker-pt/module/camera.h')
-rw-r--r--tracker-pt/module/camera.h17
1 files changed, 5 insertions, 12 deletions
diff --git a/tracker-pt/module/camera.h b/tracker-pt/module/camera.h
index 2ea633d0..02e2fe4d 100644
--- a/tracker-pt/module/camera.h
+++ b/tracker-pt/module/camera.h
@@ -9,11 +9,11 @@
#include "pt-api.hpp"
#include "compat/timer.hpp"
+#include "video/camera.hpp"
#include <memory>
#include <opencv2/core.hpp>
-#include <opencv2/videoio.hpp>
#include <QString>
@@ -23,7 +23,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 QString& name, int fps, int res_x, int res_y) override;
void stop() override;
result get_frame(pt_frame& Frame) override;
@@ -37,23 +37,16 @@ struct Camera final : pt_camera
void show_camera_settings() override;
private:
+ using camera = typename video::impl::camera;
+
[[nodiscard]] bool get_frame_(cv::Mat& frame);
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 f dt_eps = f{1}/256;