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
9608d31a
Commit
9608d31a
authored
Feb 07, 2017
by
Vladislav Sovrasov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reg: use new api in sample
parent
6211920c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
20 deletions
+14
-20
map_test.cpp
modules/reg/samples/map_test.cpp
+14
-20
No files found.
modules/reg/samples/map_test.cpp
View file @
9608d31a
...
...
@@ -99,10 +99,9 @@ static void testShift(const Mat& img1)
showDifference
(
img1
,
img2
,
DIFF_IM
);
// Register
MapperGradShift
mapper
;
Ptr
<
MapperGradShift
>
mapper
=
makePtr
<
MapperGradShift
>
()
;
MapperPyramid
mappPyr
(
mapper
);
Ptr
<
Map
>
mapPtr
;
mappPyr
.
calculate
(
img1
,
img2
,
mapPtr
);
Ptr
<
Map
>
mapPtr
=
mappPyr
.
calculate
(
img1
,
img2
);
// Print result
MapShift
*
mapShift
=
dynamic_cast
<
MapShift
*>
(
mapPtr
.
get
());
...
...
@@ -135,10 +134,9 @@ static void testEuclidean(const Mat& img1)
showDifference
(
img1
,
img2
,
DIFF_IM
);
// Register
MapperGradEuclid
mapper
;
Ptr
<
MapperGradEuclid
>
mapper
=
makePtr
<
MapperGradEuclid
>
()
;
MapperPyramid
mappPyr
(
mapper
);
Ptr
<
Map
>
mapPtr
;
mappPyr
.
calculate
(
img1
,
img2
,
mapPtr
);
Ptr
<
Map
>
mapPtr
=
mappPyr
.
calculate
(
img1
,
img2
);
// Print result
MapAffine
*
mapAff
=
dynamic_cast
<
MapAffine
*>
(
mapPtr
.
get
());
...
...
@@ -174,10 +172,9 @@ static void testSimilarity(const Mat& img1)
showDifference
(
img1
,
img2
,
DIFF_IM
);
// Register
MapperGradSimilar
mapper
;
Ptr
<
MapperGradSimilar
>
mapper
=
makePtr
<
MapperGradSimilar
>
()
;
MapperPyramid
mappPyr
(
mapper
);
Ptr
<
Map
>
mapPtr
;
mappPyr
.
calculate
(
img1
,
img2
,
mapPtr
);
Ptr
<
Map
>
mapPtr
=
mappPyr
.
calculate
(
img1
,
img2
);
// Print result
MapAffine
*
mapAff
=
dynamic_cast
<
MapAffine
*>
(
mapPtr
.
get
());
...
...
@@ -209,10 +206,9 @@ static void testAffine(const Mat& img1)
showDifference
(
img1
,
img2
,
DIFF_IM
);
// Register
MapperGradAffine
mapper
;
Ptr
<
MapperGradAffine
>
mapper
=
makePtr
<
MapperGradAffine
>
()
;
MapperPyramid
mappPyr
(
mapper
);
Ptr
<
Map
>
mapPtr
;
mappPyr
.
calculate
(
img1
,
img2
,
mapPtr
);
Ptr
<
Map
>
mapPtr
=
mappPyr
.
calculate
(
img1
,
img2
);
// Print result
MapAffine
*
mapAff
=
dynamic_cast
<
MapAffine
*>
(
mapPtr
.
get
());
...
...
@@ -243,10 +239,9 @@ static void testProjective(const Mat& img1)
showDifference
(
img1
,
img2
,
DIFF_IM
);
// Register
MapperGradProj
mapper
;
Ptr
<
MapperGradProj
>
mapper
=
makePtr
<
MapperGradProj
>
()
;
MapperPyramid
mappPyr
(
mapper
);
Ptr
<
Map
>
mapPtr
;
mappPyr
.
calculate
(
img1
,
img2
,
mapPtr
);
Ptr
<
Map
>
mapPtr
=
mappPyr
.
calculate
(
img1
,
img2
);
// Print result
MapProjec
*
mapProj
=
dynamic_cast
<
MapProjec
*>
(
mapPtr
.
get
());
...
...
@@ -347,7 +342,7 @@ static void calcHomographyFeature(const Mat& image1, const Mat& image2)
warpPerspective
(
image2
,
result
,
Hinv
,
image1
.
size
());
cout
<<
"--- Feature method
\n
"
<<
H
<<
endl
;
Mat
imf1
,
resf
;
image1
.
convertTo
(
imf1
,
CV_64FC3
);
result
.
convertTo
(
resf
,
CV_64FC3
);
...
...
@@ -359,10 +354,9 @@ static void calcHomographyPixel(const Mat& img1, const Mat& img2)
static
const
char
*
diffpixel
=
"Difference pixel registered"
;
// Register using pixel differences
MapperGradProj
mapper
;
Ptr
<
MapperGradProj
>
mapper
=
makePtr
<
MapperGradProj
>
()
;
MapperPyramid
mappPyr
(
mapper
);
Ptr
<
Map
>
mapPtr
;
mappPyr
.
calculate
(
img1
,
img2
,
mapPtr
);
Ptr
<
Map
>
mapPtr
=
mappPyr
.
calculate
(
img1
,
img2
);
// Print result
MapProjec
*
mapProj
=
dynamic_cast
<
MapProjec
*>
(
mapPtr
.
get
());
...
...
@@ -398,7 +392,7 @@ static void comparePixelVsFeature(const Mat& img1_8b, const Mat& img2_8b)
int
main
(
void
)
{
Mat
img1
;
Mat
img1
;
img1
=
imread
(
"home.png"
,
CV_LOAD_IMAGE_UNCHANGED
);
if
(
!
img1
.
data
)
{
cout
<<
"Could not open or find file"
<<
endl
;
...
...
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