16#include <QDoubleValidator>
20#include <QDoubleSpinBox>
23#include <opencv2/core/mat.hpp>
26#include <QtConcurrent/QtConcurrentMap>
29#include <QCoreApplication>
35#include "ialgorithm.h"
38#include "imagegatherer.h"
39#include "flowcalculator.h"
40#include <opencv2/video.hpp>
42#define PLUGIN_NAME QObject::tr("Stationary camera removal")
44#define SELECTOR_LABEL_TEXT QObject::tr("Stationary threshold")
45#define SELECTOR_DESCRIPTION QObject::tr("Removes all frames where the camera is stationary. A frame is declared stationary if its camera movement is lower than given percentage of the median of all camera movements.")
46#define DOWNSAMPLE_LABEL_TEXT QObject::tr("Sampling resolution")
47#define DOWNSAMPLE_CHECKBOX_TEXT QObject::tr("Activate down sampling")
48#define DESCRIPTION_DOWNSAMPLE QObject::tr("If enabled a resolution of 720p will be used for the algorithm to speed up computation. This will hurt the accuracy of the result slightly. It however won't change the export resolution. This parameter will be disabled if the input resolution is lower or equal than 720p.")
49#define DESCRIPTION_STYLE "color: rgb(58, 58, 58); border-left: 6px solid rgb(58, 58, 58); border-top-right-radius: 5px; border-bottom-right-radius: 5px; background-color: lightblue;"
50#define INFO_STYLE "color: rgb(58, 58, 58); border-left: 6px solid rgb(58, 58, 58); border-top-right-radius: 5px; border-bottom-right-radius: 5px; background-color: lightGreen;"
52#define BUFFER_NAME "StationaryCameraMovementValues"
53#define DELIMITER_COORDINATE "|"
54#define DELIMITER_ENTITY ","
56#define SETTINGS_SAMPLE_RESOLUTION "Sample resolution"
57#define SETTINGS_SELECTOR_THRESHOLD "Selector threshold"
59#define LF_OPT_FLOW_TOTAL "Flow calculation"
60#define LF_SELECT_FRAMES "Selection of keyframes"
61#define LF_CE_TYPE_ADDITIONAL_INFO "Additional Computation Information"
62#define LF_CE_VALUE_USED_BUFFERED "Used buffered values"
63#define LF_CE_TYPE_DEBUG "Debug Information"
64#define LF_CE_NAME_FLOWVALUE "Flow value"
65#define LF_CE_NAME_SAMPLERES "Sampling Resolution"
66#define LF_TIMER_BUFFER "Update Buffer"
67#define LF_TIMER_CORE "Core Computation"
68#define LF_TIMER_SELECTION "Keyframe selection"
84 Q_PLUGIN_METADATA(IID
"iVS3D.IAlgorithm")
154 double m_selectorThreshold = 0.3;
155 Reader *m_reader =
nullptr;
156 QPoint m_inputResolution = QPoint(0, 0);
157 cv::SparseMat m_bufferMat;
160 QWidget *m_settingsWidget =
nullptr;
161 QDoubleSpinBox *m_selectorThresholdSpinBox =
nullptr;
164 long m_durationFarnebackMs = 0;
165 long m_durationComputationFlowMs = 0;
168 void reportProgress(QString op,
int progress,
Progressable *receiver);
169 void displayMessage(QString txt,
Progressable *receiver);
170 void createSettingsWidget(QWidget *parent);
186 QVariant bufferMatToVariant(cv::SparseMat bufferMat);
188 void changeUIParameter(QVariant nValue, QString paramName, QString selectorName);
The IAlgorithm interface is used to include plugin implementations for different sampling algorithms....
Definition ialgorithm.h:35
The LogFileParent class logs progress as well as information about a process (e.g....
Definition LogFileParent.h:30
The Progressable interface is used to by multithreaded actions such as sampling or exporting to repor...
Definition progressable.h:18
The Reader interface defines functions which are used for reading and parsing the import.
Definition reader.h:23
Definition smoothcontroller.h:86
void stringToBufferMat(QString string)
recreateMovementFromString is used to extract the movement value from a string and write it in the bu...
QWidget * getSettingsWidget(QWidget *parent) override
getSettingsWidget creates a Widget, which can be used to change the algorithm parameters and returns ...
Q_INTERFACES(IAlgorithm) public ~SmoothController()
StationaryCamera Constructor sets default values for member variables.
Definition smoothcontroller.h:99
std::vector< uint > sampleImages(const std::vector< uint > &imageList, Progressable *receiver, volatile bool *stopped, bool useCuda, LogFileParent *logFile) override
sampleImages selects keyframe if the camera is currently not stationary
void setSettings(QMap< QString, QVariant > settings) override
setter for plugin's settings settings structure: <QMap> settings (all settings) <QVariant> samplingRe...
SmoothController()
StationaryCamera Constructor sets default values for member variables.
Definition smoothcontroller.cpp:3
QMap< QString, QVariant > sendBuffer()
sendBuffer Sends all buffered values for storeing previously calculated Infos
QString getName() const override
getName Returns a name for displaying this algorithm to the user.
QMap< QString, QVariant > getSettings() override
getter for plugin's settings
QMap< QString, QVariant > generateSettings(Progressable *receiver, bool useCuda, volatile bool *stopped) override
generateSettings tries to generate the best settings for the current input
void recreateBufferMatrix(QMap< QString, QVariant > buffer)
recreateBufferMatrix initalizes the buffer matix whith the new values from nBuffer
void initialize(Reader *reader, QMap< QString, QVariant > buffer, signalObject *sigObj) override
initialize Sets up the default value which is corresponding to video information
Definition signalobject.h:10