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
a9103606
Commit
a9103606
authored
Mar 01, 2013
by
Vadim Pisarevsky
Committed by
OpenCV Buildbot
Mar 01, 2013
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #586 from bitwangyaoyao:2.4_FixBFMatcher
parents
c865b282
82b98548
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
17 deletions
+19
-17
brute_force_matcher.cpp
modules/ocl/src/brute_force_matcher.cpp
+19
-17
brute_force_match.cl
modules/ocl/src/kernels/brute_force_match.cl
+0
-0
No files found.
modules/ocl/src/brute_force_matcher.cpp
View file @
a9103606
...
...
@@ -51,7 +51,6 @@ using namespace cv;
using
namespace
cv
::
ocl
;
using
namespace
std
;
using
namespace
std
;
namespace
cv
{
namespace
ocl
...
...
@@ -62,7 +61,7 @@ namespace cv
}
template
<
int
BLOCK_SIZE
,
int
MAX_DESC_LEN
,
typename
T
/*, typename Mask*/
>
void
matchUnrolledCached
(
const
oclMat
&
query
,
const
oclMat
&
train
,
const
oclMat
&
mask
,
void
matchUnrolledCached
(
const
oclMat
&
query
,
const
oclMat
&
train
,
const
oclMat
&
/*mask*/
,
const
oclMat
&
trainIdx
,
const
oclMat
&
distance
,
int
distType
)
{
cv
::
ocl
::
Context
*
ctx
=
query
.
clCxt
;
...
...
@@ -77,7 +76,7 @@ void matchUnrolledCached(const oclMat &query, const oclMat &train, const oclMat
{
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
query
.
data
));
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
train
.
data
));
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
mask
.
data
));
//
args.push_back( make_pair( sizeof(cl_mem), (void *)&mask.data ));
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
trainIdx
.
data
));
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
distance
.
data
));
args
.
push_back
(
make_pair
(
smemSize
,
(
void
*
)
NULL
));
...
...
@@ -103,7 +102,7 @@ void matchUnrolledCached(const oclMat /*query*/, const oclMat * /*trains*/, int
}
template
<
int
BLOCK_SIZE
,
typename
T
/*, typename Mask*/
>
void
match
(
const
oclMat
&
query
,
const
oclMat
&
train
,
const
oclMat
&
mask
,
void
match
(
const
oclMat
&
query
,
const
oclMat
&
train
,
const
oclMat
&
/*mask*/
,
const
oclMat
&
trainIdx
,
const
oclMat
&
distance
,
int
distType
)
{
cv
::
ocl
::
Context
*
ctx
=
query
.
clCxt
;
...
...
@@ -117,7 +116,7 @@ void match(const oclMat &query, const oclMat &train, const oclMat &mask,
{
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
query
.
data
));
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
train
.
data
));
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
mask
.
data
));
//
args.push_back( make_pair( sizeof(cl_mem), (void *)&mask.data ));
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
trainIdx
.
data
));
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
distance
.
data
));
args
.
push_back
(
make_pair
(
smemSize
,
(
void
*
)
NULL
));
...
...
@@ -143,7 +142,7 @@ void match(const oclMat /*query*/, const oclMat * /*trains*/, int /*n*/, const o
//radius_matchUnrolledCached
template
<
int
BLOCK_SIZE
,
int
MAX_DESC_LEN
,
typename
T
/*, typename Mask*/
>
void
matchUnrolledCached
(
const
oclMat
&
query
,
const
oclMat
&
train
,
float
maxDistance
,
const
oclMat
&
mask
,
void
matchUnrolledCached
(
const
oclMat
&
query
,
const
oclMat
&
train
,
float
maxDistance
,
const
oclMat
&
/*mask*/
,
const
oclMat
&
trainIdx
,
const
oclMat
&
distance
,
const
oclMat
&
nMatches
,
int
distType
)
{
cv
::
ocl
::
Context
*
ctx
=
query
.
clCxt
;
...
...
@@ -159,7 +158,7 @@ void matchUnrolledCached(const oclMat &query, const oclMat &train, float maxDist
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
query
.
data
));
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
train
.
data
));
args
.
push_back
(
make_pair
(
sizeof
(
cl_float
),
(
void
*
)
&
maxDistance
));
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
mask
.
data
));
//
args.push_back( make_pair( sizeof(cl_mem), (void *)&mask.data ));
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
trainIdx
.
data
));
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
distance
.
data
));
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
nMatches
.
data
));
...
...
@@ -183,7 +182,7 @@ void matchUnrolledCached(const oclMat &query, const oclMat &train, float maxDist
//radius_match
template
<
int
BLOCK_SIZE
,
typename
T
/*, typename Mask*/
>
void
radius_match
(
const
oclMat
&
query
,
const
oclMat
&
train
,
float
maxDistance
,
const
oclMat
&
mask
,
void
radius_match
(
const
oclMat
&
query
,
const
oclMat
&
train
,
float
maxDistance
,
const
oclMat
&
/*mask*/
,
const
oclMat
&
trainIdx
,
const
oclMat
&
distance
,
const
oclMat
&
nMatches
,
int
distType
)
{
cv
::
ocl
::
Context
*
ctx
=
query
.
clCxt
;
...
...
@@ -198,7 +197,7 @@ void radius_match(const oclMat &query, const oclMat &train, float maxDistance, c
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
query
.
data
));
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
train
.
data
));
args
.
push_back
(
make_pair
(
sizeof
(
cl_float
),
(
void
*
)
&
maxDistance
));
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
mask
.
data
));
//
args.push_back( make_pair( sizeof(cl_mem), (void *)&mask.data ));
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
trainIdx
.
data
));
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
distance
.
data
));
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
nMatches
.
data
));
...
...
@@ -472,7 +471,7 @@ void matchDispatcher(const oclMat &query, const oclMat &train, int n, float maxD
//knn match Dispatcher
template
<
int
BLOCK_SIZE
,
int
MAX_DESC_LEN
,
typename
T
/*, typename Mask*/
>
void
knn_matchUnrolledCached
(
const
oclMat
&
query
,
const
oclMat
&
train
,
const
oclMat
&
mask
,
void
knn_matchUnrolledCached
(
const
oclMat
&
query
,
const
oclMat
&
train
,
const
oclMat
&
/*mask*/
,
const
oclMat
&
trainIdx
,
const
oclMat
&
distance
,
int
distType
)
{
cv
::
ocl
::
Context
*
ctx
=
query
.
clCxt
;
...
...
@@ -487,7 +486,7 @@ void knn_matchUnrolledCached(const oclMat &query, const oclMat &train, const ocl
{
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
query
.
data
));
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
train
.
data
));
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
mask
.
data
));
//
args.push_back( make_pair( sizeof(cl_mem), (void *)&mask.data ));
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
trainIdx
.
data
));
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
distance
.
data
));
args
.
push_back
(
make_pair
(
smemSize
,
(
void
*
)
NULL
));
...
...
@@ -507,7 +506,7 @@ void knn_matchUnrolledCached(const oclMat &query, const oclMat &train, const ocl
}
template
<
int
BLOCK_SIZE
,
typename
T
/*, typename Mask*/
>
void
knn_match
(
const
oclMat
&
query
,
const
oclMat
&
train
,
const
oclMat
&
mask
,
void
knn_match
(
const
oclMat
&
query
,
const
oclMat
&
train
,
const
oclMat
&
/*mask*/
,
const
oclMat
&
trainIdx
,
const
oclMat
&
distance
,
int
distType
)
{
cv
::
ocl
::
Context
*
ctx
=
query
.
clCxt
;
...
...
@@ -521,7 +520,7 @@ void knn_match(const oclMat &query, const oclMat &train, const oclMat &mask,
{
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
query
.
data
));
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
train
.
data
));
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
mask
.
data
));
//
args.push_back( make_pair( sizeof(cl_mem), (void *)&mask.data ));
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
trainIdx
.
data
));
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
distance
.
data
));
args
.
push_back
(
make_pair
(
smemSize
,
(
void
*
)
NULL
));
...
...
@@ -540,7 +539,7 @@ void knn_match(const oclMat &query, const oclMat &train, const oclMat &mask,
}
template
<
int
BLOCK_SIZE
,
int
MAX_DESC_LEN
,
typename
T
/*, typename Mask*/
>
void
calcDistanceUnrolled
(
const
oclMat
&
query
,
const
oclMat
&
train
,
const
oclMat
&
mask
,
const
oclMat
&
allDist
,
int
distType
)
void
calcDistanceUnrolled
(
const
oclMat
&
query
,
const
oclMat
&
train
,
const
oclMat
&
/*mask*/
,
const
oclMat
&
allDist
,
int
distType
)
{
cv
::
ocl
::
Context
*
ctx
=
query
.
clCxt
;
size_t
globalSize
[]
=
{(
query
.
rows
+
BLOCK_SIZE
-
1
)
/
BLOCK_SIZE
*
BLOCK_SIZE
,
BLOCK_SIZE
,
1
};
...
...
@@ -554,7 +553,7 @@ void calcDistanceUnrolled(const oclMat &query, const oclMat &train, const oclMat
{
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
query
.
data
));
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
train
.
data
));
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
mask
.
data
));
//
args.push_back( make_pair( sizeof(cl_mem), (void *)&mask.data ));
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
allDist
.
data
));
args
.
push_back
(
make_pair
(
smemSize
,
(
void
*
)
NULL
));
args
.
push_back
(
make_pair
(
sizeof
(
cl_int
),
(
void
*
)
&
block_size
));
...
...
@@ -573,7 +572,7 @@ void calcDistanceUnrolled(const oclMat &query, const oclMat &train, const oclMat
}
template
<
int
BLOCK_SIZE
,
typename
T
/*, typename Mask*/
>
void
calcDistance
(
const
oclMat
&
query
,
const
oclMat
&
train
,
const
oclMat
&
mask
,
const
oclMat
&
allDist
,
int
distType
)
void
calcDistance
(
const
oclMat
&
query
,
const
oclMat
&
train
,
const
oclMat
&
/*mask*/
,
const
oclMat
&
allDist
,
int
distType
)
{
cv
::
ocl
::
Context
*
ctx
=
query
.
clCxt
;
size_t
globalSize
[]
=
{(
query
.
rows
+
BLOCK_SIZE
-
1
)
/
BLOCK_SIZE
*
BLOCK_SIZE
,
BLOCK_SIZE
,
1
};
...
...
@@ -586,7 +585,7 @@ void calcDistance(const oclMat &query, const oclMat &train, const oclMat &mask,
{
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
query
.
data
));
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
train
.
data
));
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
mask
.
data
));
//
args.push_back( make_pair( sizeof(cl_mem), (void *)&mask.data ));
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
allDist
.
data
));
args
.
push_back
(
make_pair
(
smemSize
,
(
void
*
)
NULL
));
args
.
push_back
(
make_pair
(
sizeof
(
cl_int
),
(
void
*
)
&
block_size
));
...
...
@@ -1007,6 +1006,7 @@ void cv::ocl::BruteForceMatcher_OCL_base::matchConvert(const Mat &trainIdx, cons
void
cv
::
ocl
::
BruteForceMatcher_OCL_base
::
match
(
const
oclMat
&
query
,
const
oclMat
&
train
,
vector
<
DMatch
>
&
matches
,
const
oclMat
&
mask
)
{
assert
(
mask
.
empty
());
// mask is not supported at the moment
oclMat
trainIdx
,
distance
;
matchSingle
(
query
,
train
,
trainIdx
,
distance
,
mask
);
matchDownload
(
trainIdx
,
distance
,
matches
);
...
...
@@ -1697,3 +1697,5 @@ void cv::ocl::BruteForceMatcher_OCL_base::radiusMatch(const oclMat &query, vecto
radiusMatchCollection
(
query
,
trainIdx
,
imgIdx
,
distance
,
nMatches
,
maxDistance
,
masks
);
radiusMatchDownload
(
trainIdx
,
imgIdx
,
distance
,
nMatches
,
matches
,
compactResult
);
}
modules/ocl/src/kernels/brute_force_match.cl
View file @
a9103606
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