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
97dab3b5
Commit
97dab3b5
authored
Feb 06, 2017
by
Vladislav Sovrasov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reg: enable wrapping of Map::compose()
parent
79edb0fa
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
21 additions
and
21 deletions
+21
-21
map.hpp
modules/reg/include/opencv2/reg/map.hpp
+1
-1
mapaffine.hpp
modules/reg/include/opencv2/reg/mapaffine.hpp
+1
-1
mapprojec.hpp
modules/reg/include/opencv2/reg/mapprojec.hpp
+1
-1
mapshift.hpp
modules/reg/include/opencv2/reg/mapshift.hpp
+1
-1
mapaffine.cpp
modules/reg/src/mapaffine.cpp
+2
-2
mappergradaffine.cpp
modules/reg/src/mappergradaffine.cpp
+1
-1
mappergradeuclid.cpp
modules/reg/src/mappergradeuclid.cpp
+1
-1
mappergradproj.cpp
modules/reg/src/mappergradproj.cpp
+1
-1
mappergradshift.cpp
modules/reg/src/mappergradshift.cpp
+1
-1
mappergradsimilar.cpp
modules/reg/src/mappergradsimilar.cpp
+1
-1
mapperpyramid.cpp
modules/reg/src/mapperpyramid.cpp
+1
-1
mapprojec.cpp
modules/reg/src/mapprojec.cpp
+2
-2
mapshift.cpp
modules/reg/src/mapshift.cpp
+2
-2
test_reg.cpp
modules/reg/test/test_reg.cpp
+5
-5
No files found.
modules/reg/include/opencv2/reg/map.hpp
View file @
97dab3b5
...
@@ -158,7 +158,7 @@ public:
...
@@ -158,7 +158,7 @@ public:
* The order is first the current transformation, then the input argument.
* The order is first the current transformation, then the input argument.
* \param[in] map Transformation to compose with.
* \param[in] map Transformation to compose with.
*/
*/
virtual
void
compose
(
const
Map
&
map
)
=
0
;
CV_WRAP
virtual
void
compose
(
cv
::
Ptr
<
Map
>
map
)
=
0
;
/*!
/*!
* Scales the map by a given factor as if the coordinates system is expanded/compressed
* Scales the map by a given factor as if the coordinates system is expanded/compressed
...
...
modules/reg/include/opencv2/reg/mapaffine.hpp
View file @
97dab3b5
...
@@ -73,7 +73,7 @@ public:
...
@@ -73,7 +73,7 @@ public:
CV_WRAP
cv
::
Ptr
<
Map
>
inverseMap
()
const
;
CV_WRAP
cv
::
Ptr
<
Map
>
inverseMap
()
const
;
void
compose
(
const
Map
&
map
);
CV_WRAP
void
compose
(
cv
::
Ptr
<
Map
>
map
);
CV_WRAP
void
scale
(
double
factor
);
CV_WRAP
void
scale
(
double
factor
);
...
...
modules/reg/include/opencv2/reg/mapprojec.hpp
View file @
97dab3b5
...
@@ -73,7 +73,7 @@ public:
...
@@ -73,7 +73,7 @@ public:
CV_WRAP
cv
::
Ptr
<
Map
>
inverseMap
()
const
;
CV_WRAP
cv
::
Ptr
<
Map
>
inverseMap
()
const
;
void
compose
(
const
Map
&
map
);
CV_WRAP
void
compose
(
cv
::
Ptr
<
Map
>
map
);
CV_WRAP
void
scale
(
double
factor
);
CV_WRAP
void
scale
(
double
factor
);
...
...
modules/reg/include/opencv2/reg/mapshift.hpp
View file @
97dab3b5
...
@@ -73,7 +73,7 @@ public:
...
@@ -73,7 +73,7 @@ public:
CV_WRAP
cv
::
Ptr
<
Map
>
inverseMap
()
const
;
CV_WRAP
cv
::
Ptr
<
Map
>
inverseMap
()
const
;
void
compose
(
const
Map
&
map
);
CV_WRAP
void
compose
(
cv
::
Ptr
<
Map
>
map
);
CV_WRAP
void
scale
(
double
factor
);
CV_WRAP
void
scale
(
double
factor
);
...
...
modules/reg/src/mapaffine.cpp
View file @
97dab3b5
...
@@ -94,10 +94,10 @@ Ptr<Map> MapAffine::inverseMap(void) const
...
@@ -94,10 +94,10 @@ Ptr<Map> MapAffine::inverseMap(void) const
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
void
MapAffine
::
compose
(
c
onst
Map
&
map
)
void
MapAffine
::
compose
(
c
v
::
Ptr
<
Map
>
map
)
{
{
// Composition of affine transformations T and T' is (T o T') = A'Ax + A'b + b'
// Composition of affine transformations T and T' is (T o T') = A'Ax + A'b + b'
const
MapAffine
&
mapAff
=
static_cast
<
const
MapAffine
&>
(
map
);
const
MapAffine
&
mapAff
=
static_cast
<
const
MapAffine
&>
(
*
map
);
Matx
<
double
,
2
,
2
>
compMat
=
mapAff
.
getLinTr
()
*
linTr_
;
Matx
<
double
,
2
,
2
>
compMat
=
mapAff
.
getLinTr
()
*
linTr_
;
Vec
<
double
,
2
>
compShift
=
mapAff
.
getLinTr
()
*
shift_
+
mapAff
.
getShift
();
Vec
<
double
,
2
>
compShift
=
mapAff
.
getLinTr
()
*
shift_
+
mapAff
.
getShift
();
linTr_
=
compMat
;
linTr_
=
compMat
;
...
...
modules/reg/src/mappergradaffine.cpp
View file @
97dab3b5
...
@@ -148,7 +148,7 @@ void MapperGradAffine::calculate(InputArray _img1, InputArray image2, cv::Ptr<Ma
...
@@ -148,7 +148,7 @@ void MapperGradAffine::calculate(InputArray _img1, InputArray image2, cv::Ptr<Ma
if
(
res
.
empty
())
{
if
(
res
.
empty
())
{
res
=
Ptr
<
Map
>
(
new
MapAffine
(
linTr
,
shift
));
res
=
Ptr
<
Map
>
(
new
MapAffine
(
linTr
,
shift
));
}
else
{
}
else
{
MapAffine
newTr
(
linTr
,
shift
);
Ptr
<
MapAffine
>
newTr
(
new
MapAffine
(
linTr
,
shift
)
);
res
->
compose
(
newTr
);
res
->
compose
(
newTr
);
}
}
}
}
...
...
modules/reg/src/mappergradeuclid.cpp
View file @
97dab3b5
...
@@ -115,7 +115,7 @@ void MapperGradEuclid::calculate(
...
@@ -115,7 +115,7 @@ void MapperGradEuclid::calculate(
if
(
res
.
empty
())
{
if
(
res
.
empty
())
{
res
=
Ptr
<
Map
>
(
new
MapAffine
(
linTr
,
shift
));
res
=
Ptr
<
Map
>
(
new
MapAffine
(
linTr
,
shift
));
}
else
{
}
else
{
MapAffine
newTr
(
linTr
,
shift
);
Ptr
<
MapAffine
>
newTr
(
new
MapAffine
(
linTr
,
shift
)
);
res
->
compose
(
newTr
);
res
->
compose
(
newTr
);
}
}
}
}
...
...
modules/reg/src/mappergradproj.cpp
View file @
97dab3b5
...
@@ -199,7 +199,7 @@ void MapperGradProj::calculate(
...
@@ -199,7 +199,7 @@ void MapperGradProj::calculate(
if
(
res
.
empty
())
{
if
(
res
.
empty
())
{
res
=
Ptr
<
Map
>
(
new
MapProjec
(
H
));
res
=
Ptr
<
Map
>
(
new
MapProjec
(
H
));
}
else
{
}
else
{
MapProjec
newTr
(
H
);
Ptr
<
MapProjec
>
newTr
(
new
MapProjec
(
H
)
);
res
->
compose
(
newTr
);
res
->
compose
(
newTr
);
}
}
}
}
...
...
modules/reg/src/mappergradshift.cpp
View file @
97dab3b5
...
@@ -96,7 +96,7 @@ void MapperGradShift::calculate(
...
@@ -96,7 +96,7 @@ void MapperGradShift::calculate(
if
(
res
.
empty
())
{
if
(
res
.
empty
())
{
res
=
Ptr
<
Map
>
(
new
MapShift
(
shift
));
res
=
Ptr
<
Map
>
(
new
MapShift
(
shift
));
}
else
{
}
else
{
MapShift
newTr
(
shift
);
Ptr
<
MapShift
>
newTr
(
new
MapShift
(
shift
)
);
res
->
compose
(
newTr
);
res
->
compose
(
newTr
);
}
}
}
}
...
...
modules/reg/src/mappergradsimilar.cpp
View file @
97dab3b5
...
@@ -130,7 +130,7 @@ void MapperGradSimilar::calculate(
...
@@ -130,7 +130,7 @@ void MapperGradSimilar::calculate(
if
(
res
.
empty
())
{
if
(
res
.
empty
())
{
res
=
Ptr
<
Map
>
(
new
MapAffine
(
linTr
,
shift
));
res
=
Ptr
<
Map
>
(
new
MapAffine
(
linTr
,
shift
));
}
else
{
}
else
{
MapAffine
newTr
(
linTr
,
shift
);
Ptr
<
MapAffine
>
newTr
(
new
MapAffine
(
linTr
,
shift
)
);
res
->
compose
(
newTr
);
res
->
compose
(
newTr
);
}
}
}
}
...
...
modules/reg/src/mapperpyramid.cpp
View file @
97dab3b5
...
@@ -91,7 +91,7 @@ void MapperPyramid::calculate(InputArray _img1, InputArray image2, Ptr<Map>& res
...
@@ -91,7 +91,7 @@ void MapperPyramid::calculate(InputArray _img1, InputArray image2, Ptr<Map>& res
}
}
}
}
res
->
compose
(
*
ident
.
get
()
);
res
->
compose
(
ident
);
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
...
...
modules/reg/src/mapprojec.cpp
View file @
97dab3b5
...
@@ -96,10 +96,10 @@ Ptr<Map> MapProjec::inverseMap(void) const
...
@@ -96,10 +96,10 @@ Ptr<Map> MapProjec::inverseMap(void) const
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
void
MapProjec
::
compose
(
const
Map
&
map
)
void
MapProjec
::
compose
(
Ptr
<
Map
>
map
)
{
{
// Composition of homographies H and H' is (H o H') = H'*H
// Composition of homographies H and H' is (H o H') = H'*H
const
MapProjec
&
mapProj
=
static_cast
<
const
MapProjec
&>
(
map
);
const
MapProjec
&
mapProj
=
static_cast
<
const
MapProjec
&>
(
*
map
);
Matx
<
double
,
3
,
3
>
compProjTr
=
mapProj
.
getProjTr
()
*
projTr_
;
Matx
<
double
,
3
,
3
>
compProjTr
=
mapProj
.
getProjTr
()
*
projTr_
;
projTr_
=
compProjTr
;
projTr_
=
compProjTr
;
}
}
...
...
modules/reg/src/mapshift.cpp
View file @
97dab3b5
...
@@ -92,10 +92,10 @@ Ptr<Map> MapShift::inverseMap(void) const
...
@@ -92,10 +92,10 @@ Ptr<Map> MapShift::inverseMap(void) const
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
void
MapShift
::
compose
(
c
onst
Map
&
map
)
void
MapShift
::
compose
(
c
v
::
Ptr
<
Map
>
map
)
{
{
// Composition of transformations T and T' is (T o T') = b + b'
// Composition of transformations T and T' is (T o T') = b + b'
const
MapShift
&
mapShift
=
static_cast
<
const
MapShift
&>
(
map
);
const
MapShift
&
mapShift
=
static_cast
<
const
MapShift
&>
(
*
map
);
shift_
+=
mapShift
.
getShift
();
shift_
+=
mapShift
.
getShift
();
}
}
...
...
modules/reg/test/test_reg.cpp
View file @
97dab3b5
...
@@ -100,7 +100,7 @@ void RegTest::testShift()
...
@@ -100,7 +100,7 @@ void RegTest::testShift()
#endif
#endif
// Check accuracy
// Check accuracy
Ptr
<
Map
>
mapInv
(
mapShift
->
inverseMap
());
Ptr
<
Map
>
mapInv
(
mapShift
->
inverseMap
());
mapTest
.
compose
(
*
mapInv
.
get
()
);
mapTest
.
compose
(
mapInv
);
double
shNorm
=
norm
(
mapTest
.
getShift
());
double
shNorm
=
norm
(
mapTest
.
getShift
());
EXPECT_LE
(
shNorm
,
0.1
);
EXPECT_LE
(
shNorm
,
0.1
);
}
}
...
@@ -135,7 +135,7 @@ void RegTest::testEuclidean()
...
@@ -135,7 +135,7 @@ void RegTest::testEuclidean()
#endif
#endif
// Check accuracy
// Check accuracy
Ptr
<
Map
>
mapInv
(
mapAff
->
inverseMap
());
Ptr
<
Map
>
mapInv
(
mapAff
->
inverseMap
());
mapTest
.
compose
(
*
mapInv
.
get
()
);
mapTest
.
compose
(
mapInv
);
double
shNorm
=
norm
(
mapTest
.
getShift
());
double
shNorm
=
norm
(
mapTest
.
getShift
());
EXPECT_LE
(
shNorm
,
0.1
);
EXPECT_LE
(
shNorm
,
0.1
);
double
linTrNorm
=
norm
(
mapTest
.
getLinTr
());
double
linTrNorm
=
norm
(
mapTest
.
getLinTr
());
...
@@ -175,7 +175,7 @@ void RegTest::testSimilarity()
...
@@ -175,7 +175,7 @@ void RegTest::testSimilarity()
// Check accuracy
// Check accuracy
Ptr
<
Map
>
mapInv
(
mapAff
->
inverseMap
());
Ptr
<
Map
>
mapInv
(
mapAff
->
inverseMap
());
mapTest
.
compose
(
*
mapInv
.
get
()
);
mapTest
.
compose
(
mapInv
);
double
shNorm
=
norm
(
mapTest
.
getShift
());
double
shNorm
=
norm
(
mapTest
.
getShift
());
EXPECT_LE
(
shNorm
,
0.1
);
EXPECT_LE
(
shNorm
,
0.1
);
double
linTrNorm
=
norm
(
mapTest
.
getLinTr
());
double
linTrNorm
=
norm
(
mapTest
.
getLinTr
());
...
@@ -211,7 +211,7 @@ void RegTest::testAffine()
...
@@ -211,7 +211,7 @@ void RegTest::testAffine()
// Check accuracy
// Check accuracy
Ptr
<
Map
>
mapInv
(
mapAff
->
inverseMap
());
Ptr
<
Map
>
mapInv
(
mapAff
->
inverseMap
());
mapTest
.
compose
(
*
mapInv
.
get
()
);
mapTest
.
compose
(
mapInv
);
double
shNorm
=
norm
(
mapTest
.
getShift
());
double
shNorm
=
norm
(
mapTest
.
getShift
());
EXPECT_LE
(
shNorm
,
0.1
);
EXPECT_LE
(
shNorm
,
0.1
);
double
linTrNorm
=
norm
(
mapTest
.
getLinTr
());
double
linTrNorm
=
norm
(
mapTest
.
getLinTr
());
...
@@ -246,7 +246,7 @@ void RegTest::testProjective()
...
@@ -246,7 +246,7 @@ void RegTest::testProjective()
// Check accuracy
// Check accuracy
Ptr
<
Map
>
mapInv
(
mapProj
->
inverseMap
());
Ptr
<
Map
>
mapInv
(
mapProj
->
inverseMap
());
mapTest
.
compose
(
*
mapInv
.
get
()
);
mapTest
.
compose
(
mapInv
);
double
projNorm
=
norm
(
mapTest
.
getProjTr
());
double
projNorm
=
norm
(
mapTest
.
getProjTr
());
EXPECT_LE
(
projNorm
,
sqrt
(
3.
)
+
0.01
);
EXPECT_LE
(
projNorm
,
sqrt
(
3.
)
+
0.01
);
EXPECT_GE
(
projNorm
,
sqrt
(
3.
)
-
0.01
);
EXPECT_GE
(
projNorm
,
sqrt
(
3.
)
-
0.01
);
...
...
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