Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
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
Commits
b720eddd
Commit
b720eddd
authored
Oct 27, 2011
by
Andrey Kamaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tegra-optimized features matching for Stitching
parent
5afb4452
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
74 additions
and
10 deletions
+74
-10
CMakeLists.txt
modules/stitching/CMakeLists.txt
+0
-1
perf_stich.cpp
modules/stitching/perf/perf_stich.cpp
+59
-4
matchers.cpp
modules/stitching/src/matchers.cpp
+7
-2
precomp.hpp
modules/stitching/src/precomp.hpp
+8
-3
No files found.
modules/stitching/CMakeLists.txt
View file @
b720eddd
include_directories
(
"
${
OpenCV_SOURCE_DIR
}
/modules/imgproc/src"
)
# For gcgraph.hpp
if
(
ANDROID
)
define_opencv_module
(
stitching opencv_core opencv_imgproc opencv_features2d opencv_calib3d opencv_flann opencv_objdetect
)
else
()
...
...
modules/stitching/perf/perf_stich.cpp
View file @
b720eddd
#include "perf_precomp.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/flann/flann.hpp"
using
namespace
std
;
using
namespace
cv
;
using
namespace
perf
;
#define SURF_MATCH_CONFIDENCE 0.65f
#define ORB_MATCH_CONFIDENCE 0.3f
#define WORK_MEGAPIX 0.6
typedef
TestBaseWithParam
<
String
>
stitch
;
typedef
TestBaseWithParam
<
String
>
match
;
PERF_TEST_P
(
stitch
,
a123
,
testing
::
Values
(
"surf"
,
"orb"
))
{
...
...
@@ -23,8 +29,8 @@ PERF_TEST_P( stitch, a123, testing::Values("surf", "orb"))
:
(
detail
::
FeaturesFinder
*
)
new
detail
::
SurfFeaturesFinder
();
Ptr
<
detail
::
FeaturesMatcher
>
featuresMatcher
=
GetParam
()
==
"orb"
?
new
detail
::
BestOf2NearestMatcher
(
false
,
0.3
f
)
:
new
detail
::
BestOf2NearestMatcher
(
false
,
0.65
f
);
?
new
detail
::
BestOf2NearestMatcher
(
false
,
ORB_MATCH_CONFIDENCE
)
:
new
detail
::
BestOf2NearestMatcher
(
false
,
SURF_MATCH_CONFIDENCE
);
declare
.
time
(
30
*
20
).
iterations
(
50
);
...
...
@@ -33,6 +39,8 @@ PERF_TEST_P( stitch, a123, testing::Values("surf", "orb"))
Stitcher
stitcher
=
Stitcher
::
createDefault
();
stitcher
.
setFeaturesFinder
(
featuresFinder
);
stitcher
.
setFeaturesMatcher
(
featuresMatcher
);
stitcher
.
setWarper
(
new
CylindricalWarper
());
stitcher
.
setRegistrationResol
(
WORK_MEGAPIX
);
startTimer
();
status
=
stitcher
.
stitch
(
imgs
,
pano
);
...
...
@@ -54,8 +62,8 @@ PERF_TEST_P( stitch, b12, testing::Values("surf", "orb"))
:
(
detail
::
FeaturesFinder
*
)
new
detail
::
SurfFeaturesFinder
();
Ptr
<
detail
::
FeaturesMatcher
>
featuresMatcher
=
GetParam
()
==
"orb"
?
new
detail
::
BestOf2NearestMatcher
(
false
,
0.3
f
)
:
new
detail
::
BestOf2NearestMatcher
(
false
,
0.65
f
);
?
new
detail
::
BestOf2NearestMatcher
(
false
,
ORB_MATCH_CONFIDENCE
)
:
new
detail
::
BestOf2NearestMatcher
(
false
,
SURF_MATCH_CONFIDENCE
);
declare
.
time
(
30
*
20
).
iterations
(
50
);
...
...
@@ -64,9 +72,56 @@ PERF_TEST_P( stitch, b12, testing::Values("surf", "orb"))
Stitcher
stitcher
=
Stitcher
::
createDefault
();
stitcher
.
setFeaturesFinder
(
featuresFinder
);
stitcher
.
setFeaturesMatcher
(
featuresMatcher
);
stitcher
.
setWarper
(
new
CylindricalWarper
());
stitcher
.
setRegistrationResol
(
WORK_MEGAPIX
);
startTimer
();
status
=
stitcher
.
stitch
(
imgs
,
pano
);
stopTimer
();
}
}
PERF_TEST_P
(
match
,
bestOf2Nearest
,
testing
::
Values
(
"surf"
,
"orb"
))
{
Mat
img1
,
img1_full
=
imread
(
getDataPath
(
"stitching/b1.jpg"
)
);
Mat
img2
,
img2_full
=
imread
(
getDataPath
(
"stitching/b2.jpg"
)
);
float
scale1
=
std
::
min
(
1.0
,
sqrt
(
WORK_MEGAPIX
*
1e6
/
img1_full
.
total
()));
float
scale2
=
std
::
min
(
1.0
,
sqrt
(
WORK_MEGAPIX
*
1e6
/
img2_full
.
total
()));
resize
(
img1_full
,
img1
,
Size
(),
scale1
,
scale1
);
resize
(
img2_full
,
img2
,
Size
(),
scale2
,
scale2
);
Ptr
<
detail
::
FeaturesFinder
>
finder
;
Ptr
<
detail
::
FeaturesMatcher
>
matcher
;
if
(
GetParam
()
==
"surf"
)
{
finder
=
new
detail
::
SurfFeaturesFinder
();
matcher
=
new
detail
::
BestOf2NearestMatcher
(
false
,
SURF_MATCH_CONFIDENCE
);
}
else
if
(
GetParam
()
==
"orb"
)
{
finder
=
new
detail
::
OrbFeaturesFinder
();
matcher
=
new
detail
::
BestOf2NearestMatcher
(
false
,
ORB_MATCH_CONFIDENCE
);
}
else
{
FAIL
()
<<
"Unknown 2D features type: "
<<
GetParam
();
}
detail
::
ImageFeatures
features1
,
features2
;
(
*
finder
)(
img1
,
features1
);
(
*
finder
)(
img2
,
features2
);
detail
::
MatchesInfo
pairwise_matches
;
declare
.
in
(
features1
.
descriptors
,
features2
.
descriptors
)
.
iterations
(
100
);
while
(
next
())
{
cvflann
::
seed_random
(
42
);
//for predictive FlannBasedMatcher
startTimer
();
(
*
matcher
)(
features1
,
features2
,
pairwise_matches
);
stopTimer
();
matcher
->
collectGarbage
();
}
}
modules/stitching/src/matchers.cpp
View file @
b720eddd
...
...
@@ -147,11 +147,16 @@ private:
void
CpuMatcher
::
match
(
const
ImageFeatures
&
features1
,
const
ImageFeatures
&
features2
,
MatchesInfo
&
matches_info
)
{
matches_info
.
matches
.
clear
();
CV_Assert
(
features1
.
descriptors
.
type
()
==
features2
.
descriptors
.
type
());
CV_Assert
(
features2
.
descriptors
.
depth
()
==
CV_8U
||
features2
.
descriptors
.
depth
()
==
CV_32F
);
#ifdef HAVE_TEGRA_OPTIMIZATION
if
(
tegra
::
match2nearest
(
features1
,
features2
,
matches_info
,
match_conf_
))
return
;
#endif
matches_info
.
matches
.
clear
();
Ptr
<
flann
::
IndexParams
>
indexParams
=
new
flann
::
KDTreeIndexParams
();
Ptr
<
flann
::
SearchParams
>
searchParams
=
new
flann
::
SearchParams
();
...
...
modules/stitching/src/precomp.hpp
View file @
b720eddd
...
...
@@ -54,6 +54,8 @@
#include <functional>
#include <sstream>
#include <cmath>
#include "opencv2/core/core.hpp"
#include "opencv2/core/internal.hpp"
#include "opencv2/stitching/stitcher.hpp"
#include "opencv2/stitching/detail/autocalib.hpp"
#include "opencv2/stitching/detail/blenders.hpp"
...
...
@@ -64,14 +66,17 @@
#include "opencv2/stitching/detail/seam_finders.hpp"
#include "opencv2/stitching/detail/util.hpp"
#include "opencv2/stitching/detail/warpers.hpp"
#include "opencv2/core/core.hpp"
#include "opencv2/core/internal.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#ifndef ANDROID
# include "opencv2/gpu/gpu.hpp"
#endif
#include "gcgraph.hpp"
#include "modules/imgproc/src/gcgraph.hpp"
#ifdef HAVE_TEGRA_OPTIMIZATION
# include "opencv2/stitching/stitching_tegra.hpp"
#endif
#endif
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