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
e6cc1be7
Commit
e6cc1be7
authored
Feb 21, 2014
by
Alexander Alekhin
Committed by
Andrey Pavlenko
Apr 11, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stitching: allow to use dynamic DescriptorMatcher
parent
06738468
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
12 deletions
+37
-12
matrix.cpp
modules/core/src/matrix.cpp
+15
-0
matchers.cpp
modules/features2d/src/matchers.cpp
+3
-3
matchers.cpp
modules/stitching/src/matchers.cpp
+19
-9
No files found.
modules/core/src/matrix.cpp
View file @
e6cc1be7
...
...
@@ -1369,6 +1369,21 @@ void _InputArray::getUMatVector(std::vector<UMat>& umv) const
return
;
}
if
(
k
==
UMAT
)
{
UMat
&
v
=
*
(
UMat
*
)
obj
;
umv
.
resize
(
1
);
umv
[
0
]
=
v
;
return
;
}
if
(
k
==
MAT
)
{
Mat
&
v
=
*
(
Mat
*
)
obj
;
umv
.
resize
(
1
);
umv
[
0
]
=
v
.
getUMat
(
accessFlags
);
return
;
}
CV_Error
(
Error
::
StsNotImplemented
,
"Unknown/unsupported array type"
);
}
...
...
modules/features2d/src/matchers.cpp
View file @
e6cc1be7
...
...
@@ -330,7 +330,7 @@ static bool ocl_match2Dispatcher(InputArray query, InputArray train, const UMat
static
bool
ocl_kmatchDispatcher
(
InputArray
query
,
InputArray
train
,
const
UMat
&
trainIdx
,
const
UMat
&
distance
,
int
distType
)
{
return
ocl_match2Dispatcher
(
query
,
train
,
trainIdx
,
distance
,
distType
);
return
ocl_match2Dispatcher
(
query
,
train
,
trainIdx
,
distance
,
distType
);
}
static
bool
ocl_knnMatchSingle
(
InputArray
query
,
InputArray
train
,
UMat
&
trainIdx
,
...
...
@@ -1209,8 +1209,8 @@ FlannBasedMatcher::FlannBasedMatcher( const Ptr<flann::IndexParams>& _indexParam
void
FlannBasedMatcher
::
add
(
InputArrayOfArrays
_descriptors
)
{
DescriptorMatcher
::
add
(
_descriptors
);
std
::
vector
<
Mat
>
descriptors
;
_descriptors
.
getMatVector
(
descriptors
);
std
::
vector
<
U
Mat
>
descriptors
;
_descriptors
.
get
U
MatVector
(
descriptors
);
for
(
size_t
i
=
0
;
i
<
descriptors
.
size
();
i
++
)
{
...
...
modules/stitching/src/matchers.cpp
View file @
e6cc1be7
...
...
@@ -155,21 +155,31 @@ void CpuMatcher::match(const ImageFeatures &features1, const ImageFeatures &feat
matches_info
.
matches
.
clear
();
Ptr
<
flann
::
IndexParams
>
indexParams
=
makePtr
<
flann
::
KDTreeIndexParams
>
();
Ptr
<
flann
::
SearchParams
>
searchParams
=
makePtr
<
flann
::
SearchParams
>
();
if
(
features2
.
descriptors
.
depth
()
==
CV_8U
)
Ptr
<
DescriptorMatcher
>
matcher
;
#if 0 // TODO check this
if (ocl::useOpenCL())
{
indexParams
->
setAlgorithm
(
cvflann
::
FLANN_INDEX_LSH
);
searchParams
->
setAlgorithm
(
cvflann
::
FLANN_INDEX_LSH
);
matcher = makePtr<BFMatcher>((int)NORM_L2);
}
else
#endif
{
Ptr
<
flann
::
IndexParams
>
indexParams
=
makePtr
<
flann
::
KDTreeIndexParams
>
();
Ptr
<
flann
::
SearchParams
>
searchParams
=
makePtr
<
flann
::
SearchParams
>
();
FlannBasedMatcher
matcher
(
indexParams
,
searchParams
);
if
(
features2
.
descriptors
.
depth
()
==
CV_8U
)
{
indexParams
->
setAlgorithm
(
cvflann
::
FLANN_INDEX_LSH
);
searchParams
->
setAlgorithm
(
cvflann
::
FLANN_INDEX_LSH
);
}
matcher
=
makePtr
<
FlannBasedMatcher
>
(
indexParams
,
searchParams
);
}
std
::
vector
<
std
::
vector
<
DMatch
>
>
pair_matches
;
MatchesSet
matches
;
// Find 1->2 matches
matcher
.
knnMatch
(
features1
.
descriptors
,
features2
.
descriptors
,
pair_matches
,
2
);
matcher
->
knnMatch
(
features1
.
descriptors
,
features2
.
descriptors
,
pair_matches
,
2
);
for
(
size_t
i
=
0
;
i
<
pair_matches
.
size
();
++
i
)
{
if
(
pair_matches
[
i
].
size
()
<
2
)
...
...
@@ -186,7 +196,7 @@ void CpuMatcher::match(const ImageFeatures &features1, const ImageFeatures &feat
// Find 2->1 matches
pair_matches
.
clear
();
matcher
.
knnMatch
(
features2
.
descriptors
,
features1
.
descriptors
,
pair_matches
,
2
);
matcher
->
knnMatch
(
features2
.
descriptors
,
features1
.
descriptors
,
pair_matches
,
2
);
for
(
size_t
i
=
0
;
i
<
pair_matches
.
size
();
++
i
)
{
if
(
pair_matches
[
i
].
size
()
<
2
)
...
...
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