-
Notifications
You must be signed in to change notification settings - Fork 75
/
StereoMatching.h
78 lines (61 loc) · 2.02 KB
/
StereoMatching.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
/**
@file StereoMatcing.h
@date 2017/09/03
@author tkwoo(wtk1101@gmail.com).
@brief create disparity map
*/
#pragma once
#include "opencv2/opencv.hpp"
#include <iostream>
#if CV_MAJOR_VERSION==3
//#include "opencv2\ximgproc.hpp"
#include "opencv2/ximgproc.hpp"
#include "opencv2/imgcodecs.hpp"
#endif
#include "./include/DefStruct.h"
using namespace std;
using namespace cv;
#if CV_MAJOR_VERSION==3
using namespace cv::ximgproc;
#endif
typedef enum error { NO_PROB, IMGSIZE_ERR, IMGSCALE_ERR } MATCHING_ERROR;
/**
@class CStereoMatching
@brief disparity map
*/
class CStereoMatching{
private:
//----------------input-------------------
Mat m_imgLeftInput; ///< rectified image
Mat m_imgRightInput; ///< rectified image
//----------------param-------------------
#if CV_MAJOR_VERSION==3
Ptr<StereoBM> bm = StereoBM::create(0, 0); ///< default construct
Ptr<DisparityWLSFilter> wls_filter;
Rect m_rectFilterROI;
#endif
#if CV_MAJOR_VERSION == 2
StereoBM bm;
#endif
StereoCamParam_t m_objStereoParam;
//-------------member image---------------
//---------------function------------------
void SetParamOCVStereo(); ///< Stereo parameter setting
MATCHING_ERROR MakeDisparity();
MATCHING_ERROR ImproveDisparity(Mat& imgDisp8);
public:
//----------------output-------------------
Mat m_matDisp16;
Mat m_imgDisp8;
//---------------function------------------
CStereoMatching(StereoCamParam_t& objStereoParam);
CStereoMatching(Mat& imgLeftInput, Mat& imgRightInput, StereoCamParam_t& objStereoParam);
//Set param
void SetParamOCVStereo(StereoCamParam_t& objStereoParam);
//make disparity
MATCHING_ERROR SetImage(Mat& imgLeft, Mat& imgRight);
MATCHING_ERROR MakeDisparity(Mat& imgLeft, Mat& imgRight, bool flgUseWLSFilter=true);
MATCHING_ERROR MakeDisparity(Mat& imgLeft, Mat& imgRight, Mat& matDisp16);
MATCHING_ERROR ImproveDisparity_Naive(Mat& imgDisp8);
MATCHING_ERROR ImproveDisparity_WLSFilter(Mat& imgDisp8); ///< OCV310 new disparity postprocess
};