11
11
#include < QLabel>
12
12
#include < QDialogButtonBox>
13
13
14
+ #ifdef WITH_OPENCV
14
15
#include < opencv2/opencv.hpp>
16
+ #endif
15
17
16
18
#include " assert.h"
17
19
#include < iostream>
@@ -28,10 +30,14 @@ VerifyDialog::VerifyDialog(std::vector<QImage> &_thumbs, std::vector<QPointF> &_
28
30
layout->addLayout (operations_layout);
29
31
QPushButton *reset = new QPushButton (" Reset" );
30
32
operations_layout->addWidget (reset);
33
+ connect (reset, SIGNAL (clicked ()), this , SLOT (resetAligns ()));
34
+
35
+ #ifdef WITH_OPENCV
31
36
QPushButton *ecc = new QPushButton (" Align" );
32
37
operations_layout->addWidget (ecc);
33
- connect (reset, SIGNAL ( clicked ()), this , SLOT ( resetAligns ()));
38
+
34
39
connect (ecc, SIGNAL (clicked ()), this , SLOT (alignSamples ()));
40
+ #endif
35
41
}
36
42
QScrollArea *area = new QScrollArea (this );
37
43
layout->addWidget (area);
@@ -65,14 +71,16 @@ void VerifyDialog::resetAligns() {
65
71
p = QPointF (0 , 0 );
66
72
update ();
67
73
}
68
-
74
+ # ifdef WITH_OPENCV
69
75
cv::Mat qimg2mat (QImage img) {
70
76
QImage gray = img.convertToFormat (QImage::Format_Grayscale8);
71
77
return cv::Mat (gray.height (), gray.width (), CV_8UC1,
72
78
const_cast <uchar*>(gray.bits ()), gray.bytesPerLine ()).clone ();
73
79
}
80
+ #endif
74
81
75
82
void VerifyDialog::alignSamples () {
83
+ #ifdef WITH_OPENCV
76
84
if (positions.empty ()) return ;
77
85
78
86
cv::Mat ref = qimg2mat (thumbs[0 ]);
@@ -90,6 +98,7 @@ void VerifyDialog::alignSamples() {
90
98
}
91
99
}
92
100
update ();
101
+ #endif
93
102
}
94
103
95
104
void VerifyDialog::update () {
0 commit comments