-
Notifications
You must be signed in to change notification settings - Fork 0
/
colormagnify.h
140 lines (106 loc) · 2.91 KB
/
colormagnify.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
#ifndef COLORMAGNIFY_H
#define COLORMAGNIFY_H
#include <QObject>
#include <vector>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include "SpatialFilter.h"
#include <iostream>
//将滤波器类型声明为枚举类型
enum spatialFilterType {LAPLACIAN, GAUSSIAN};
enum temporalFilterType {IIR, IDEAL};
class ColorMagnify : public QObject
{
Q_OBJECT
public:
explicit ColorMagnify(QObject *parent = 0);
//input frame
void setInput(cv::Mat &frame);
// create frame buffer
void createInputBuffer();
// return the size of the video frame
cv::Size getFrameSize();
// return the frame rate
double getFrameRate();
//设置帧率
void setFrameRate(double rate);
// set spatial filter
void setSpatialFilter(spatialFilterType type);
// set temporal filter
void setTemporalFilter(temporalFilterType type);
// color magnification
void colorMagnify();
//get output result
cv::Mat getOutput();
private:
//current frame
cv::Mat currentFrame;
// video frame rate
double rate;
// total number of frames
long length;
// current level of pyramid
int curLevel;
// number of digits in output image filename
int digits;
// extension of output images
std::string extension;
// spatial filter type
spatialFilterType spatialType;
// temporal filter type
temporalFilterType temporalType;
// level numbers of image pyramid
int levels;
// amplification factor
float alpha;
// cut-off wave length
float lambda_c;
// low cut-off
float fl;
// high cut-off
float fh;
// chromAttenuation
float chromAttenuation;
// delta
float delta;
// extraggon factor
float exaggeration_factor;
// lambda
float lambda;
// low pass filters for IIR
std::vector<cv::Mat> lowpass1;
std::vector<cv::Mat> lowpass2;
//temp frame vector
std::vector<cv::Mat> inputBuffer;
std::vector<cv::Mat> outputBuffer;
// get the next frame if any
bool getNextFrame(cv::Mat& frame);
// spatial filtering
bool spatialFilter(const cv::Mat &src, std::vector<cv::Mat> &pyramid);
// temporal filtering
void temporalFilter(const cv::Mat &src,
cv::Mat &dst);
// temporal IIR filtering
void temporalIIRFilter(const cv::Mat &src,
cv::Mat &dst);
// temporal ideal bandpass filtering
void temporalIdealFilter(const cv::Mat &src,
cv::Mat &dst);
// amplify motion
void amplify(const cv::Mat &src, cv::Mat &dst);
// attenuate I, Q channels
void attenuate(cv::Mat &src, cv::Mat &dst);
// concat images into a large Mat
void concat(const std::vector<cv::Mat> &frames, cv::Mat &dst);
// de-concat the concatnate image into frames
void deConcat(const cv::Mat &src, const cv::Size &frameSize, std::vector<cv::Mat> &frames);
// create an ideal bandpass processor
void createIdealBandpassFilter(cv::Mat &filter, double fl, double fh, double rate);
signals:
void showMagnify(cv::Mat frame);
public slots:
//负责调动整个类的运行
void mainloop(cv::Mat &input);
};
#endif // COLORMAGNIFY_H