iVS3D v2.0.9
Loading...
Searching...
No Matches
smoothcontroller.h
1#ifndef CONTROLLER_H
2#define CONTROLLER_H
3
11#include <QCoreApplication>
12#include <QDoubleSpinBox>
13#include <QLabel>
14#include <QLayout>
15#include <QObject>
16#include <QPoint>
17#include <QTranslator>
18#include <QVariant>
19#include <QWidget>
20#include <algorithm>
21#include <future>
22#include <memory>
23#include <opencv2/core/mat.hpp>
24#include <opencv2/video.hpp>
25#include <vector>
26
27#include "factory.h"
28#include "flowcalculator.h"
29#include "ibase.h"
30#include "imagegatherer.h"
31#include "iselection.h"
32#include "reader.h"
33
34#define PLUGIN_NAME QObject::tr("Smooth camera movement")
35// widget
36#define SELECTOR_LABEL_TEXT QObject::tr("Movement Threshold")
37#define SELECTOR_DESCRIPTION \
38 QObject::tr( \
39 "A resolution dependend threshold, that specifies when there was " \
40 "enough movement to set a new keyframe.")
41#define DESCRIPTION_STYLE \
42 "color: rgb(58, 58, 58); border-left: 6px solid rgb(58, 58, 58); " \
43 "border-top-right-radius: 5px; border-bottom-right-radius: 5px; " \
44 "background-color: lightblue;"
45// settings
46#define SETTINGS_SELECTOR_THRESHOLD "Selector threshold"
47// log file
48#define LF_OPT_FLOW_TOTAL "Flow calculation"
49#define LF_SELECT_FRAMES "Selection of keyframes"
50#define LF_CE_TYPE_ADDITIONAL_INFO "Additional Computation Information"
51#define LF_CE_VALUE_USED_BUFFERED "Used buffered values"
52#define LF_CE_TYPE_DEBUG "Debug Information"
53#define LF_CE_NAME_FLOWVALUE "Flow value"
54#define LF_TIMER_BUFFER "Update Buffer"
55#define LF_TIMER_CORE "Core Computation"
56#define LF_TIMER_SELECTION "Keyframe selection"
57
70 Q_OBJECT
71 Q_PLUGIN_METADATA(IID "iVS3D.IBase")
72 Q_INTERFACES(PLUG::IBase PLUG::ISelection)
73
74 public:
76 ~CameraMovement() override = default;
77
78 // IBase
80 QString getName() const override;
81 QMap<QString, QVariant> getSettings() const override;
83 const QMap<QString, QVariant>& settings) override;
85 const PLUG::InputData& input) override;
86 void onCudaChanged(bool enabled) override;
87
88 // ISelection
89 PLUG::SelectionResult selectImages(const PLUG::SelectionData& data,
90 volatile bool& cancelFlag) override;
91
92 signals:
93 void syncSettingsWidget(double selectorThreshold);
94
95 private slots:
96 void slot_selectorThresholdChanged(double value);
97
98 private:
99 std::unique_ptr<QWidget> createSettingsWidget();
100 void reportProgress(const QString& op, int progress);
101
102 private:
103 double m_selectorThreshold = 2.0;
104 bool m_useCuda = false;
105 Reader* m_reader = nullptr;
106 QPoint m_inputResolution = QPoint(0, 0);
107 cv::SparseMat m_bufferMat;
108
109 QDoubleSpinBox* m_selectorThresholdSpinBox = nullptr;
110};
111
112#endif // CONTROLLER_H
Implements smooth camera movement keyframe selection using PLUG::IBase + PLUG::ISelection.
Definition smoothcontroller.h:69
QMap< QString, QVariant > getSettings() const override
getSettings retrieves the current settings of the plugin as a map of key-value pairs....
Definition smoothcontroller.cpp:42
void onCudaChanged(bool enabled) override
onCudaChanged is called when the CUDA usage setting is changed in iVS3D.
Definition smoothcontroller.cpp:95
PLUG::SettingsWidgetResult getSettingsWidget() override
getSettingsWidget creates and returns a settings QWidget for this plugin.
Definition smoothcontroller.cpp:29
PLUG::InputLoadedResult onInputLoaded(const PLUG::InputData &input) override
onInputLoaded is called when a new input video or image set is loaded.
Definition smoothcontroller.cpp:68
PLUG::SelectionResult selectImages(const PLUG::SelectionData &data, volatile bool &cancelFlag) override
Selects images based on the provided selection data.
Definition smoothcontroller.cpp:97
QString getName() const override
getName returns the name of the plugin which will be displayed in the iVS3D interface.
Definition smoothcontroller.cpp:40
PLUG::ApplySettingsResult applySettings(const QMap< QString, QVariant > &settings) override
applySettings applies the provided settings to the plugin. This method is used to restore plugin conf...
Definition smoothcontroller.cpp:49
The IBase interface provides a base class for all plugin interfaces in iVS3D. It inherits from QObjec...
Definition ibase.h:102
Interface for keyframe/image-selection plugins in iVS3D.
Definition iselection.h:53
The Reader interface defines functions which are used for reading and parsing the import.
Definition reader.h:23
tl::expected< void, Error > InputLoadedResult
Type alias for the result of handling an input loaded event, which can be either a successful void re...
Definition ibase.h:58
tl::expected< void, Error > ApplySettingsResult
Type alias for the result of applying settings to a plugin, which can be either a successful void res...
Definition ibase.h:51
tl::expected< std::unique_ptr< QWidget >, Error > SettingsWidgetResult
Type alias for the result of a settings widget creation operation, which can be either a successful u...
Definition ibase.h:44
Struct to encapsulate data related to the input loaded event in iVS3D.
Definition ibase.h:71
Data available for image selection in ISelection plugins.
Definition iselection.h:31