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
f11efdce
Commit
f11efdce
authored
May 16, 2011
by
Vladislav Vinogradov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added support of Hamming distance to BruteForceMatcher_GPU
parent
79ed4e4c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
9 deletions
+51
-9
gpu.hpp
modules/gpu/include/opencv2/gpu/gpu.hpp
+13
-1
brute_force_matcher.cpp
modules/gpu/src/brute_force_matcher.cpp
+38
-8
brute_force_matcher.cu
modules/gpu/src/cuda/brute_force_matcher.cu
+0
-0
No files found.
modules/gpu/include/opencv2/gpu/gpu.hpp
View file @
f11efdce
...
...
@@ -1382,7 +1382,7 @@ namespace cv
class
CV_EXPORTS
BruteForceMatcher_GPU_base
{
public
:
enum
DistType
{
L1Dist
=
0
,
L2Dist
};
enum
DistType
{
L1Dist
=
0
,
L2Dist
,
HammingDist
};
explicit
BruteForceMatcher_GPU_base
(
DistType
distType
=
L2Dist
);
...
...
@@ -1522,6 +1522,18 @@ namespace cv
explicit
BruteForceMatcher_GPU
()
:
BruteForceMatcher_GPU_base
(
L2Dist
)
{}
explicit
BruteForceMatcher_GPU
(
L2
<
T
>
/*d*/
)
:
BruteForceMatcher_GPU_base
(
L2Dist
)
{}
};
template
<>
class
CV_EXPORTS
BruteForceMatcher_GPU
<
HammingLUT
>
:
public
BruteForceMatcher_GPU_base
{
public
:
explicit
BruteForceMatcher_GPU
()
:
BruteForceMatcher_GPU_base
(
HammingDist
)
{}
explicit
BruteForceMatcher_GPU
(
HammingLUT
/*d*/
)
:
BruteForceMatcher_GPU_base
(
HammingDist
)
{}
};
template
<>
class
CV_EXPORTS
BruteForceMatcher_GPU
<
Hamming
>
:
public
BruteForceMatcher_GPU_base
{
public
:
explicit
BruteForceMatcher_GPU
()
:
BruteForceMatcher_GPU_base
(
HammingDist
)
{}
explicit
BruteForceMatcher_GPU
(
Hamming
/*d*/
)
:
BruteForceMatcher_GPU_base
(
HammingDist
)
{}
};
////////////////////////////////// CascadeClassifier_GPU //////////////////////////////////////////
// The cascade classifier class for object detection.
...
...
modules/gpu/src/brute_force_matcher.cpp
View file @
f11efdce
...
...
@@ -83,14 +83,20 @@ namespace cv { namespace gpu { namespace bfmatcher
const
DevMem2D
&
mask
,
const
DevMem2Di
&
trainIdx
,
const
DevMem2Di
&
imgIdx
,
const
DevMem2Df
&
distance
,
bool
cc_12
);
template
<
typename
T
>
void
matchSingleHamming_gpu
(
const
DevMem2D
&
queryDescs
,
const
DevMem2D
&
trainDescs
,
const
DevMem2D
&
mask
,
const
DevMem2Di
&
trainIdx
,
const
DevMem2Di
&
imgIdx
,
const
DevMem2Df
&
distance
,
bool
cc_12
);
template
<
typename
T
>
void
matchCollectionL1_gpu
(
const
DevMem2D
&
queryDescs
,
const
DevMem2D
&
trainCollection
,
const
DevMem2D_
<
PtrStep
>&
maskCollection
,
const
DevMem2Di
&
trainIdx
,
const
DevMem2Di
&
imgIdx
,
const
DevMem2Df
&
distance
,
const
DevMem2D_
<
PtrStep
>&
maskCollection
,
const
DevMem2Di
&
trainIdx
,
const
DevMem2Di
&
imgIdx
,
const
DevMem2Df
&
distance
,
bool
cc_12
);
template
<
typename
T
>
void
matchCollectionL2_gpu
(
const
DevMem2D
&
queryDescs
,
const
DevMem2D
&
trainCollection
,
const
DevMem2D_
<
PtrStep
>&
maskCollection
,
const
DevMem2Di
&
trainIdx
,
const
DevMem2Di
&
imgIdx
,
const
DevMem2Df
&
distance
,
const
DevMem2D_
<
PtrStep
>&
maskCollection
,
const
DevMem2Di
&
trainIdx
,
const
DevMem2Di
&
imgIdx
,
const
DevMem2Df
&
distance
,
bool
cc_12
);
template
<
typename
T
>
void
matchCollectionHamming_gpu
(
const
DevMem2D
&
queryDescs
,
const
DevMem2D
&
trainCollection
,
const
DevMem2D_
<
PtrStep
>&
maskCollection
,
const
DevMem2Di
&
trainIdx
,
const
DevMem2Di
&
imgIdx
,
const
DevMem2Df
&
distance
,
bool
cc_12
);
template
<
typename
T
>
...
...
@@ -99,6 +105,9 @@ namespace cv { namespace gpu { namespace bfmatcher
template
<
typename
T
>
void
knnMatchL2_gpu
(
const
DevMem2D
&
queryDescs
,
const
DevMem2D
&
trainDescs
,
int
knn
,
const
DevMem2D
&
mask
,
const
DevMem2Di
&
trainIdx
,
const
DevMem2Df
&
distance
,
const
DevMem2Df
&
allDist
);
template
<
typename
T
>
void
knnMatchHamming_gpu
(
const
DevMem2D
&
queryDescs
,
const
DevMem2D
&
trainDescs
,
int
knn
,
const
DevMem2D
&
mask
,
const
DevMem2Di
&
trainIdx
,
const
DevMem2Df
&
distance
,
const
DevMem2Df
&
allDist
);
template
<
typename
T
>
void
radiusMatchL1_gpu
(
const
DevMem2D
&
queryDescs
,
const
DevMem2D
&
trainDescs
,
float
maxDistance
,
...
...
@@ -106,6 +115,9 @@ namespace cv { namespace gpu { namespace bfmatcher
template
<
typename
T
>
void
radiusMatchL2_gpu
(
const
DevMem2D
&
queryDescs
,
const
DevMem2D
&
trainDescs
,
float
maxDistance
,
const
DevMem2D
&
mask
,
const
DevMem2Di
&
trainIdx
,
unsigned
int
*
nMatches
,
const
DevMem2Df
&
distance
);
template
<
typename
T
>
void
radiusMatchHamming_gpu
(
const
DevMem2D
&
queryDescs
,
const
DevMem2D
&
trainDescs
,
float
maxDistance
,
const
DevMem2D
&
mask
,
const
DevMem2Di
&
trainIdx
,
unsigned
int
*
nMatches
,
const
DevMem2Df
&
distance
);
}}}
namespace
...
...
@@ -167,7 +179,7 @@ void cv::gpu::BruteForceMatcher_GPU_base::matchSingle(const GpuMat& queryDescs,
const
DevMem2D
&
mask
,
const
DevMem2Di
&
trainIdx
,
const
DevMem2Di
&
imgIdx
,
const
DevMem2Df
&
distance
,
bool
cc_12
);
static
const
match_caller_t
match_callers
[
2
][
8
]
=
static
const
match_caller_t
match_callers
[
3
][
8
]
=
{
{
matchSingleL1_gpu
<
unsigned
char
>
,
matchSingleL1_gpu
<
signed
char
>
,
...
...
@@ -178,6 +190,11 @@ void cv::gpu::BruteForceMatcher_GPU_base::matchSingle(const GpuMat& queryDescs,
matchSingleL2_gpu
<
unsigned
char
>
,
matchSingleL2_gpu
<
signed
char
>
,
matchSingleL2_gpu
<
unsigned
short
>
,
matchSingleL2_gpu
<
short
>
,
matchSingleL2_gpu
<
int
>
,
matchSingleL2_gpu
<
float
>
,
0
,
0
},
{
matchSingleHamming_gpu
<
unsigned
char
>
,
matchSingleHamming_gpu
<
signed
char
>
,
matchSingleHamming_gpu
<
unsigned
short
>
,
matchSingleHamming_gpu
<
short
>
,
matchSingleHamming_gpu
<
int
>
,
0
,
0
,
0
}
};
...
...
@@ -295,7 +312,7 @@ void cv::gpu::BruteForceMatcher_GPU_base::matchCollection(const GpuMat& queryDes
const
DevMem2D_
<
PtrStep
>&
maskCollection
,
const
DevMem2Di
&
trainIdx
,
const
DevMem2Di
&
imgIdx
,
const
DevMem2Df
&
distance
,
bool
cc_12
);
static
const
match_caller_t
match_callers
[
2
][
8
]
=
static
const
match_caller_t
match_callers
[
3
][
8
]
=
{
{
matchCollectionL1_gpu
<
unsigned
char
>
,
matchCollectionL1_gpu
<
signed
char
>
,
...
...
@@ -306,6 +323,11 @@ void cv::gpu::BruteForceMatcher_GPU_base::matchCollection(const GpuMat& queryDes
matchCollectionL2_gpu
<
unsigned
char
>
,
matchCollectionL2_gpu
<
signed
char
>
,
matchCollectionL2_gpu
<
unsigned
short
>
,
matchCollectionL2_gpu
<
short
>
,
matchCollectionL2_gpu
<
int
>
,
matchCollectionL2_gpu
<
float
>
,
0
,
0
},
{
matchCollectionHamming_gpu
<
unsigned
char
>
,
matchCollectionHamming_gpu
<
signed
char
>
,
matchCollectionHamming_gpu
<
unsigned
short
>
,
matchCollectionHamming_gpu
<
short
>
,
matchCollectionHamming_gpu
<
int
>
,
0
,
0
,
0
}
};
...
...
@@ -391,7 +413,7 @@ void cv::gpu::BruteForceMatcher_GPU_base::knnMatch(const GpuMat& queryDescs, con
typedef
void
(
*
match_caller_t
)(
const
DevMem2D
&
queryDescs
,
const
DevMem2D
&
trainDescs
,
int
knn
,
const
DevMem2D
&
mask
,
const
DevMem2Di
&
trainIdx
,
const
DevMem2Df
&
distance
,
const
DevMem2Df
&
allDist
);
static
const
match_caller_t
match_callers
[
2
][
8
]
=
static
const
match_caller_t
match_callers
[
3
][
8
]
=
{
{
knnMatchL1_gpu
<
unsigned
char
>
,
knnMatchL1_gpu
<
signed
char
>
,
knnMatchL1_gpu
<
unsigned
short
>
,
...
...
@@ -400,6 +422,10 @@ void cv::gpu::BruteForceMatcher_GPU_base::knnMatch(const GpuMat& queryDescs, con
{
knnMatchL2_gpu
<
unsigned
char
>
,
knnMatchL2_gpu
<
signed
char
>
,
knnMatchL2_gpu
<
unsigned
short
>
,
knnMatchL2_gpu
<
short
>
,
knnMatchL2_gpu
<
int
>
,
knnMatchL2_gpu
<
float
>
,
0
,
0
},
{
knnMatchHamming_gpu
<
unsigned
char
>
,
knnMatchHamming_gpu
<
signed
char
>
,
knnMatchHamming_gpu
<
unsigned
short
>
,
knnMatchHamming_gpu
<
short
>
,
knnMatchHamming_gpu
<
int
>
,
0
,
0
,
0
}
};
...
...
@@ -531,7 +557,7 @@ void cv::gpu::BruteForceMatcher_GPU_base::radiusMatch(const GpuMat& queryDescs,
typedef
void
(
*
radiusMatch_caller_t
)(
const
DevMem2D
&
queryDescs
,
const
DevMem2D
&
trainDescs
,
float
maxDistance
,
const
DevMem2D
&
mask
,
const
DevMem2Di
&
trainIdx
,
unsigned
int
*
nMatches
,
const
DevMem2Df
&
distance
);
static
const
radiusMatch_caller_t
radiusMatch_callers
[
2
][
8
]
=
static
const
radiusMatch_caller_t
radiusMatch_callers
[
3
][
8
]
=
{
{
radiusMatchL1_gpu
<
unsigned
char
>
,
radiusMatchL1_gpu
<
signed
char
>
,
radiusMatchL1_gpu
<
unsigned
short
>
,
...
...
@@ -540,6 +566,10 @@ void cv::gpu::BruteForceMatcher_GPU_base::radiusMatch(const GpuMat& queryDescs,
{
radiusMatchL2_gpu
<
unsigned
char
>
,
radiusMatchL2_gpu
<
signed
char
>
,
radiusMatchL2_gpu
<
unsigned
short
>
,
radiusMatchL2_gpu
<
short
>
,
radiusMatchL2_gpu
<
int
>
,
radiusMatchL2_gpu
<
float
>
,
0
,
0
},
{
radiusMatchHamming_gpu
<
unsigned
char
>
,
radiusMatchHamming_gpu
<
signed
char
>
,
radiusMatchHamming_gpu
<
unsigned
short
>
,
radiusMatchHamming_gpu
<
short
>
,
radiusMatchHamming_gpu
<
int
>
,
0
,
0
,
0
}
};
...
...
modules/gpu/src/cuda/brute_force_matcher.cu
View file @
f11efdce
This diff is collapsed.
Click to expand it.
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