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
d7ff3ad0
Commit
d7ff3ad0
authored
Apr 30, 2013
by
Vladislav Vinogradov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactored cornerHarris and cornerMinEigenVal
* converted it into Algorithm
parent
ad4d6bed
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
142 additions
and
83 deletions
+142
-83
gpuimgproc.hpp
modules/gpuimgproc/include/opencv2/gpuimgproc.hpp
+28
-8
perf_corners.cpp
modules/gpuimgproc/perf/perf_corners.cpp
+6
-8
corners.cpp
modules/gpuimgproc/src/corners.cpp
+92
-59
gftt.cpp
modules/gpuimgproc/src/gftt.cpp
+6
-4
test_corners.cpp
modules/gpuimgproc/test/test_corners.cpp
+6
-2
tests.cpp
samples/gpu/performance/tests.cpp
+4
-2
No files found.
modules/gpuimgproc/include/opencv2/gpuimgproc.hpp
View file @
d7ff3ad0
...
@@ -362,17 +362,37 @@ public:
...
@@ -362,17 +362,37 @@ public:
////////////////////////// Corners Detection ///////////////////////////
////////////////////////// Corners Detection ///////////////////////////
class
CV_EXPORTS
CornernessCriteria
:
public
Algorithm
{
public
:
virtual
void
compute
(
InputArray
src
,
OutputArray
dst
,
Stream
&
stream
=
Stream
::
Null
())
=
0
;
};
//! computes Harris cornerness criteria at each image pixel
//! computes Harris cornerness criteria at each image pixel
CV_EXPORTS
void
cornerHarris
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
int
blockSize
,
int
ksize
,
double
k
,
int
borderType
=
BORDER_REFLECT101
);
CV_EXPORTS
Ptr
<
CornernessCriteria
>
createHarrisCorner
(
int
srcType
,
int
blockSize
,
int
ksize
,
double
k
,
int
borderType
=
BORDER_REFLECT101
);
CV_EXPORTS
void
cornerHarris
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
GpuMat
&
Dx
,
GpuMat
&
Dy
,
int
blockSize
,
int
ksize
,
double
k
,
int
borderType
=
BORDER_REFLECT101
);
CV_EXPORTS
void
cornerHarris
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
GpuMat
&
Dx
,
GpuMat
&
Dy
,
GpuMat
&
buf
,
int
blockSize
,
int
ksize
,
double
k
,
int
borderType
=
BORDER_REFLECT101
,
Stream
&
stream
=
Stream
::
Null
());
//! computes minimum eigen value of 2x2 derivative covariation matrix at each pixel - the cornerness criteria
//! computes minimum eigen value of 2x2 derivative covariation matrix at each pixel - the cornerness criteria
CV_EXPORTS
void
cornerMinEigenVal
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
int
blockSize
,
int
ksize
,
int
borderType
=
BORDER_REFLECT101
);
CV_EXPORTS
Ptr
<
CornernessCriteria
>
createMinEigenValCorner
(
int
srcType
,
int
blockSize
,
int
ksize
,
int
borderType
=
BORDER_REFLECT101
);
CV_EXPORTS
void
cornerMinEigenVal
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
GpuMat
&
Dx
,
GpuMat
&
Dy
,
int
blockSize
,
int
ksize
,
int
borderType
=
BORDER_REFLECT101
);
CV_EXPORTS
void
cornerMinEigenVal
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
GpuMat
&
Dx
,
GpuMat
&
Dy
,
GpuMat
&
buf
,
int
blockSize
,
int
ksize
,
// obsolete
int
borderType
=
BORDER_REFLECT101
,
Stream
&
stream
=
Stream
::
Null
());
__OPENCV_GPUIMGPROC_DEPR_BEFORE__
void
cornerHarris
(
InputArray
src
,
OutputArray
dst
,
int
blockSize
,
int
ksize
,
double
k
,
int
borderType
=
BORDER_REFLECT101
,
Stream
&
stream
=
Stream
::
Null
())
__OPENCV_GPUIMGPROC_DEPR_AFTER__
;
inline
void
cornerHarris
(
InputArray
src
,
OutputArray
dst
,
int
blockSize
,
int
ksize
,
double
k
,
int
borderType
,
Stream
&
stream
)
{
gpu
::
createHarrisCorner
(
src
.
type
(),
blockSize
,
ksize
,
k
,
borderType
)
->
compute
(
src
,
dst
,
stream
);
}
__OPENCV_GPUIMGPROC_DEPR_BEFORE__
void
cornerMinEigenVal
(
InputArray
src
,
OutputArray
dst
,
int
blockSize
,
int
ksize
,
int
borderType
=
BORDER_REFLECT101
,
Stream
&
stream
=
Stream
::
Null
())
__OPENCV_GPUIMGPROC_DEPR_AFTER__
;
inline
void
cornerMinEigenVal
(
InputArray
src
,
OutputArray
dst
,
int
blockSize
,
int
ksize
,
int
borderType
,
Stream
&
stream
)
{
gpu
::
createMinEigenValCorner
(
src
.
type
(),
blockSize
,
ksize
,
borderType
)
->
compute
(
src
,
dst
,
stream
);
}
////////////////////////// Feature Detection ///////////////////////////
////////////////////////// Feature Detection ///////////////////////////
...
...
modules/gpuimgproc/perf/perf_corners.cpp
View file @
d7ff3ad0
...
@@ -75,11 +75,10 @@ PERF_TEST_P(Image_Type_Border_BlockSz_ApertureSz, CornerHarris,
...
@@ -75,11 +75,10 @@ PERF_TEST_P(Image_Type_Border_BlockSz_ApertureSz, CornerHarris,
{
{
const
cv
::
gpu
::
GpuMat
d_img
(
img
);
const
cv
::
gpu
::
GpuMat
d_img
(
img
);
cv
::
gpu
::
GpuMat
dst
;
cv
::
gpu
::
GpuMat
dst
;
cv
::
gpu
::
GpuMat
d_Dx
;
cv
::
gpu
::
GpuMat
d_Dy
;
cv
::
gpu
::
GpuMat
d_buf
;
TEST_CYCLE
()
cv
::
gpu
::
cornerHarris
(
d_img
,
dst
,
d_Dx
,
d_Dy
,
d_buf
,
blockSize
,
apertureSize
,
k
,
borderMode
);
cv
::
Ptr
<
cv
::
gpu
::
CornernessCriteria
>
harris
=
cv
::
gpu
::
createHarrisCorner
(
img
.
type
(),
blockSize
,
apertureSize
,
k
,
borderMode
);
TEST_CYCLE
()
harris
->
compute
(
d_img
,
dst
);
GPU_SANITY_CHECK
(
dst
,
1e-4
);
GPU_SANITY_CHECK
(
dst
,
1e-4
);
}
}
...
@@ -118,11 +117,10 @@ PERF_TEST_P(Image_Type_Border_BlockSz_ApertureSz, CornerMinEigenVal,
...
@@ -118,11 +117,10 @@ PERF_TEST_P(Image_Type_Border_BlockSz_ApertureSz, CornerMinEigenVal,
{
{
const
cv
::
gpu
::
GpuMat
d_img
(
img
);
const
cv
::
gpu
::
GpuMat
d_img
(
img
);
cv
::
gpu
::
GpuMat
dst
;
cv
::
gpu
::
GpuMat
dst
;
cv
::
gpu
::
GpuMat
d_Dx
;
cv
::
gpu
::
GpuMat
d_Dy
;
cv
::
gpu
::
GpuMat
d_buf
;
TEST_CYCLE
()
cv
::
gpu
::
cornerMinEigenVal
(
d_img
,
dst
,
d_Dx
,
d_Dy
,
d_buf
,
blockSize
,
apertureSize
,
borderMode
);
cv
::
Ptr
<
cv
::
gpu
::
CornernessCriteria
>
minEigenVal
=
cv
::
gpu
::
createMinEigenValCorner
(
img
.
type
(),
blockSize
,
apertureSize
,
borderMode
);
TEST_CYCLE
()
minEigenVal
->
compute
(
d_img
,
dst
);
GPU_SANITY_CHECK
(
dst
,
1e-4
);
GPU_SANITY_CHECK
(
dst
,
1e-4
);
}
}
...
...
modules/gpuimgproc/src/corners.cpp
View file @
d7ff3ad0
...
@@ -47,13 +47,8 @@ using namespace cv::gpu;
...
@@ -47,13 +47,8 @@ using namespace cv::gpu;
#if !defined (HAVE_CUDA) || defined (CUDA_DISABLER)
#if !defined (HAVE_CUDA) || defined (CUDA_DISABLER)
void
cv
::
gpu
::
cornerHarris
(
const
GpuMat
&
,
GpuMat
&
,
int
,
int
,
double
,
int
)
{
throw_no_cuda
();
}
Ptr
<
gpu
::
CornernessCriteria
>
cv
::
gpu
::
createHarrisCorner
(
int
,
int
,
int
,
double
,
int
)
{
throw_no_cuda
();
return
Ptr
<
gpu
::
CornernessCriteria
>
();
}
void
cv
::
gpu
::
cornerHarris
(
const
GpuMat
&
,
GpuMat
&
,
GpuMat
&
,
GpuMat
&
,
int
,
int
,
double
,
int
)
{
throw_no_cuda
();
}
Ptr
<
gpu
::
CornernessCriteria
>
cv
::
gpu
::
createMinEigenValCorner
(
int
,
int
,
int
,
int
)
{
throw_no_cuda
();
return
Ptr
<
gpu
::
CornernessCriteria
>
();
}
void
cv
::
gpu
::
cornerHarris
(
const
GpuMat
&
,
GpuMat
&
,
GpuMat
&
,
GpuMat
&
,
GpuMat
&
,
int
,
int
,
double
,
int
,
Stream
&
)
{
throw_no_cuda
();
}
void
cv
::
gpu
::
cornerMinEigenVal
(
const
GpuMat
&
,
GpuMat
&
,
int
,
int
,
int
)
{
throw_no_cuda
();
}
void
cv
::
gpu
::
cornerMinEigenVal
(
const
GpuMat
&
,
GpuMat
&
,
GpuMat
&
,
GpuMat
&
,
int
,
int
,
int
)
{
throw_no_cuda
();
}
void
cv
::
gpu
::
cornerMinEigenVal
(
const
GpuMat
&
,
GpuMat
&
,
GpuMat
&
,
GpuMat
&
,
GpuMat
&
,
int
,
int
,
int
,
Stream
&
)
{
throw_no_cuda
();
}
#else
/* !defined (HAVE_CUDA) */
#else
/* !defined (HAVE_CUDA) */
...
@@ -68,89 +63,127 @@ namespace cv { namespace gpu { namespace cudev
...
@@ -68,89 +63,127 @@ namespace cv { namespace gpu { namespace cudev
namespace
namespace
{
{
void
extractCovData
(
const
GpuMat
&
src
,
GpuMat
&
Dx
,
GpuMat
&
Dy
,
GpuMat
&
buf
,
int
blockSize
,
int
ksize
,
int
borderType
,
Stream
&
stream
)
class
CornerBase
:
public
CornernessCriteria
{
protected
:
CornerBase
(
int
srcType
,
int
blockSize
,
int
ksize
,
int
borderType
);
void
extractCovData
(
const
GpuMat
&
src
,
Stream
&
stream
);
int
srcType_
;
int
blockSize_
;
int
ksize_
;
int
borderType_
;
GpuMat
Dx_
,
Dy_
;
private
:
Ptr
<
gpu
::
Filter
>
filterDx_
,
filterDy_
;
};
CornerBase
::
CornerBase
(
int
srcType
,
int
blockSize
,
int
ksize
,
int
borderType
)
:
srcType_
(
srcType
),
blockSize_
(
blockSize
),
ksize_
(
ksize
),
borderType_
(
borderType
)
{
{
(
void
)
buf
;
CV_Assert
(
borderType_
==
BORDER_REFLECT101
||
borderType_
==
BORDER_REPLICATE
||
borderType_
==
BORDER_REFLECT
)
;
double
scale
=
static_cast
<
double
>
(
1
<<
((
ksize
>
0
?
ksize
:
3
)
-
1
))
*
blockSize
;
const
int
sdepth
=
CV_MAT_DEPTH
(
srcType_
);
const
int
cn
=
CV_MAT_CN
(
srcType_
);
if
(
ksize
<
0
)
CV_Assert
(
cn
==
1
);
double
scale
=
static_cast
<
double
>
(
1
<<
((
ksize_
>
0
?
ksize_
:
3
)
-
1
))
*
blockSize_
;
if
(
ksize_
<
0
)
scale
*=
2.
;
scale
*=
2.
;
if
(
s
rc
.
depth
()
==
CV_8U
)
if
(
s
depth
==
CV_8U
)
scale
*=
255.
;
scale
*=
255.
;
scale
=
1.
/
scale
;
scale
=
1.
/
scale
;
Dx
.
create
(
src
.
size
(),
CV_32F
);
if
(
ksize_
>
0
)
Dy
.
create
(
src
.
size
(),
CV_32F
);
Ptr
<
gpu
::
Filter
>
filterDx
,
filterDy
;
if
(
ksize
>
0
)
{
{
filterDx
=
gpu
::
createSobelFilter
(
src
.
type
(),
CV_32F
,
1
,
0
,
ksize
,
scale
,
borderType
);
filterDx
_
=
gpu
::
createSobelFilter
(
srcType
,
CV_32F
,
1
,
0
,
ksize_
,
scale
,
borderType_
);
filterDy
=
gpu
::
createSobelFilter
(
src
.
type
(),
CV_32F
,
0
,
1
,
ksize
,
scale
,
borderType
);
filterDy
_
=
gpu
::
createSobelFilter
(
srcType
,
CV_32F
,
0
,
1
,
ksize_
,
scale
,
borderType_
);
}
}
else
else
{
{
filterDx
=
gpu
::
createScharrFilter
(
src
.
type
(),
CV_32F
,
1
,
0
,
scale
,
borderType
);
filterDx_
=
gpu
::
createScharrFilter
(
srcType
,
CV_32F
,
1
,
0
,
scale
,
borderType_
);
filterDy
=
gpu
::
createScharrFilter
(
src
.
type
(),
CV_32F
,
0
,
1
,
scale
,
borderType
);
filterDy_
=
gpu
::
createScharrFilter
(
srcType
,
CV_32F
,
0
,
1
,
scale
,
borderType_
);
}
}
void
CornerBase
::
extractCovData
(
const
GpuMat
&
src
,
Stream
&
stream
)
{
CV_Assert
(
src
.
type
()
==
srcType_
);
filterDx_
->
apply
(
src
,
Dx_
,
stream
);
filterDy_
->
apply
(
src
,
Dy_
,
stream
);
}
}
filterDx
->
apply
(
src
,
Dx
);
class
Harris
:
public
CornerBase
filterDy
->
apply
(
src
,
Dy
);
{
public
:
Harris
(
int
srcType
,
int
blockSize
,
int
ksize
,
double
k
,
int
borderType
)
:
CornerBase
(
srcType
,
blockSize
,
ksize
,
borderType
),
k_
(
static_cast
<
float
>
(
k
))
{
}
}
}
void
cv
::
gpu
::
cornerHarris
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
int
blockSize
,
int
ksize
,
double
k
,
int
borderType
)
void
compute
(
InputArray
src
,
OutputArray
dst
,
Stream
&
stream
=
Stream
::
Null
());
{
GpuMat
Dx
,
Dy
;
cornerHarris
(
src
,
dst
,
Dx
,
Dy
,
blockSize
,
ksize
,
k
,
borderType
);
}
void
cv
::
gpu
::
cornerHarris
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
GpuMat
&
Dx
,
GpuMat
&
Dy
,
int
blockSize
,
int
ksize
,
double
k
,
int
borderType
)
private
:
{
float
k_
;
GpuMat
buf
;
};
cornerHarris
(
src
,
dst
,
Dx
,
Dy
,
buf
,
blockSize
,
ksize
,
k
,
borderType
);
}
void
cv
::
gpu
::
cornerHarris
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
GpuMat
&
Dx
,
GpuMat
&
Dy
,
GpuMat
&
buf
,
int
blockSize
,
int
ksize
,
double
k
,
int
borderType
,
Stream
&
stream
)
void
Harris
::
compute
(
InputArray
_src
,
OutputArray
_dst
,
Stream
&
stream
)
{
{
using
namespace
cv
::
gpu
::
cudev
::
imgproc
;
using
namespace
cv
::
gpu
::
cudev
::
imgproc
;
CV_Assert
(
borderType
==
cv
::
BORDER_REFLECT101
||
borderType
==
cv
::
BORDER_REPLICATE
||
borderType
==
cv
::
BORDER_REFLECT
);
GpuMat
src
=
_src
.
getGpuMat
(
);
extractCovData
(
src
,
Dx
,
Dy
,
buf
,
blockSize
,
ksize
,
borderType
,
stream
);
extractCovData
(
src
,
stream
);
dst
.
create
(
src
.
size
(),
CV_32F
);
_dst
.
create
(
src
.
size
(),
CV_32FC1
);
GpuMat
dst
=
_dst
.
getGpuMat
();
cornerHarris_gpu
(
blockSize
,
static_cast
<
float
>
(
k
),
Dx
,
Dy
,
dst
,
borderType
,
StreamAccessor
::
getStream
(
stream
));
cornerHarris_gpu
(
blockSize_
,
k_
,
Dx_
,
Dy_
,
dst
,
borderType_
,
StreamAccessor
::
getStream
(
stream
));
}
}
void
cv
::
gpu
::
cornerMinEigenVal
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
int
blockSize
,
int
ksize
,
int
borderType
)
class
MinEigenVal
:
public
CornerBase
{
{
GpuMat
Dx
,
Dy
;
public
:
cornerMinEigenVal
(
src
,
dst
,
Dx
,
Dy
,
blockSize
,
ksize
,
borderType
);
MinEigenVal
(
int
srcType
,
int
blockSize
,
int
ksize
,
int
borderType
)
:
}
CornerBase
(
srcType
,
blockSize
,
ksize
,
borderType
)
{
}
void
cv
::
gpu
::
cornerMinEigenVal
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
GpuMat
&
Dx
,
GpuMat
&
Dy
,
int
blockSize
,
int
ksize
,
int
borderType
)
void
compute
(
InputArray
src
,
OutputArray
dst
,
Stream
&
stream
=
Stream
::
Null
());
{
GpuMat
buf
;
cornerMinEigenVal
(
src
,
dst
,
Dx
,
Dy
,
buf
,
blockSize
,
ksize
,
borderType
);
}
void
cv
::
gpu
::
cornerMinEigenVal
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
GpuMat
&
Dx
,
GpuMat
&
Dy
,
GpuMat
&
buf
,
int
blockSize
,
int
ksize
,
int
borderType
,
Stream
&
stream
)
private
:
{
float
k_
;
using
namespace
::
cv
::
gpu
::
cudev
::
imgproc
;
}
;
CV_Assert
(
borderType
==
cv
::
BORDER_REFLECT101
||
borderType
==
cv
::
BORDER_REPLICATE
||
borderType
==
cv
::
BORDER_REFLECT
);
void
MinEigenVal
::
compute
(
InputArray
_src
,
OutputArray
_dst
,
Stream
&
stream
)
{
using
namespace
cv
::
gpu
::
cudev
::
imgproc
;
GpuMat
src
=
_src
.
getGpuMat
();
extractCovData
(
src
,
stream
);
_dst
.
create
(
src
.
size
(),
CV_32FC1
);
GpuMat
dst
=
_dst
.
getGpuMat
();
extractCovData
(
src
,
Dx
,
Dy
,
buf
,
blockSize
,
ksize
,
borderType
,
stream
);
cornerMinEigenVal_gpu
(
blockSize_
,
Dx_
,
Dy_
,
dst
,
borderType_
,
StreamAccessor
::
getStream
(
stream
));
}
}
dst
.
create
(
src
.
size
(),
CV_32F
);
Ptr
<
gpu
::
CornernessCriteria
>
cv
::
gpu
::
createHarrisCorner
(
int
srcType
,
int
blockSize
,
int
ksize
,
double
k
,
int
borderType
)
{
return
new
Harris
(
srcType
,
blockSize
,
ksize
,
k
,
borderType
);
}
cornerMinEigenVal_gpu
(
blockSize
,
Dx
,
Dy
,
dst
,
borderType
,
StreamAccessor
::
getStream
(
stream
));
Ptr
<
gpu
::
CornernessCriteria
>
cv
::
gpu
::
createMinEigenValCorner
(
int
srcType
,
int
blockSize
,
int
ksize
,
int
borderType
)
{
return
new
MinEigenVal
(
srcType
,
blockSize
,
ksize
,
borderType
);
}
}
#endif
/* !defined (HAVE_CUDA) */
#endif
/* !defined (HAVE_CUDA) */
modules/gpuimgproc/src/gftt.cpp
View file @
d7ff3ad0
...
@@ -75,10 +75,12 @@ void cv::gpu::GoodFeaturesToTrackDetector_GPU::operator ()(const GpuMat& image,
...
@@ -75,10 +75,12 @@ void cv::gpu::GoodFeaturesToTrackDetector_GPU::operator ()(const GpuMat& image,
ensureSizeIsEnough
(
image
.
size
(),
CV_32F
,
eig_
);
ensureSizeIsEnough
(
image
.
size
(),
CV_32F
,
eig_
);
if
(
useHarrisDetector
)
Ptr
<
gpu
::
CornernessCriteria
>
cornerCriteria
=
cornerHarris
(
image
,
eig_
,
Dx_
,
Dy_
,
buf_
,
blockSize
,
3
,
harrisK
);
useHarrisDetector
?
else
gpu
::
createHarrisCorner
(
image
.
type
(),
blockSize
,
3
,
harrisK
)
:
cornerMinEigenVal
(
image
,
eig_
,
Dx_
,
Dy_
,
buf_
,
blockSize
,
3
);
gpu
::
createMinEigenValCorner
(
image
.
type
(),
blockSize
,
3
);
cornerCriteria
->
compute
(
image
,
eig_
);
double
maxVal
=
0
;
double
maxVal
=
0
;
gpu
::
minMax
(
eig_
,
0
,
&
maxVal
,
GpuMat
(),
minMaxbuf_
);
gpu
::
minMax
(
eig_
,
0
,
&
maxVal
,
GpuMat
(),
minMaxbuf_
);
...
...
modules/gpuimgproc/test/test_corners.cpp
View file @
d7ff3ad0
...
@@ -82,8 +82,10 @@ GPU_TEST_P(CornerHarris, Accuracy)
...
@@ -82,8 +82,10 @@ GPU_TEST_P(CornerHarris, Accuracy)
double
k
=
randomDouble
(
0.1
,
0.9
);
double
k
=
randomDouble
(
0.1
,
0.9
);
cv
::
Ptr
<
cv
::
gpu
::
CornernessCriteria
>
harris
=
cv
::
gpu
::
createHarrisCorner
(
src
.
type
(),
blockSize
,
apertureSize
,
k
,
borderType
);
cv
::
gpu
::
GpuMat
dst
;
cv
::
gpu
::
GpuMat
dst
;
cv
::
gpu
::
cornerHarris
(
loadMat
(
src
),
dst
,
blockSize
,
apertureSize
,
k
,
borderType
);
harris
->
compute
(
loadMat
(
src
),
dst
);
cv
::
Mat
dst_gold
;
cv
::
Mat
dst_gold
;
cv
::
cornerHarris
(
src
,
dst_gold
,
blockSize
,
apertureSize
,
k
,
borderType
);
cv
::
cornerHarris
(
src
,
dst_gold
,
blockSize
,
apertureSize
,
k
,
borderType
);
...
@@ -126,8 +128,10 @@ GPU_TEST_P(CornerMinEigen, Accuracy)
...
@@ -126,8 +128,10 @@ GPU_TEST_P(CornerMinEigen, Accuracy)
cv
::
Mat
src
=
readImageType
(
"stereobm/aloe-L.png"
,
type
);
cv
::
Mat
src
=
readImageType
(
"stereobm/aloe-L.png"
,
type
);
ASSERT_FALSE
(
src
.
empty
());
ASSERT_FALSE
(
src
.
empty
());
cv
::
Ptr
<
cv
::
gpu
::
CornernessCriteria
>
minEigenVal
=
cv
::
gpu
::
createMinEigenValCorner
(
src
.
type
(),
blockSize
,
apertureSize
,
borderType
);
cv
::
gpu
::
GpuMat
dst
;
cv
::
gpu
::
GpuMat
dst
;
cv
::
gpu
::
cornerMinEigenVal
(
loadMat
(
src
),
dst
,
blockSize
,
apertureSize
,
borderType
);
minEigenVal
->
compute
(
loadMat
(
src
),
dst
);
cv
::
Mat
dst_gold
;
cv
::
Mat
dst_gold
;
cv
::
cornerMinEigenVal
(
src
,
dst_gold
,
blockSize
,
apertureSize
,
borderType
);
cv
::
cornerMinEigenVal
(
src
,
dst_gold
,
blockSize
,
apertureSize
,
borderType
);
...
...
samples/gpu/performance/tests.cpp
View file @
d7ff3ad0
...
@@ -176,10 +176,12 @@ TEST(cornerHarris)
...
@@ -176,10 +176,12 @@ TEST(cornerHarris)
d_src
.
upload
(
src
);
d_src
.
upload
(
src
);
gpu
::
cornerHarris
(
d_src
,
d_dst
,
5
,
7
,
0.1
,
BORDER_REFLECT101
);
Ptr
<
gpu
::
CornernessCriteria
>
harris
=
gpu
::
createHarrisCorner
(
src
.
type
(),
5
,
7
,
0.1
,
BORDER_REFLECT101
);
harris
->
compute
(
d_src
,
d_dst
);
GPU_ON
;
GPU_ON
;
gpu
::
cornerHarris
(
d_src
,
d_dst
,
5
,
7
,
0.1
,
BORDER_REFLECT101
);
harris
->
compute
(
d_src
,
d_dst
);
GPU_OFF
;
GPU_OFF
;
}
}
}
}
...
...
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