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
b053a3b4
Commit
b053a3b4
authored
Sep 26, 2011
by
Alexey Spizhevoy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added matching mask into pairwise matcher from stitching module
parent
55111329
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
4 deletions
+21
-4
matchers.hpp
...s/stitching/include/opencv2/stitching/detail/matchers.hpp
+3
-1
stitcher.hpp
modules/stitching/include/opencv2/stitching/stitcher.hpp
+8
-0
matchers.cpp
modules/stitching/src/matchers.cpp
+9
-2
stitcher.cpp
modules/stitching/src/stitcher.cpp
+1
-1
No files found.
modules/stitching/include/opencv2/stitching/detail/matchers.hpp
View file @
b053a3b4
...
...
@@ -133,7 +133,9 @@ public:
void
operator
()(
const
ImageFeatures
&
features1
,
const
ImageFeatures
&
features2
,
MatchesInfo
&
matches_info
)
{
match
(
features1
,
features2
,
matches_info
);
}
void
operator
()(
const
std
::
vector
<
ImageFeatures
>
&
features
,
std
::
vector
<
MatchesInfo
>
&
pairwise_matches
);
void
operator
()(
const
std
::
vector
<
ImageFeatures
>
&
features
,
std
::
vector
<
MatchesInfo
>
&
pairwise_matches
,
const
cv
::
Mat
&
mask
=
cv
::
Mat
());
bool
isThreadSafe
()
const
{
return
is_thread_safe_
;
}
...
...
modules/stitching/include/opencv2/stitching/stitcher.hpp
View file @
b053a3b4
...
...
@@ -95,6 +95,13 @@ public:
void
setFeaturesMatcher
(
Ptr
<
detail
::
FeaturesMatcher
>
features_matcher
)
{
features_matcher_
=
features_matcher
;
}
const
cv
::
Mat
&
matchingMask
()
const
{
return
matching_mask_
;
}
void
setMatchingMask
(
const
cv
::
Mat
&
mask
)
{
CV_Assert
(
mask
.
type
()
==
CV_8U
&&
mask
.
cols
==
mask
.
rows
);
matching_mask_
=
mask
.
clone
();
}
Ptr
<
detail
::
BundleAdjusterBase
>
bundleAdjuster
()
{
return
bundle_adjuster_
;
}
const
Ptr
<
detail
::
BundleAdjusterBase
>
bundleAdjuster
()
const
{
return
bundle_adjuster_
;
}
void
setBundleAdjuster
(
Ptr
<
detail
::
BundleAdjusterBase
>
bundle_adjuster
)
...
...
@@ -130,6 +137,7 @@ private:
double
conf_thresh_
;
Ptr
<
detail
::
FeaturesFinder
>
features_finder_
;
Ptr
<
detail
::
FeaturesMatcher
>
features_matcher_
;
cv
::
Mat
matching_mask_
;
Ptr
<
detail
::
BundleAdjusterBase
>
bundle_adjuster_
;
bool
do_wave_correct_
;
detail
::
WaveCorrectKind
wave_correct_kind_
;
...
...
modules/stitching/src/matchers.cpp
View file @
b053a3b4
...
...
@@ -45,6 +45,7 @@
using
namespace
std
;
using
namespace
cv
;
using
namespace
cv
::
detail
;
#ifndef ANDROID
using
namespace
cv
::
gpu
;
#endif
...
...
@@ -340,14 +341,20 @@ const MatchesInfo& MatchesInfo::operator =(const MatchesInfo &other)
//////////////////////////////////////////////////////////////////////////////
void
FeaturesMatcher
::
operator
()(
const
vector
<
ImageFeatures
>
&
features
,
vector
<
MatchesInfo
>
&
pairwise_matches
)
void
FeaturesMatcher
::
operator
()(
const
vector
<
ImageFeatures
>
&
features
,
vector
<
MatchesInfo
>
&
pairwise_matches
,
const
Mat
&
mask
)
{
const
int
num_images
=
static_cast
<
int
>
(
features
.
size
());
CV_Assert
(
mask
.
empty
()
||
(
mask
.
type
()
==
CV_8U
&&
mask
.
cols
==
num_images
&&
mask
.
rows
));
Mat_
<
uchar
>
mask_
(
mask
);
if
(
mask_
.
empty
())
mask_
=
Mat
::
ones
(
num_images
,
num_images
,
CV_8U
);
vector
<
pair
<
int
,
int
>
>
near_pairs
;
for
(
int
i
=
0
;
i
<
num_images
-
1
;
++
i
)
for
(
int
j
=
i
+
1
;
j
<
num_images
;
++
j
)
if
(
features
[
i
].
keypoints
.
size
()
>
0
&&
features
[
j
].
keypoints
.
size
()
>
0
)
if
(
features
[
i
].
keypoints
.
size
()
>
0
&&
features
[
j
].
keypoints
.
size
()
>
0
&&
mask_
(
i
,
j
)
)
near_pairs
.
push_back
(
make_pair
(
i
,
j
));
pairwise_matches
.
resize
(
num_images
*
num_images
);
...
...
modules/stitching/src/stitcher.cpp
View file @
b053a3b4
...
...
@@ -165,7 +165,7 @@ Stitcher::Status Stitcher::matchImages()
LOG
(
"Pairwise matching"
);
t
=
getTickCount
();
(
*
features_matcher_
)(
features_
,
pairwise_matches_
);
(
*
features_matcher_
)(
features_
,
pairwise_matches_
,
matching_mask_
);
features_matcher_
->
collectGarbage
();
LOGLN
(
"Pairwise matching, time: "
<<
((
getTickCount
()
-
t
)
/
getTickFrequency
())
<<
" sec"
);
...
...
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