-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdialogremap.cpp
67 lines (55 loc) · 1.88 KB
/
dialogremap.cpp
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
#include "dialogremap.h"
#include "stereocamera.h"
#include "ui_dialogremap.h"
DialogRemap::DialogRemap(QWidget *parent)
: QDialog(parent), ui(new Ui::DialogRemap) {
ui->setupUi(this);
}
DialogRemap::~DialogRemap() { delete ui; }
void DialogRemap::on_btnExit_clicked() {
reject();
btnExit = true;
}
void DialogRemap::remapShow() {
StereoCamera stereoCamera;
Mat leftStereoMapX, leftStereoMapY;
Mat rightStereoMapX, rightStereoMapY;
FileStorage cvFile =
FileStorage("calibrationParamaters.xml", FileStorage::READ);
cvFile["leftStereoMapX"] >> leftStereoMapX;
cvFile["leftStereoMapY"] >> leftStereoMapY;
cvFile["rightStereoMapX"] >> rightStereoMapX;
cvFile["rightStereoMapY"] >> rightStereoMapY;
cvFile.release();
Mat frameLeft;
Mat frameRight;
Mat concatImage;
Mat remapFrameLeft;
Mat remapFrameRight;
while (stereoCamera.isOpened()) {
btnScreenShoot = false;
stereoCamera.getCapLeft().read(frameLeft);
stereoCamera.getCapRight().read(frameRight);
remap(frameLeft, frameLeft, leftStereoMapX, leftStereoMapY,
cv::INTER_LANCZOS4, cv::BORDER_CONSTANT, 0);
remap(frameRight, frameRight, rightStereoMapX, rightStereoMapY,
cv::INTER_LANCZOS4, cv::BORDER_CONSTANT, 0);
hconcat(frameLeft, frameRight, concatImage);
// drawLines();
imshow("Frame", concatImage);
int k = waitKey(1);
if (btnScreenShoot == true) {
saveImages(frameLeft, frameRight);
}
if (k == 'q' || btnExit == true) {
break;
}
}
}
void DialogRemap::on_btnStart_clicked() { remapShow(); }
void DialogRemap::saveImages(const Mat &frameLeft, const Mat &frameRight) {
String pathName = "/home/benmalef/Desktop/StereoApp/StereoImages";
imwrite(pathName + "/screenShotR" + ".png", frameRight);
imwrite(pathName + "/screenShotL" + ".png", frameLeft);
}
void DialogRemap::on_btnScreenShot_clicked() { btnScreenShoot = true; }