Skip to content

Commit 8104954

Browse files
committed
reg: hide debug output in tests
1 parent 6db3e95 commit 8104954

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

modules/reg/src/mapper.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,16 @@ void fillGridMatrices(const Mat img, Mat grid_r, Mat grid_c)
6666
if(img.channels() == 1) {
6767
for(int r_i = 0; r_i < img.rows; ++r_i) {
6868
for(int c_i = 0; c_i < img.cols; ++c_i) {
69-
grid_r.at<_Tp>(r_i, c_i) = r_i;
70-
grid_c.at<_Tp>(r_i, c_i) = c_i;
69+
grid_r.at<_Tp>(r_i, c_i) = (_Tp)r_i;
70+
grid_c.at<_Tp>(r_i, c_i) = (_Tp)c_i;
7171
}
7272
}
7373
} else {
74-
Vec<_Tp, 3> ones(1., 1., 1.);
74+
Vec<_Tp, 3> ones((_Tp)1, (_Tp)1, (_Tp)1);
7575
for(int r_i = 0; r_i < img.rows; ++r_i) {
7676
for(int c_i = 0; c_i < img.cols; ++c_i) {
77-
grid_r.at< Vec<_Tp, 3> >(r_i, c_i) = r_i*ones;
78-
grid_c.at< Vec<_Tp, 3> >(r_i, c_i) = c_i*ones;
77+
grid_r.at< Vec<_Tp, 3> >(r_i, c_i) = (_Tp)r_i*ones;
78+
grid_c.at< Vec<_Tp, 3> >(r_i, c_i) = (_Tp)c_i*ones;
7979
}
8080
}
8181
}

modules/reg/test/test_reg.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ using namespace std;
5959
using namespace cv;
6060
using namespace cv::reg;
6161

62+
#define REG_DEBUG_OUTPUT 0
63+
6264

6365
class RegTest : public testing::Test
6466
{
@@ -91,10 +93,11 @@ void RegTest::testShift()
9193

9294
// Print result
9395
MapShift* mapShift = dynamic_cast<MapShift*>(mapPtr.get());
96+
#if REG_DEBUG_OUTPUT
9497
cout << endl << "--- Testing shift mapper ---" << endl;
9598
cout << Mat(shift) << endl;
9699
cout << Mat(mapShift->getShift()) << endl;
97-
100+
#endif
98101
// Check accuracy
99102
Ptr<Map> mapInv(mapShift->inverseMap());
100103
mapTest.compose(*mapInv.get());
@@ -123,12 +126,13 @@ void RegTest::testEuclidean()
123126

124127
// Print result
125128
MapAffine* mapAff = dynamic_cast<MapAffine*>(mapPtr.get());
129+
#if REG_DEBUG_OUTPUT
126130
cout << endl << "--- Testing Euclidean mapper ---" << endl;
127131
cout << Mat(linTr) << endl;
128132
cout << Mat(shift) << endl;
129133
cout << Mat(mapAff->getLinTr()) << endl;
130134
cout << Mat(mapAff->getShift()) << endl;
131-
135+
#endif
132136
// Check accuracy
133137
Ptr<Map> mapInv(mapAff->inverseMap());
134138
mapTest.compose(*mapInv.get());
@@ -161,11 +165,13 @@ void RegTest::testSimilarity()
161165

162166
// Print result
163167
MapAffine* mapAff = dynamic_cast<MapAffine*>(mapPtr.get());
168+
#if REG_DEBUG_OUTPUT
164169
cout << endl << "--- Testing similarity mapper ---" << endl;
165170
cout << Mat(linTr) << endl;
166171
cout << Mat(shift) << endl;
167172
cout << Mat(mapAff->getLinTr()) << endl;
168173
cout << Mat(mapAff->getShift()) << endl;
174+
#endif
169175

170176
// Check accuracy
171177
Ptr<Map> mapInv(mapAff->inverseMap());
@@ -195,11 +201,13 @@ void RegTest::testAffine()
195201

196202
// Print result
197203
MapAffine* mapAff = dynamic_cast<MapAffine*>(mapPtr.get());
204+
#if REG_DEBUG_OUTPUT
198205
cout << endl << "--- Testing affine mapper ---" << endl;
199206
cout << Mat(linTr) << endl;
200207
cout << Mat(shift) << endl;
201208
cout << Mat(mapAff->getLinTr()) << endl;
202209
cout << Mat(mapAff->getShift()) << endl;
210+
#endif
203211

204212
// Check accuracy
205213
Ptr<Map> mapInv(mapAff->inverseMap());
@@ -230,9 +238,11 @@ void RegTest::testProjective()
230238
// Print result
231239
MapProjec* mapProj = dynamic_cast<MapProjec*>(mapPtr.get());
232240
mapProj->normalize();
241+
#if REG_DEBUG_OUTPUT
233242
cout << endl << "--- Testing projective transformation mapper ---" << endl;
234243
cout << Mat(projTr) << endl;
235244
cout << Mat(mapProj->getProjTr()) << endl;
245+
#endif
236246

237247
// Check accuracy
238248
Ptr<Map> mapInv(mapProj->inverseMap());

0 commit comments

Comments
 (0)