-
Notifications
You must be signed in to change notification settings - Fork 23
/
semi_global_matching.h
55 lines (43 loc) · 987 Bytes
/
semi_global_matching.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
#ifndef __SEMI_GLOBAL_MATCHING_H__
#define __SEMI_GLOBAL_MATCHING_H__
#include <opencv2/core.hpp>
class SemiGlobalMatching
{
public:
static const int DISP_SHIFT = 4;
static const int DISP_SCALE = (1 << DISP_SHIFT);
static const int DISP_INV = -DISP_SCALE;
enum CensusType
{
CENSUS_9x7,
SYMMETRIC_CENSUS_9x7,
};
struct Parameters
{
int P1;
int P2;
int numDisparities;
int max12Diff;
int medianKernelSize;
CensusType censusType;
// default settings
Parameters()
{
P1 = 10;
P2 = 120;
numDisparities = 64;
max12Diff = 5;
medianKernelSize = 3;
censusType = SYMMETRIC_CENSUS_9x7;
}
};
SemiGlobalMatching(const Parameters& param = Parameters());
void compute(const cv::Mat& I1, const cv::Mat& I2, cv::Mat& D1, cv::Mat& D2);
static void LRConsistencyCheck(cv::Mat& D1, cv::Mat& D2, int max12Diff);
private:
cv::Mat census[2];
std::vector<cv::Mat1b> L;
cv::Mat1w S;
Parameters param_;
};
#endif // !__SEMI_GLOBAL_MATCHING_H__