-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathVideoProcessor.h
149 lines (101 loc) · 2.93 KB
/
VideoProcessor.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#ifndef VIDEOPROCESSOR_H
#define VIDEOPROCESSOR_H
#include <iostream>
#include <iomanip>
#include <sstream>
#include <string>
#include <vector>
#include <QObject>
#include <QDateTime>
#include <vector>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include "SpatialFilter.h"
enum spatialFilterType {LAPLACIAN, GAUSSIAN};
enum temporalFilterType {IIR, IDEAL};
class VideoProcessor : public QObject {
Q_OBJECT
friend class MagnifyDialog;
public:
explicit VideoProcessor(QObject *parent = 0);
bool isStop();
bool isModified();
bool isOpened();
void setDelay(int d);
void setFileName(QString n);
long getNumberOfProcessedFrames();
long getNumberOfPlayedFrames();
cv::VideoCapture getCapture();
cv::Size getFrameSize();
long getFrameNumber();
double getPositionMS();
double getFrameRate();
long getLength();
double getLengthMS();
int getCodec(char codec[4]);
bool setRelativePosition(double pos);
bool setInput(const std::string &fileName);
bool setOutput(const std::string &filename, int codec=0, double framerate=0.0, bool isColor=true);
void setSpatialFilter(spatialFilterType type);
void setTemporalFilter(temporalFilterType type);
void playIt();
void pauseIt();
void stopIt();
void prevFrame();
void nextFrame();
bool jumpTo(long index);
void close();
void motionMagnify();
void writeOutput();
private slots:
void revertVideo();
signals:
void showFrame(cv::Mat frame);
void revert();
void sleep(int msecs);
void updateBtn();
void updateProgressBar();
void reload(const std::string &);
void updateProcessProgress(const std::string &message, int percent);
void closeProgressDialog();
private:
cv::VideoCapture capture;
int delay;
double rate;
long fnumber;
long length;
bool stop;
bool modify;
long curPos;
int curIndex;
int curLevel;
int digits;
std::string extension;
int levels;
float alpha;
float lambda_c;
float fl;
float fh;
float chromAttenuation;
float delta;
float exaggeration_factor;
float lambda;
QString fileName;
cv::VideoWriter writer;
cv::VideoWriter tempWriter;
std::string outputFile;
std::string tempFile;
std::vector<std::string> tempFileList;
std::vector<cv::Mat> lowpass1;
std::vector<cv::Mat> lowpass2;
bool getNextFrame(cv::Mat& frame);
void writeNextFrame(cv::Mat& frame);
bool createTemp(double framerate=0.0, bool isColor=true);
bool spatialFilter(const cv::Mat &src, std::vector<cv::Mat> &pyramid);
void temporalFilter(const cv::Mat &src, cv::Mat &dst);
void temporalIIRFilter(const cv::Mat &src, cv::Mat &dst);
void amplify(const cv::Mat &src, cv::Mat &dst);
void attenuate(cv::Mat &src, cv::Mat &dst);
};
#endif // VIDEOPROCESSOR_H