summaryrefslogtreecommitdiffhomepage
path: root/video-opencv
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2019-03-18 17:45:29 +0100
committerStanislaw Halik <sthalik@misaki.pl>2019-03-18 17:45:29 +0100
commitce561473cb6ed102a969defe037a65bd3df09d63 (patch)
treed01bdb4df0fe0a0f4a128e33d1afb04c2e7198e7 /video-opencv
parent99c8af17801552912c3afe8b8822fa3215c40459 (diff)
video/opencv: add header
Diffstat (limited to 'video-opencv')
-rw-r--r--video-opencv/camera-impl.cpp48
-rw-r--r--video-opencv/camera-impl.hpp51
2 files changed, 55 insertions, 44 deletions
diff --git a/video-opencv/camera-impl.cpp b/video-opencv/camera-impl.cpp
index ca18fd4b..c7869ad5 100644
--- a/video-opencv/camera-impl.cpp
+++ b/video-opencv/camera-impl.cpp
@@ -1,52 +1,10 @@
-/* Copyright (c) 2019 Stanislaw Halik <sthalik@misaki.pl>
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- */
-
+#include "camera-impl.hpp"
#include "compat/sleep.hpp"
-#include "video/camera.hpp"
#include "camera-names.hpp"
#include "video-property-page.hpp"
-#include <optional>
-
-#include <opencv2/core.hpp>
-#include <opencv2/videoio.hpp>
-
-using namespace video::impl;
-
-struct cam;
-
-struct metadata : camera_
-{
- metadata();
- std::vector<QString> camera_names() const override;
- std::unique_ptr<camera> make_camera(const QString& name) override;
- bool can_show_dialog(const QString& camera_name) override;
- bool show_dialog(const QString& camera_name) override;
-};
-
-struct cam final : camera
-{
- cam(int idx);
- ~cam() override;
-
- bool start(const info& args) override;
- void stop() override;
- bool is_open() override;
- std::tuple<const frame&, bool> get_frame() override;
- bool show_dialog() override;
-
- bool get_frame_();
-
- std::optional<cv::VideoCapture> cap;
- cv::Mat mat;
- frame frame_;
- int idx = -1;
-};
+namespace opencv_camera_impl {
metadata::metadata() = default;
@@ -171,3 +129,5 @@ bool cam::show_dialog()
}
OTR_REGISTER_CAMERA(metadata)
+
+} // ns opencv_camera_impl
diff --git a/video-opencv/camera-impl.hpp b/video-opencv/camera-impl.hpp
new file mode 100644
index 00000000..f756fb19
--- /dev/null
+++ b/video-opencv/camera-impl.hpp
@@ -0,0 +1,51 @@
+/* Copyright (c) 2019 Stanislaw Halik <sthalik@misaki.pl>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ */
+
+#pragma once
+
+#include "video/camera.hpp"
+
+#include <optional>
+
+#include <opencv2/core.hpp>
+#include <opencv2/videoio.hpp>
+
+namespace opencv_camera_impl {
+
+using namespace video::impl;
+
+struct cam;
+
+struct metadata : camera_
+{
+ metadata();
+ std::vector<QString> camera_names() const override;
+ std::unique_ptr<camera> make_camera(const QString& name) override;
+ bool can_show_dialog(const QString& camera_name) override;
+ bool show_dialog(const QString& camera_name) override;
+};
+
+struct cam final : camera
+{
+ cam(int idx);
+ ~cam() override;
+
+ bool start(const info& args) override;
+ void stop() override;
+ bool is_open() override;
+ std::tuple<const frame&, bool> get_frame() override;
+ bool show_dialog() override;
+
+ bool get_frame_();
+
+ std::optional<cv::VideoCapture> cap;
+ cv::Mat mat;
+ frame frame_;
+ int idx = -1;
+};
+
+} // ns opencv_camera_impl