-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopticalflowhs.h
More file actions
86 lines (62 loc) · 1.61 KB
/
Copy pathopticalflowhs.h
File metadata and controls
86 lines (62 loc) · 1.61 KB
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
#ifndef OPTICALFLOWHS_H
#define OPTICALFLOWHS_H
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <vector>
#include "common.h"
class OpticalFlowHS
{
//Derivative Product Element
struct DP
{
float xx;
float yy;
float xy;
float xt;
float yt;
float alpha;
};
public:
OpticalFlowHS(cv::Size imgSize, bool usePrev, float lambda, int imgStep);
~OpticalFlowHS();
void CalcFirstLineSobel();
void CalcSobel(float *vx, float *vy, int vstep);
void InitializeVelocityVectors(float* vx, float* vy, int vstep);
void SetInputTwoImages(unsigned char* ia, unsigned char* ib)
{
m_ptrA = ia;
m_ptrB = ib;
}
void SetIterTerm(bool useIter, int numIter, double eps)
{
m_UseIter = useIter;
m_IterNum = numIter;
m_Eps = eps;
}
private:
//Sobel Calc
std::vector<float> m_Sobel_X0;
std::vector<float> m_Sobel_X1;
std::vector<float> m_Sobel_Y0;
std::vector<float> m_Sobel_Y1;
std::vector<float> m_Vel_X0;
std::vector<float> m_Vel_X1;
std::vector<float> m_Vel_Y0;
std::vector<float> m_Vel_Y1;
std::vector<DP> m_vDP;
cv::Size m_ImageSize;
bool m_UsePrev;
float m_Lambda;
int m_ImageStep;
unsigned char* m_ptrA;
unsigned char* m_ptrB;
bool m_UseIter;
float m_Eps;
int m_IterNum;
protected:
void CalcFirstLine(const VerStep &vs, std::vector<float>& sobelY, int cur_row, int &cur_idx);
void CalcMiddleLines(const VerStep &vs, std::vector<float> &sobelY, int cur_row, int &cur_idx);
void CalcLastLine(const VerStep &vs, std::vector<float> &sobelY, int cur_row, int &cur_idx);
void DoIter(VerStep &vs, int vstep, float* vx, float* vy);
};
#endif // OPTICALFLOWHS_H