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
7d904146
Commit
7d904146
authored
May 15, 2013
by
Vadim Pisarevsky
Committed by
OpenCV Buildbot
May 15, 2013
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #885 from pengx17:2.4_bfmatcher_ocl
parents
4d866ea3
d053f216
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
372 deletions
+5
-372
ocl.hpp
modules/ocl/include/opencv2/ocl/ocl.hpp
+5
-372
No files found.
modules/ocl/include/opencv2/ocl/ocl.hpp
View file @
7d904146
...
@@ -866,7 +866,6 @@ namespace cv
...
@@ -866,7 +866,6 @@ namespace cv
std
::
vector
<
oclMat
>
image_sqsums
;
std
::
vector
<
oclMat
>
image_sqsums
;
};
};
//! computes the proximity map for the raster template and the image where the template is searched for
//! computes the proximity map for the raster template and the image where the template is searched for
// Supports TM_SQDIFF, TM_SQDIFF_NORMED, TM_CCORR, TM_CCORR_NORMED, TM_CCOEFF, TM_CCOEFF_NORMED for type 8UC1 and 8UC4
// Supports TM_SQDIFF, TM_SQDIFF_NORMED, TM_CCORR, TM_CCORR_NORMED, TM_CCOEFF, TM_CCOEFF_NORMED for type 8UC1 and 8UC4
// Supports TM_SQDIFF, TM_CCORR for type 32FC1 and 32FC4
// Supports TM_SQDIFF, TM_CCORR for type 32FC1 and 32FC4
...
@@ -877,71 +876,36 @@ namespace cv
...
@@ -877,71 +876,36 @@ namespace cv
// Supports TM_SQDIFF, TM_CCORR for type 32FC1 and 32FC4
// Supports TM_SQDIFF, TM_CCORR for type 32FC1 and 32FC4
CV_EXPORTS
void
matchTemplate
(
const
oclMat
&
image
,
const
oclMat
&
templ
,
oclMat
&
result
,
int
method
,
MatchTemplateBuf
&
buf
);
CV_EXPORTS
void
matchTemplate
(
const
oclMat
&
image
,
const
oclMat
&
templ
,
oclMat
&
result
,
int
method
,
MatchTemplateBuf
&
buf
);
///////////////////////////////////////////// Canny /////////////////////////////////////////////
///////////////////////////////////////////// Canny /////////////////////////////////////////////
struct
CV_EXPORTS
CannyBuf
;
struct
CV_EXPORTS
CannyBuf
;
//! compute edges of the input image using Canny operator
//! compute edges of the input image using Canny operator
// Support CV_8UC1 only
// Support CV_8UC1 only
CV_EXPORTS
void
Canny
(
const
oclMat
&
image
,
oclMat
&
edges
,
double
low_thresh
,
double
high_thresh
,
int
apperture_size
=
3
,
bool
L2gradient
=
false
);
CV_EXPORTS
void
Canny
(
const
oclMat
&
image
,
oclMat
&
edges
,
double
low_thresh
,
double
high_thresh
,
int
apperture_size
=
3
,
bool
L2gradient
=
false
);
CV_EXPORTS
void
Canny
(
const
oclMat
&
image
,
CannyBuf
&
buf
,
oclMat
&
edges
,
double
low_thresh
,
double
high_thresh
,
int
apperture_size
=
3
,
bool
L2gradient
=
false
);
CV_EXPORTS
void
Canny
(
const
oclMat
&
image
,
CannyBuf
&
buf
,
oclMat
&
edges
,
double
low_thresh
,
double
high_thresh
,
int
apperture_size
=
3
,
bool
L2gradient
=
false
);
CV_EXPORTS
void
Canny
(
const
oclMat
&
dx
,
const
oclMat
&
dy
,
oclMat
&
edges
,
double
low_thresh
,
double
high_thresh
,
bool
L2gradient
=
false
);
CV_EXPORTS
void
Canny
(
const
oclMat
&
dx
,
const
oclMat
&
dy
,
oclMat
&
edges
,
double
low_thresh
,
double
high_thresh
,
bool
L2gradient
=
false
);
CV_EXPORTS
void
Canny
(
const
oclMat
&
dx
,
const
oclMat
&
dy
,
CannyBuf
&
buf
,
oclMat
&
edges
,
double
low_thresh
,
double
high_thresh
,
bool
L2gradient
=
false
);
CV_EXPORTS
void
Canny
(
const
oclMat
&
dx
,
const
oclMat
&
dy
,
CannyBuf
&
buf
,
oclMat
&
edges
,
double
low_thresh
,
double
high_thresh
,
bool
L2gradient
=
false
);
struct
CV_EXPORTS
CannyBuf
struct
CV_EXPORTS
CannyBuf
{
{
CannyBuf
()
:
counter
(
NULL
)
{}
CannyBuf
()
:
counter
(
NULL
)
{}
~
CannyBuf
()
~
CannyBuf
()
{
{
release
();
release
();
}
}
explicit
CannyBuf
(
const
Size
&
image_size
,
int
apperture_size
=
3
)
:
counter
(
NULL
)
explicit
CannyBuf
(
const
Size
&
image_size
,
int
apperture_size
=
3
)
:
counter
(
NULL
)
{
{
create
(
image_size
,
apperture_size
);
create
(
image_size
,
apperture_size
);
}
}
CannyBuf
(
const
oclMat
&
dx_
,
const
oclMat
&
dy_
);
CannyBuf
(
const
oclMat
&
dx_
,
const
oclMat
&
dy_
);
void
create
(
const
Size
&
image_size
,
int
apperture_size
=
3
);
void
create
(
const
Size
&
image_size
,
int
apperture_size
=
3
);
void
release
();
void
release
();
oclMat
dx
,
dy
;
oclMat
dx
,
dy
;
oclMat
dx_buf
,
dy_buf
;
oclMat
dx_buf
,
dy_buf
;
oclMat
edgeBuf
;
oclMat
edgeBuf
;
oclMat
trackBuf1
,
trackBuf2
;
oclMat
trackBuf1
,
trackBuf2
;
void
*
counter
;
void
*
counter
;
Ptr
<
FilterEngine_GPU
>
filterDX
,
filterDY
;
Ptr
<
FilterEngine_GPU
>
filterDX
,
filterDY
;
};
};
///////////////////////////////////////// clAmdFft related /////////////////////////////////////////
///////////////////////////////////////// clAmdFft related /////////////////////////////////////////
...
@@ -966,159 +930,69 @@ namespace cv
...
@@ -966,159 +930,69 @@ namespace cv
const
oclMat
&
src3
,
double
beta
,
oclMat
&
dst
,
int
flags
=
0
);
const
oclMat
&
src3
,
double
beta
,
oclMat
&
dst
,
int
flags
=
0
);
//////////////// HOG (Histogram-of-Oriented-Gradients) Descriptor and Object Detector //////////////
//////////////// HOG (Histogram-of-Oriented-Gradients) Descriptor and Object Detector //////////////
struct
CV_EXPORTS
HOGDescriptor
struct
CV_EXPORTS
HOGDescriptor
{
{
enum
{
DEFAULT_WIN_SIGMA
=
-
1
};
enum
{
DEFAULT_WIN_SIGMA
=
-
1
};
enum
{
DEFAULT_NLEVELS
=
64
};
enum
{
DEFAULT_NLEVELS
=
64
};
enum
{
DESCR_FORMAT_ROW_BY_ROW
,
DESCR_FORMAT_COL_BY_COL
};
enum
{
DESCR_FORMAT_ROW_BY_ROW
,
DESCR_FORMAT_COL_BY_COL
};
HOGDescriptor
(
Size
win_size
=
Size
(
64
,
128
),
Size
block_size
=
Size
(
16
,
16
),
HOGDescriptor
(
Size
win_size
=
Size
(
64
,
128
),
Size
block_size
=
Size
(
16
,
16
),
Size
block_stride
=
Size
(
8
,
8
),
Size
cell_size
=
Size
(
8
,
8
),
Size
block_stride
=
Size
(
8
,
8
),
Size
cell_size
=
Size
(
8
,
8
),
int
nbins
=
9
,
double
win_sigma
=
DEFAULT_WIN_SIGMA
,
int
nbins
=
9
,
double
win_sigma
=
DEFAULT_WIN_SIGMA
,
double
threshold_L2hys
=
0.2
,
bool
gamma_correction
=
true
,
double
threshold_L2hys
=
0.2
,
bool
gamma_correction
=
true
,
int
nlevels
=
DEFAULT_NLEVELS
);
int
nlevels
=
DEFAULT_NLEVELS
);
size_t
getDescriptorSize
()
const
;
size_t
getDescriptorSize
()
const
;
size_t
getBlockHistogramSize
()
const
;
size_t
getBlockHistogramSize
()
const
;
void
setSVMDetector
(
const
vector
<
float
>
&
detector
);
void
setSVMDetector
(
const
vector
<
float
>
&
detector
);
static
vector
<
float
>
getDefaultPeopleDetector
();
static
vector
<
float
>
getDefaultPeopleDetector
();
static
vector
<
float
>
getPeopleDetector48x96
();
static
vector
<
float
>
getPeopleDetector48x96
();
static
vector
<
float
>
getPeopleDetector64x128
();
static
vector
<
float
>
getPeopleDetector64x128
();
void
detect
(
const
oclMat
&
img
,
vector
<
Point
>
&
found_locations
,
void
detect
(
const
oclMat
&
img
,
vector
<
Point
>
&
found_locations
,
double
hit_threshold
=
0
,
Size
win_stride
=
Size
(),
double
hit_threshold
=
0
,
Size
win_stride
=
Size
(),
Size
padding
=
Size
());
Size
padding
=
Size
());
void
detectMultiScale
(
const
oclMat
&
img
,
vector
<
Rect
>
&
found_locations
,
void
detectMultiScale
(
const
oclMat
&
img
,
vector
<
Rect
>
&
found_locations
,
double
hit_threshold
=
0
,
Size
win_stride
=
Size
(),
double
hit_threshold
=
0
,
Size
win_stride
=
Size
(),
Size
padding
=
Size
(),
double
scale0
=
1.05
,
Size
padding
=
Size
(),
double
scale0
=
1.05
,
int
group_threshold
=
2
);
int
group_threshold
=
2
);
void
getDescriptors
(
const
oclMat
&
img
,
Size
win_stride
,
void
getDescriptors
(
const
oclMat
&
img
,
Size
win_stride
,
oclMat
&
descriptors
,
oclMat
&
descriptors
,
int
descr_format
=
DESCR_FORMAT_COL_BY_COL
);
int
descr_format
=
DESCR_FORMAT_COL_BY_COL
);
Size
win_size
;
Size
win_size
;
Size
block_size
;
Size
block_size
;
Size
block_stride
;
Size
block_stride
;
Size
cell_size
;
Size
cell_size
;
int
nbins
;
int
nbins
;
double
win_sigma
;
double
win_sigma
;
double
threshold_L2hys
;
double
threshold_L2hys
;
bool
gamma_correction
;
bool
gamma_correction
;
int
nlevels
;
int
nlevels
;
protected
:
protected
:
// initialize buffers; only need to do once in case of multiscale detection
// initialize buffers; only need to do once in case of multiscale detection
void
init_buffer
(
const
oclMat
&
img
,
Size
win_stride
);
void
init_buffer
(
const
oclMat
&
img
,
Size
win_stride
);
void
computeBlockHistograms
(
const
oclMat
&
img
);
void
computeBlockHistograms
(
const
oclMat
&
img
);
void
computeGradient
(
const
oclMat
&
img
,
oclMat
&
grad
,
oclMat
&
qangle
);
void
computeGradient
(
const
oclMat
&
img
,
oclMat
&
grad
,
oclMat
&
qangle
);
double
getWinSigma
()
const
;
double
getWinSigma
()
const
;
bool
checkDetectorSize
()
const
;
bool
checkDetectorSize
()
const
;
static
int
numPartsWithin
(
int
size
,
int
part_size
,
int
stride
);
static
int
numPartsWithin
(
int
size
,
int
part_size
,
int
stride
);
static
Size
numPartsWithin
(
Size
size
,
Size
part_size
,
Size
stride
);
static
Size
numPartsWithin
(
Size
size
,
Size
part_size
,
Size
stride
);
// Coefficients of the separating plane
// Coefficients of the separating plane
float
free_coef
;
float
free_coef
;
oclMat
detector
;
oclMat
detector
;
// Results of the last classification step
// Results of the last classification step
oclMat
labels
;
oclMat
labels
;
Mat
labels_host
;
Mat
labels_host
;
// Results of the last histogram evaluation step
// Results of the last histogram evaluation step
oclMat
block_hists
;
oclMat
block_hists
;
// Gradients conputation results
// Gradients conputation results
oclMat
grad
,
qangle
;
oclMat
grad
,
qangle
;
// scaled image
// scaled image
oclMat
image_scale
;
oclMat
image_scale
;
// effect size of input image (might be different from original size after scaling)
// effect size of input image (might be different from original size after scaling)
Size
effect_size
;
Size
effect_size
;
};
};
...
@@ -1126,13 +1000,11 @@ namespace cv
...
@@ -1126,13 +1000,11 @@ namespace cv
/****************************************************************************************\
/****************************************************************************************\
* Distance *
* Distance *
\****************************************************************************************/
\****************************************************************************************/
template
<
typename
T
>
template
<
typename
T
>
struct
CV_EXPORTS
Accumulator
struct
CV_EXPORTS
Accumulator
{
{
typedef
T
Type
;
typedef
T
Type
;
};
};
template
<>
struct
Accumulator
<
unsigned
char
>
template
<>
struct
Accumulator
<
unsigned
char
>
{
{
typedef
float
Type
;
typedef
float
Type
;
...
@@ -1206,469 +1078,230 @@ namespace cv
...
@@ -1206,469 +1078,230 @@ namespace cv
{
{
public
:
public
:
enum
DistType
{
L1Dist
=
0
,
L2Dist
,
HammingDist
};
enum
DistType
{
L1Dist
=
0
,
L2Dist
,
HammingDist
};
explicit
BruteForceMatcher_OCL_base
(
DistType
distType
=
L2Dist
);
explicit
BruteForceMatcher_OCL_base
(
DistType
distType
=
L2Dist
);
// Add descriptors to train descriptor collection
// Add descriptors to train descriptor collection
void
add
(
const
std
::
vector
<
oclMat
>
&
descCollection
);
void
add
(
const
std
::
vector
<
oclMat
>
&
descCollection
);
// Get train descriptors collection
// Get train descriptors collection
const
std
::
vector
<
oclMat
>
&
getTrainDescriptors
()
const
;
const
std
::
vector
<
oclMat
>
&
getTrainDescriptors
()
const
;
// Clear train descriptors collection
// Clear train descriptors collection
void
clear
();
void
clear
();
// Return true if there are not train descriptors in collection
// Return true if there are not train descriptors in collection
bool
empty
()
const
;
bool
empty
()
const
;
// Return true if the matcher supports mask in match methods
// Return true if the matcher supports mask in match methods
bool
isMaskSupported
()
const
;
bool
isMaskSupported
()
const
;
// Find one best match for each query descriptor
// Find one best match for each query descriptor
void
matchSingle
(
const
oclMat
&
query
,
const
oclMat
&
train
,
void
matchSingle
(
const
oclMat
&
query
,
const
oclMat
&
train
,
oclMat
&
trainIdx
,
oclMat
&
distance
,
oclMat
&
trainIdx
,
oclMat
&
distance
,
const
oclMat
&
mask
=
oclMat
());
const
oclMat
&
mask
=
oclMat
());
// Download trainIdx and distance and convert it to CPU vector with DMatch
// Download trainIdx and distance and convert it to CPU vector with DMatch
static
void
matchDownload
(
const
oclMat
&
trainIdx
,
const
oclMat
&
distance
,
std
::
vector
<
DMatch
>
&
matches
);
static
void
matchDownload
(
const
oclMat
&
trainIdx
,
const
oclMat
&
distance
,
std
::
vector
<
DMatch
>
&
matches
);
// Convert trainIdx and distance to vector with DMatch
// Convert trainIdx and distance to vector with DMatch
static
void
matchConvert
(
const
Mat
&
trainIdx
,
const
Mat
&
distance
,
std
::
vector
<
DMatch
>
&
matches
);
static
void
matchConvert
(
const
Mat
&
trainIdx
,
const
Mat
&
distance
,
std
::
vector
<
DMatch
>
&
matches
);
// Find one best match for each query descriptor
// Find one best match for each query descriptor
void
match
(
const
oclMat
&
query
,
const
oclMat
&
train
,
std
::
vector
<
DMatch
>
&
matches
,
const
oclMat
&
mask
=
oclMat
());
void
match
(
const
oclMat
&
query
,
const
oclMat
&
train
,
std
::
vector
<
DMatch
>
&
matches
,
const
oclMat
&
mask
=
oclMat
());
// Make gpu collection of trains and masks in suitable format for matchCollection function
// Make gpu collection of trains and masks in suitable format for matchCollection function
void
makeGpuCollection
(
oclMat
&
trainCollection
,
oclMat
&
maskCollection
,
const
std
::
vector
<
oclMat
>
&
masks
=
std
::
vector
<
oclMat
>
());
void
makeGpuCollection
(
oclMat
&
trainCollection
,
oclMat
&
maskCollection
,
const
std
::
vector
<
oclMat
>
&
masks
=
std
::
vector
<
oclMat
>
());
// Find one best match from train collection for each query descriptor
// Find one best match from train collection for each query descriptor
void
matchCollection
(
const
oclMat
&
query
,
const
oclMat
&
trainCollection
,
void
matchCollection
(
const
oclMat
&
query
,
const
oclMat
&
trainCollection
,
oclMat
&
trainIdx
,
oclMat
&
imgIdx
,
oclMat
&
distance
,
oclMat
&
trainIdx
,
oclMat
&
imgIdx
,
oclMat
&
distance
,
const
oclMat
&
masks
=
oclMat
());
const
oclMat
&
masks
=
oclMat
());
// Download trainIdx, imgIdx and distance and convert it to vector with DMatch
// Download trainIdx, imgIdx and distance and convert it to vector with DMatch
static
void
matchDownload
(
const
oclMat
&
trainIdx
,
const
oclMat
&
imgIdx
,
const
oclMat
&
distance
,
std
::
vector
<
DMatch
>
&
matches
);
static
void
matchDownload
(
const
oclMat
&
trainIdx
,
const
oclMat
&
imgIdx
,
const
oclMat
&
distance
,
std
::
vector
<
DMatch
>
&
matches
);
// Convert trainIdx, imgIdx and distance to vector with DMatch
// Convert trainIdx, imgIdx and distance to vector with DMatch
static
void
matchConvert
(
const
Mat
&
trainIdx
,
const
Mat
&
imgIdx
,
const
Mat
&
distance
,
std
::
vector
<
DMatch
>
&
matches
);
static
void
matchConvert
(
const
Mat
&
trainIdx
,
const
Mat
&
imgIdx
,
const
Mat
&
distance
,
std
::
vector
<
DMatch
>
&
matches
);
// Find one best match from train collection for each query descriptor.
// Find one best match from train collection for each query descriptor.
void
match
(
const
oclMat
&
query
,
std
::
vector
<
DMatch
>
&
matches
,
const
std
::
vector
<
oclMat
>
&
masks
=
std
::
vector
<
oclMat
>
());
void
match
(
const
oclMat
&
query
,
std
::
vector
<
DMatch
>
&
matches
,
const
std
::
vector
<
oclMat
>
&
masks
=
std
::
vector
<
oclMat
>
());
// Find k best matches for each query descriptor (in increasing order of distances)
// Find k best matches for each query descriptor (in increasing order of distances)
void
knnMatchSingle
(
const
oclMat
&
query
,
const
oclMat
&
train
,
void
knnMatchSingle
(
const
oclMat
&
query
,
const
oclMat
&
train
,
oclMat
&
trainIdx
,
oclMat
&
distance
,
oclMat
&
allDist
,
int
k
,
oclMat
&
trainIdx
,
oclMat
&
distance
,
oclMat
&
allDist
,
int
k
,
const
oclMat
&
mask
=
oclMat
());
const
oclMat
&
mask
=
oclMat
());
// Download trainIdx and distance and convert it to vector with DMatch
// Download trainIdx and distance and convert it to vector with DMatch
// compactResult is used when mask is not empty. If compactResult is false matches
// compactResult is used when mask is not empty. If compactResult is false matches
// vector will have the same size as queryDescriptors rows. If compactResult is true
// vector will have the same size as queryDescriptors rows. If compactResult is true
// matches vector will not contain matches for fully masked out query descriptors.
// matches vector will not contain matches for fully masked out query descriptors.
static
void
knnMatchDownload
(
const
oclMat
&
trainIdx
,
const
oclMat
&
distance
,
static
void
knnMatchDownload
(
const
oclMat
&
trainIdx
,
const
oclMat
&
distance
,
std
::
vector
<
std
::
vector
<
DMatch
>
>
&
matches
,
bool
compactResult
=
false
);
std
::
vector
<
std
::
vector
<
DMatch
>
>
&
matches
,
bool
compactResult
=
false
);
// Convert trainIdx and distance to vector with DMatch
// Convert trainIdx and distance to vector with DMatch
static
void
knnMatchConvert
(
const
Mat
&
trainIdx
,
const
Mat
&
distance
,
static
void
knnMatchConvert
(
const
Mat
&
trainIdx
,
const
Mat
&
distance
,
std
::
vector
<
std
::
vector
<
DMatch
>
>
&
matches
,
bool
compactResult
=
false
);
std
::
vector
<
std
::
vector
<
DMatch
>
>
&
matches
,
bool
compactResult
=
false
);
// Find k best matches for each query descriptor (in increasing order of distances).
// Find k best matches for each query descriptor (in increasing order of distances).
// compactResult is used when mask is not empty. If compactResult is false matches
// compactResult is used when mask is not empty. If compactResult is false matches
// vector will have the same size as queryDescriptors rows. If compactResult is true
// vector will have the same size as queryDescriptors rows. If compactResult is true
// matches vector will not contain matches for fully masked out query descriptors.
// matches vector will not contain matches for fully masked out query descriptors.
void
knnMatch
(
const
oclMat
&
query
,
const
oclMat
&
train
,
void
knnMatch
(
const
oclMat
&
query
,
const
oclMat
&
train
,
std
::
vector
<
std
::
vector
<
DMatch
>
>
&
matches
,
int
k
,
const
oclMat
&
mask
=
oclMat
(),
std
::
vector
<
std
::
vector
<
DMatch
>
>
&
matches
,
int
k
,
const
oclMat
&
mask
=
oclMat
(),
bool
compactResult
=
false
);
bool
compactResult
=
false
);
// Find k best matches from train collection for each query descriptor (in increasing order of distances)
// Find k best matches from train collection for each query descriptor (in increasing order of distances)
void
knnMatch2Collection
(
const
oclMat
&
query
,
const
oclMat
&
trainCollection
,
void
knnMatch2Collection
(
const
oclMat
&
query
,
const
oclMat
&
trainCollection
,
oclMat
&
trainIdx
,
oclMat
&
imgIdx
,
oclMat
&
distance
,
oclMat
&
trainIdx
,
oclMat
&
imgIdx
,
oclMat
&
distance
,
const
oclMat
&
maskCollection
=
oclMat
());
const
oclMat
&
maskCollection
=
oclMat
());
// Download trainIdx and distance and convert it to vector with DMatch
// Download trainIdx and distance and convert it to vector with DMatch
// compactResult is used when mask is not empty. If compactResult is false matches
// compactResult is used when mask is not empty. If compactResult is false matches
// vector will have the same size as queryDescriptors rows. If compactResult is true
// vector will have the same size as queryDescriptors rows. If compactResult is true
// matches vector will not contain matches for fully masked out query descriptors.
// matches vector will not contain matches for fully masked out query descriptors.
static
void
knnMatch2Download
(
const
oclMat
&
trainIdx
,
const
oclMat
&
imgIdx
,
const
oclMat
&
distance
,
static
void
knnMatch2Download
(
const
oclMat
&
trainIdx
,
const
oclMat
&
imgIdx
,
const
oclMat
&
distance
,
std
::
vector
<
std
::
vector
<
DMatch
>
>
&
matches
,
bool
compactResult
=
false
);
std
::
vector
<
std
::
vector
<
DMatch
>
>
&
matches
,
bool
compactResult
=
false
);
// Convert trainIdx and distance to vector with DMatch
// Convert trainIdx and distance to vector with DMatch
static
void
knnMatch2Convert
(
const
Mat
&
trainIdx
,
const
Mat
&
imgIdx
,
const
Mat
&
distance
,
static
void
knnMatch2Convert
(
const
Mat
&
trainIdx
,
const
Mat
&
imgIdx
,
const
Mat
&
distance
,
std
::
vector
<
std
::
vector
<
DMatch
>
>
&
matches
,
bool
compactResult
=
false
);
std
::
vector
<
std
::
vector
<
DMatch
>
>
&
matches
,
bool
compactResult
=
false
);
// Find k best matches for each query descriptor (in increasing order of distances).
// Find k best matches for each query descriptor (in increasing order of distances).
// compactResult is used when mask is not empty. If compactResult is false matches
// compactResult is used when mask is not empty. If compactResult is false matches
// vector will have the same size as queryDescriptors rows. If compactResult is true
// vector will have the same size as queryDescriptors rows. If compactResult is true
// matches vector will not contain matches for fully masked out query descriptors.
// matches vector will not contain matches for fully masked out query descriptors.
void
knnMatch
(
const
oclMat
&
query
,
std
::
vector
<
std
::
vector
<
DMatch
>
>
&
matches
,
int
k
,
void
knnMatch
(
const
oclMat
&
query
,
std
::
vector
<
std
::
vector
<
DMatch
>
>
&
matches
,
int
k
,
const
std
::
vector
<
oclMat
>
&
masks
=
std
::
vector
<
oclMat
>
(),
bool
compactResult
=
false
);
const
std
::
vector
<
oclMat
>
&
masks
=
std
::
vector
<
oclMat
>
(),
bool
compactResult
=
false
);
// Find best matches for each query descriptor which have distance less than maxDistance.
// Find best matches for each query descriptor which have distance less than maxDistance.
// nMatches.at<int>(0, queryIdx) will contain matches count for queryIdx.
// nMatches.at<int>(0, queryIdx) will contain matches count for queryIdx.
// carefully nMatches can be greater than trainIdx.cols - it means that matcher didn't find all matches,
// carefully nMatches can be greater than trainIdx.cols - it means that matcher didn't find all matches,
// because it didn't have enough memory.
// because it didn't have enough memory.
// If trainIdx is empty, then trainIdx and distance will be created with size nQuery x max((nTrain / 100), 10),
// If trainIdx is empty, then trainIdx and distance will be created with size nQuery x max((nTrain / 100), 10),
// otherwize user can pass own allocated trainIdx and distance with size nQuery x nMaxMatches
// otherwize user can pass own allocated trainIdx and distance with size nQuery x nMaxMatches
// Matches doesn't sorted.
// Matches doesn't sorted.
void
radiusMatchSingle
(
const
oclMat
&
query
,
const
oclMat
&
train
,
void
radiusMatchSingle
(
const
oclMat
&
query
,
const
oclMat
&
train
,
oclMat
&
trainIdx
,
oclMat
&
distance
,
oclMat
&
nMatches
,
float
maxDistance
,
oclMat
&
trainIdx
,
oclMat
&
distance
,
oclMat
&
nMatches
,
float
maxDistance
,
const
oclMat
&
mask
=
oclMat
());
const
oclMat
&
mask
=
oclMat
());
// Download trainIdx, nMatches and distance and convert it to vector with DMatch.
// Download trainIdx, nMatches and distance and convert it to vector with DMatch.
// matches will be sorted in increasing order of distances.
// matches will be sorted in increasing order of distances.
// compactResult is used when mask is not empty. If compactResult is false matches
// compactResult is used when mask is not empty. If compactResult is false matches
// vector will have the same size as queryDescriptors rows. If compactResult is true
// vector will have the same size as queryDescriptors rows. If compactResult is true
// matches vector will not contain matches for fully masked out query descriptors.
// matches vector will not contain matches for fully masked out query descriptors.
static
void
radiusMatchDownload
(
const
oclMat
&
trainIdx
,
const
oclMat
&
distance
,
const
oclMat
&
nMatches
,
static
void
radiusMatchDownload
(
const
oclMat
&
trainIdx
,
const
oclMat
&
distance
,
const
oclMat
&
nMatches
,
std
::
vector
<
std
::
vector
<
DMatch
>
>
&
matches
,
bool
compactResult
=
false
);
std
::
vector
<
std
::
vector
<
DMatch
>
>
&
matches
,
bool
compactResult
=
false
);
// Convert trainIdx, nMatches and distance to vector with DMatch.
// Convert trainIdx, nMatches and distance to vector with DMatch.
static
void
radiusMatchConvert
(
const
Mat
&
trainIdx
,
const
Mat
&
distance
,
const
Mat
&
nMatches
,
static
void
radiusMatchConvert
(
const
Mat
&
trainIdx
,
const
Mat
&
distance
,
const
Mat
&
nMatches
,
std
::
vector
<
std
::
vector
<
DMatch
>
>
&
matches
,
bool
compactResult
=
false
);
std
::
vector
<
std
::
vector
<
DMatch
>
>
&
matches
,
bool
compactResult
=
false
);
// Find best matches for each query descriptor which have distance less than maxDistance
// Find best matches for each query descriptor which have distance less than maxDistance
// in increasing order of distances).
// in increasing order of distances).
void
radiusMatch
(
const
oclMat
&
query
,
const
oclMat
&
train
,
void
radiusMatch
(
const
oclMat
&
query
,
const
oclMat
&
train
,
std
::
vector
<
std
::
vector
<
DMatch
>
>
&
matches
,
float
maxDistance
,
std
::
vector
<
std
::
vector
<
DMatch
>
>
&
matches
,
float
maxDistance
,
const
oclMat
&
mask
=
oclMat
(),
bool
compactResult
=
false
);
const
oclMat
&
mask
=
oclMat
(),
bool
compactResult
=
false
);
// Find best matches for each query descriptor which have distance less than maxDistance.
// Find best matches for each query descriptor which have distance less than maxDistance.
// If trainIdx is empty, then trainIdx and distance will be created with size nQuery x max((nQuery / 100), 10),
// If trainIdx is empty, then trainIdx and distance will be created with size nQuery x max((nQuery / 100), 10),
// otherwize user can pass own allocated trainIdx and distance with size nQuery x nMaxMatches
// otherwize user can pass own allocated trainIdx and distance with size nQuery x nMaxMatches
// Matches doesn't sorted.
// Matches doesn't sorted.
void
radiusMatchCollection
(
const
oclMat
&
query
,
oclMat
&
trainIdx
,
oclMat
&
imgIdx
,
oclMat
&
distance
,
oclMat
&
nMatches
,
float
maxDistance
,
void
radiusMatchCollection
(
const
oclMat
&
query
,
oclMat
&
trainIdx
,
oclMat
&
imgIdx
,
oclMat
&
distance
,
oclMat
&
nMatches
,
float
maxDistance
,
const
std
::
vector
<
oclMat
>
&
masks
=
std
::
vector
<
oclMat
>
());
const
std
::
vector
<
oclMat
>
&
masks
=
std
::
vector
<
oclMat
>
());
// Download trainIdx, imgIdx, nMatches and distance and convert it to vector with DMatch.
// Download trainIdx, imgIdx, nMatches and distance and convert it to vector with DMatch.
// matches will be sorted in increasing order of distances.
// matches will be sorted in increasing order of distances.
// compactResult is used when mask is not empty. If compactResult is false matches
// compactResult is used when mask is not empty. If compactResult is false matches
// vector will have the same size as queryDescriptors rows. If compactResult is true
// vector will have the same size as queryDescriptors rows. If compactResult is true
// matches vector will not contain matches for fully masked out query descriptors.
// matches vector will not contain matches for fully masked out query descriptors.
static
void
radiusMatchDownload
(
const
oclMat
&
trainIdx
,
const
oclMat
&
imgIdx
,
const
oclMat
&
distance
,
const
oclMat
&
nMatches
,
static
void
radiusMatchDownload
(
const
oclMat
&
trainIdx
,
const
oclMat
&
imgIdx
,
const
oclMat
&
distance
,
const
oclMat
&
nMatches
,
std
::
vector
<
std
::
vector
<
DMatch
>
>
&
matches
,
bool
compactResult
=
false
);
std
::
vector
<
std
::
vector
<
DMatch
>
>
&
matches
,
bool
compactResult
=
false
);
// Convert trainIdx, nMatches and distance to vector with DMatch.
// Convert trainIdx, nMatches and distance to vector with DMatch.
static
void
radiusMatchConvert
(
const
Mat
&
trainIdx
,
const
Mat
&
imgIdx
,
const
Mat
&
distance
,
const
Mat
&
nMatches
,
static
void
radiusMatchConvert
(
const
Mat
&
trainIdx
,
const
Mat
&
imgIdx
,
const
Mat
&
distance
,
const
Mat
&
nMatches
,
std
::
vector
<
std
::
vector
<
DMatch
>
>
&
matches
,
bool
compactResult
=
false
);
std
::
vector
<
std
::
vector
<
DMatch
>
>
&
matches
,
bool
compactResult
=
false
);
// Find best matches from train collection for each query descriptor which have distance less than
// Find best matches from train collection for each query descriptor which have distance less than
// maxDistance (in increasing order of distances).
// maxDistance (in increasing order of distances).
void
radiusMatch
(
const
oclMat
&
query
,
std
::
vector
<
std
::
vector
<
DMatch
>
>
&
matches
,
float
maxDistance
,
void
radiusMatch
(
const
oclMat
&
query
,
std
::
vector
<
std
::
vector
<
DMatch
>
>
&
matches
,
float
maxDistance
,
const
std
::
vector
<
oclMat
>
&
masks
=
std
::
vector
<
oclMat
>
(),
bool
compactResult
=
false
);
const
std
::
vector
<
oclMat
>
&
masks
=
std
::
vector
<
oclMat
>
(),
bool
compactResult
=
false
);
DistType
distType
;
DistType
distType
;
private
:
private
:
std
::
vector
<
oclMat
>
trainDescCollection
;
std
::
vector
<
oclMat
>
trainDescCollection
;
};
};
template
<
class
Distance
>
template
<
class
Distance
>
class
CV_EXPORTS
BruteForceMatcher_OCL
;
class
CV_EXPORTS
BruteForceMatcher_OCL
;
template
<
typename
T
>
template
<
typename
T
>
class
CV_EXPORTS
BruteForceMatcher_OCL
<
L1
<
T
>
>
:
public
BruteForceMatcher_OCL_base
class
CV_EXPORTS
BruteForceMatcher_OCL
<
L1
<
T
>
>
:
public
BruteForceMatcher_OCL_base
{
{
public
:
public
:
explicit
BruteForceMatcher_OCL
()
:
BruteForceMatcher_OCL_base
(
L1Dist
)
{}
explicit
BruteForceMatcher_OCL
()
:
BruteForceMatcher_OCL_base
(
L1Dist
)
{}
explicit
BruteForceMatcher_OCL
(
L1
<
T
>
/*d*/
)
:
BruteForceMatcher_OCL_base
(
L1Dist
)
{}
explicit
BruteForceMatcher_OCL
(
L1
<
T
>
/*d*/
)
:
BruteForceMatcher_OCL_base
(
L1Dist
)
{}
};
};
template
<
typename
T
>
template
<
typename
T
>
class
CV_EXPORTS
BruteForceMatcher_OCL
<
L2
<
T
>
>
:
public
BruteForceMatcher_OCL_base
class
CV_EXPORTS
BruteForceMatcher_OCL
<
L2
<
T
>
>
:
public
BruteForceMatcher_OCL_base
{
{
public
:
public
:
explicit
BruteForceMatcher_OCL
()
:
BruteForceMatcher_OCL_base
(
L2Dist
)
{}
explicit
BruteForceMatcher_OCL
()
:
BruteForceMatcher_OCL_base
(
L2Dist
)
{}
explicit
BruteForceMatcher_OCL
(
L2
<
T
>
/*d*/
)
:
BruteForceMatcher_OCL_base
(
L2Dist
)
{}
explicit
BruteForceMatcher_OCL
(
L2
<
T
>
/*d*/
)
:
BruteForceMatcher_OCL_base
(
L2Dist
)
{}
};
};
template
<>
class
CV_EXPORTS
BruteForceMatcher_OCL
<
Hamming
>
:
public
BruteForceMatcher_OCL_base
template
<>
class
CV_EXPORTS
BruteForceMatcher_OCL
<
Hamming
>
:
public
BruteForceMatcher_OCL_base
{
{
public
:
public
:
explicit
BruteForceMatcher_OCL
()
:
BruteForceMatcher_OCL_base
(
HammingDist
)
{}
explicit
BruteForceMatcher_OCL
()
:
BruteForceMatcher_OCL_base
(
HammingDist
)
{}
explicit
BruteForceMatcher_OCL
(
Hamming
/*d*/
)
:
BruteForceMatcher_OCL_base
(
HammingDist
)
{}
explicit
BruteForceMatcher_OCL
(
Hamming
/*d*/
)
:
BruteForceMatcher_OCL_base
(
HammingDist
)
{}
};
};
class
CV_EXPORTS
BFMatcher_OCL
:
public
BruteForceMatcher_OCL_base
{
public
:
explicit
BFMatcher_OCL
(
int
norm
=
NORM_L2
)
:
BruteForceMatcher_OCL_base
(
norm
==
NORM_L1
?
L1Dist
:
norm
==
NORM_L2
?
L2Dist
:
HammingDist
)
{}
};
/////////////////////////////// PyrLKOpticalFlow /////////////////////////////////////
/////////////////////////////// PyrLKOpticalFlow /////////////////////////////////////
class
CV_EXPORTS
PyrLKOpticalFlow
class
CV_EXPORTS
PyrLKOpticalFlow
{
{
public
:
public
:
PyrLKOpticalFlow
()
PyrLKOpticalFlow
()
{
{
winSize
=
Size
(
21
,
21
);
winSize
=
Size
(
21
,
21
);
maxLevel
=
3
;
maxLevel
=
3
;
iters
=
30
;
iters
=
30
;
derivLambda
=
0.5
;
derivLambda
=
0.5
;
useInitialFlow
=
false
;
useInitialFlow
=
false
;
minEigThreshold
=
1e-4
f
;
minEigThreshold
=
1e-4
f
;
getMinEigenVals
=
false
;
getMinEigenVals
=
false
;
isDeviceArch11_
=
false
;
isDeviceArch11_
=
false
;
}
}
void
sparse
(
const
oclMat
&
prevImg
,
const
oclMat
&
nextImg
,
const
oclMat
&
prevPts
,
oclMat
&
nextPts
,
void
sparse
(
const
oclMat
&
prevImg
,
const
oclMat
&
nextImg
,
const
oclMat
&
prevPts
,
oclMat
&
nextPts
,
oclMat
&
status
,
oclMat
*
err
=
0
);
oclMat
&
status
,
oclMat
*
err
=
0
);
void
dense
(
const
oclMat
&
prevImg
,
const
oclMat
&
nextImg
,
oclMat
&
u
,
oclMat
&
v
,
oclMat
*
err
=
0
);
void
dense
(
const
oclMat
&
prevImg
,
const
oclMat
&
nextImg
,
oclMat
&
u
,
oclMat
&
v
,
oclMat
*
err
=
0
);
Size
winSize
;
Size
winSize
;
int
maxLevel
;
int
maxLevel
;
int
iters
;
int
iters
;
double
derivLambda
;
double
derivLambda
;
bool
useInitialFlow
;
bool
useInitialFlow
;
float
minEigThreshold
;
float
minEigThreshold
;
bool
getMinEigenVals
;
bool
getMinEigenVals
;
void
releaseMemory
()
void
releaseMemory
()
{
{
dx_calcBuf_
.
release
();
dx_calcBuf_
.
release
();
dy_calcBuf_
.
release
();
dy_calcBuf_
.
release
();
prevPyr_
.
clear
();
prevPyr_
.
clear
();
nextPyr_
.
clear
();
nextPyr_
.
clear
();
dx_buf_
.
release
();
dx_buf_
.
release
();
dy_buf_
.
release
();
dy_buf_
.
release
();
}
}
private
:
private
:
void
calcSharrDeriv
(
const
oclMat
&
src
,
oclMat
&
dx
,
oclMat
&
dy
);
void
calcSharrDeriv
(
const
oclMat
&
src
,
oclMat
&
dx
,
oclMat
&
dy
);
void
buildImagePyramid
(
const
oclMat
&
img0
,
vector
<
oclMat
>
&
pyr
,
bool
withBorder
);
void
buildImagePyramid
(
const
oclMat
&
img0
,
vector
<
oclMat
>
&
pyr
,
bool
withBorder
);
oclMat
dx_calcBuf_
;
oclMat
dx_calcBuf_
;
oclMat
dy_calcBuf_
;
oclMat
dy_calcBuf_
;
vector
<
oclMat
>
prevPyr_
;
vector
<
oclMat
>
prevPyr_
;
vector
<
oclMat
>
nextPyr_
;
vector
<
oclMat
>
nextPyr_
;
oclMat
dx_buf_
;
oclMat
dx_buf_
;
oclMat
dy_buf_
;
oclMat
dy_buf_
;
oclMat
uPyr_
[
2
];
oclMat
uPyr_
[
2
];
oclMat
vPyr_
[
2
];
oclMat
vPyr_
[
2
];
bool
isDeviceArch11_
;
bool
isDeviceArch11_
;
};
};
//////////////// build warping maps ////////////////////
//////////////// build warping maps ////////////////////
//! builds plane warping maps
//! builds plane warping maps
...
...
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