stereo-vision
All Data Structures Namespaces Functions Modules Pages
cvgui.h
1 #ifndef _GUI_H_
2 #define _GUI_H_
3 
4 #include "StereoMatcher.h"
5 #include <iostream>
6 #include <string>
7 
8 #include <opencv2/core/core.hpp>
9 #include <opencv2/highgui/highgui.hpp>
10 
11 // the struct containing the parameters handled by the GUI
12 
13 
14 
15 class GUI
16 {
17 
18 private:
19 
20  // flag set to True if the interface has been quitted
21  bool done;
22 
23  // flag set to True if the interface has been used/updated in the last timeframe
24  bool updated;
25 
26  // flag set to True if the user asked the system to recalibrate the stereo system
27  bool recalibrate;
28 
29  // flag set to True if the user clicked the button to save the current calibration parameters
30  bool save_calibration;
31 
32  // flag set to True if the user chose to revert the matching/filtering parameters to their default values
33  bool load_parameters;
34 
35  // flag set to True if the user selected
36  bool save_parameters;
37 
38  // the parameters handled by the GUI
39  Params params;
40 
41  // the OpenCV Mat object where to draw the interface
42  cv::Mat frame;
43 
44  // stereo matching parameters and auxiliary variables
45  SM_BLF_FILTER BLFfiltering;
46  SM_WLS_FILTER WLSfiltering;
47  SM_MATCHING_ALG stereo_matching;
48 
49  int BLFfiltering_id;
50  int WLSfiltering_id;
51  int stereo_matching_id;
52  int num_disparities_id;
53 
54  // threshold for the rough refinement of the disparity map
55  int refine_th;
56 
57 public:
58 
63  void killGUI();
64 
69  void initializeGUI();
70 
75  void initializeGUI(int &minDisparity, int &numberOfDisparities, int &SADWindowSize,
76  int &disp12MaxDiff, int &preFilterCap, int &uniquenessRatio,
77  int &speckleWindowSize, int &speckleRange, double &sigmaColorBLF,
78  double &sigmaSpaceBLF, double &wls_lambda, double &wls_sigma,
79  SM_BLF_FILTER &BLFfiltering, SM_WLS_FILTER &WLSfiltering,
80  SM_MATCHING_ALG &stereo_matching);
81 
86  void updateGUI();
87 
92  void getParameters(int& minDisparity, int& numberOfDisparities, int& SADWindowSize,
93  int& disp12MaxDiff, int& preFilterCap, int& uniquenessRatio,
94  int& speckleWindowSize, int& speckleRange, double& sigmaColorBLF,
95  double& sigmaSpaceBLF, double& wls_lambda, double& wls_sigma,
96  SM_BLF_FILTER& BLFfiltering, SM_WLS_FILTER& WLSfiltering,
97  SM_MATCHING_ALG& stereo_matching);
98 
99 
104  void setParameters(int& minDisparity, int& numberOfDisparities, int& SADWindowSize,
105  int& disp12MaxDiff, int& preFilterCap, int& uniquenessRatio,
106  int& speckleWindowSize, int& speckleRange, double& sigmaColorBLF,
107  double& sigmaSpaceBLF, double& wls_lambda, double& wls_sigma,
108  SM_BLF_FILTER& BLFfiltering, SM_WLS_FILTER& WLSfiltering,
109  SM_MATCHING_ALG& stereo_matching);
110 
111 
112 
118  bool isDone();
119 
125  bool isUpdated();
126 
131  void resetState();
132 
138  bool toRecalibrate();
139 
145  bool toSaveCalibration();
146 
152  bool toLoadParameters();
153 
159  bool toSaveParameters();
160 
165  void convertIDToEnum();
166 
171  void convertEnumToID();
172 
178  bool toRefine();
179 
180 
186  int getRefineTh();
187 
188  GUI();
189  ~GUI();
190 
191 
192 };
193 
194 #endif // _GUI_H_