-
Notifications
You must be signed in to change notification settings - Fork 3
/
mainwindow.h
132 lines (86 loc) · 3.29 KB
/
mainwindow.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
/*#-------------------------------------------------
#
# Disparity and depth maps with OpenCV
#
# by AbsurdePhoton - www.absurdephoton.fr
#
# v1.3 - 2019/06/03
#
#-------------------------------------------------*/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <disparity.h>
#include <adjust.h>
#include <iostream>
#include "opencv2/calib3d.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/ximgproc/disparity_filter.hpp"
#include "opencv2/opencv.hpp"
#include "opencv2/core/utility.hpp"
#include <QMainWindow>
#include <QFileDialog>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private slots:
void on_Left_clicked();
void on_Right_clicked();
void on_MPO_clicked ();
void on_Camera_clicked ();
void on_Rectify_clicked ();
void on_Swap_clicked ();
void on_Normalize_clicked();
void on_Rotate_clicked();
void on_Negative_clicked();
void on_Save_Images_clicked();
void on_Save_depthmap_clicked(); // Write depthmap image file to png
void ShowDepthmap();
void on_checkBox_fit_clicked();
void on_Disparity_clicked();
void on_Adjust_clicked();
void on_horizontalSlider_num_of_disparity_sliderMoved(int position);
void on_horizontalSlider_num_of_disparity_valueChanged(int value);
void on_horizontalSlider_SAD_window_size_valueChanged(int value);
void on_horizontalSlider_pre_filter_size_valueChanged(int value);
void on_horizontalSlider_pre_filter_cap_valueChanged(int value);
void on_horizontalSlider_min_disparity_valueChanged(int value);
void on_horizontalSlider_texture_threshold_valueChanged(int value);
void on_horizontalSlider_uniqueness_ratio_valueChanged(int value);
void on_horizontalSlider_speckle_window_size_valueChanged(int value);
void on_horizontalSlider_speckle_range_valueChanged(int value);
void on_horizontalSlider_disp_12_max_diff_valueChanged(int value);
void on_horizontalSlider_P1_valueChanged(int value);
void on_horizontalSlider_P2_valueChanged(int value);
void on_radioButton_BM_clicked ();
void on_radioButton_SGBM_clicked ();
void on_radioButton_quasi_clicked ();
void on_Compute_clicked(); // compute depth map with OpenCV
private:
// the UI object, to access the UI elements created with Qt Designer
Ui::MainWindow *ui;
cv::Mat left_image, right_image; // left and right images
cv::Mat disp_color; // Processed stereo map
cv::Mat KR, KL, DL, DR, R, F, E;
cv::Vec3d T;
std::string basename, basedir;
// the object that holds the parameters for the block-matching algorithm
cv::Ptr<cv::StereoBM> bmState = cv::StereoBM::create(16, 2);
cv::Ptr<cv::StereoSGBM> sgbmState = cv::StereoSGBM::create(-32, 144, 5);
// To know if a depthmap has been computed
bool computed;
bool parameters;
bool rectified;
// functions to manage constraints on sliders
void set_SADWindowSize(); // manage max value of SADWindowSize slider
void set_num_of_disparity_slider_to_multiple_16(int position);
cv::Rect computeROI(cv::Size2i src_sz, cv::Ptr<cv::StereoMatcher> matcher_instance);
};
#endif // MAINWINDOW_H