Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv_contrib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv_contrib
Commits
81049548
Commit
81049548
authored
Feb 01, 2017
by
Vladislav Sovrasov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reg: hide debug output in tests
parent
6db3e956
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
7 deletions
+17
-7
mapper.cpp
modules/reg/src/mapper.cpp
+5
-5
test_reg.cpp
modules/reg/test/test_reg.cpp
+12
-2
No files found.
modules/reg/src/mapper.cpp
View file @
81049548
...
...
@@ -66,16 +66,16 @@ void fillGridMatrices(const Mat img, Mat grid_r, Mat grid_c)
if
(
img
.
channels
()
==
1
)
{
for
(
int
r_i
=
0
;
r_i
<
img
.
rows
;
++
r_i
)
{
for
(
int
c_i
=
0
;
c_i
<
img
.
cols
;
++
c_i
)
{
grid_r
.
at
<
_Tp
>
(
r_i
,
c_i
)
=
r_i
;
grid_c
.
at
<
_Tp
>
(
r_i
,
c_i
)
=
c_i
;
grid_r
.
at
<
_Tp
>
(
r_i
,
c_i
)
=
(
_Tp
)
r_i
;
grid_c
.
at
<
_Tp
>
(
r_i
,
c_i
)
=
(
_Tp
)
c_i
;
}
}
}
else
{
Vec
<
_Tp
,
3
>
ones
(
1.
,
1.
,
1.
);
Vec
<
_Tp
,
3
>
ones
(
(
_Tp
)
1
,
(
_Tp
)
1
,
(
_Tp
)
1
);
for
(
int
r_i
=
0
;
r_i
<
img
.
rows
;
++
r_i
)
{
for
(
int
c_i
=
0
;
c_i
<
img
.
cols
;
++
c_i
)
{
grid_r
.
at
<
Vec
<
_Tp
,
3
>
>
(
r_i
,
c_i
)
=
r_i
*
ones
;
grid_c
.
at
<
Vec
<
_Tp
,
3
>
>
(
r_i
,
c_i
)
=
c_i
*
ones
;
grid_r
.
at
<
Vec
<
_Tp
,
3
>
>
(
r_i
,
c_i
)
=
(
_Tp
)
r_i
*
ones
;
grid_c
.
at
<
Vec
<
_Tp
,
3
>
>
(
r_i
,
c_i
)
=
(
_Tp
)
c_i
*
ones
;
}
}
}
...
...
modules/reg/test/test_reg.cpp
View file @
81049548
...
...
@@ -59,6 +59,8 @@ using namespace std;
using
namespace
cv
;
using
namespace
cv
::
reg
;
#define REG_DEBUG_OUTPUT 0
class
RegTest
:
public
testing
::
Test
{
...
...
@@ -91,10 +93,11 @@ void RegTest::testShift()
// Print result
MapShift
*
mapShift
=
dynamic_cast
<
MapShift
*>
(
mapPtr
.
get
());
#if REG_DEBUG_OUTPUT
cout
<<
endl
<<
"--- Testing shift mapper ---"
<<
endl
;
cout
<<
Mat
(
shift
)
<<
endl
;
cout
<<
Mat
(
mapShift
->
getShift
())
<<
endl
;
#endif
// Check accuracy
Ptr
<
Map
>
mapInv
(
mapShift
->
inverseMap
());
mapTest
.
compose
(
*
mapInv
.
get
());
...
...
@@ -123,12 +126,13 @@ void RegTest::testEuclidean()
// Print result
MapAffine
*
mapAff
=
dynamic_cast
<
MapAffine
*>
(
mapPtr
.
get
());
#if REG_DEBUG_OUTPUT
cout
<<
endl
<<
"--- Testing Euclidean mapper ---"
<<
endl
;
cout
<<
Mat
(
linTr
)
<<
endl
;
cout
<<
Mat
(
shift
)
<<
endl
;
cout
<<
Mat
(
mapAff
->
getLinTr
())
<<
endl
;
cout
<<
Mat
(
mapAff
->
getShift
())
<<
endl
;
#endif
// Check accuracy
Ptr
<
Map
>
mapInv
(
mapAff
->
inverseMap
());
mapTest
.
compose
(
*
mapInv
.
get
());
...
...
@@ -161,11 +165,13 @@ void RegTest::testSimilarity()
// Print result
MapAffine
*
mapAff
=
dynamic_cast
<
MapAffine
*>
(
mapPtr
.
get
());
#if REG_DEBUG_OUTPUT
cout
<<
endl
<<
"--- Testing similarity mapper ---"
<<
endl
;
cout
<<
Mat
(
linTr
)
<<
endl
;
cout
<<
Mat
(
shift
)
<<
endl
;
cout
<<
Mat
(
mapAff
->
getLinTr
())
<<
endl
;
cout
<<
Mat
(
mapAff
->
getShift
())
<<
endl
;
#endif
// Check accuracy
Ptr
<
Map
>
mapInv
(
mapAff
->
inverseMap
());
...
...
@@ -195,11 +201,13 @@ void RegTest::testAffine()
// Print result
MapAffine
*
mapAff
=
dynamic_cast
<
MapAffine
*>
(
mapPtr
.
get
());
#if REG_DEBUG_OUTPUT
cout
<<
endl
<<
"--- Testing affine mapper ---"
<<
endl
;
cout
<<
Mat
(
linTr
)
<<
endl
;
cout
<<
Mat
(
shift
)
<<
endl
;
cout
<<
Mat
(
mapAff
->
getLinTr
())
<<
endl
;
cout
<<
Mat
(
mapAff
->
getShift
())
<<
endl
;
#endif
// Check accuracy
Ptr
<
Map
>
mapInv
(
mapAff
->
inverseMap
());
...
...
@@ -230,9 +238,11 @@ void RegTest::testProjective()
// Print result
MapProjec
*
mapProj
=
dynamic_cast
<
MapProjec
*>
(
mapPtr
.
get
());
mapProj
->
normalize
();
#if REG_DEBUG_OUTPUT
cout
<<
endl
<<
"--- Testing projective transformation mapper ---"
<<
endl
;
cout
<<
Mat
(
projTr
)
<<
endl
;
cout
<<
Mat
(
mapProj
->
getProjTr
())
<<
endl
;
#endif
// Check accuracy
Ptr
<
Map
>
mapInv
(
mapProj
->
inverseMap
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment