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
1d1da9c5
Commit
1d1da9c5
authored
Jan 23, 2012
by
Vladislav Vinogradov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added support of BORDER_REFLECT to gpu::cornerHarris and gpu::cornerMinEigenVal
parent
347a7106
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
35 deletions
+22
-35
imgproc.cu
modules/gpu/src/cuda/imgproc.cu
+0
-0
imgproc.cpp
modules/gpu/src/imgproc.cpp
+18
-31
test_imgproc.cpp
modules/gpu/test/test_imgproc.cpp
+4
-4
No files found.
modules/gpu/src/cuda/imgproc.cu
View file @
1d1da9c5
This diff is collapsed.
Click to expand it.
modules/gpu/src/imgproc.cpp
View file @
1d1da9c5
...
...
@@ -1344,22 +1344,23 @@ namespace cv { namespace gpu { namespace device
{
namespace
imgproc
{
void
extractCovData_caller
(
const
DevMem2Df
Dx
,
const
DevMem2Df
Dy
,
PtrStepf
dst
,
cudaStream_t
stream
);
void
cornerHarris_caller
(
const
int
block_size
,
const
float
k
,
const
DevMem2Db
Dx
,
const
DevMem2Db
Dy
,
DevMem2Db
dst
,
int
border_type
,
cudaStream_t
stream
);
void
cornerMinEigenVal_caller
(
const
int
block_size
,
const
DevMem2Db
Dx
,
const
DevMem2Db
Dy
,
DevMem2Db
dst
,
int
border_type
,
cudaStream_t
stream
);
void
cornerHarris_gpu
(
int
block_size
,
float
k
,
DevMem2Df
Dx
,
DevMem2Df
Dy
,
DevMem2Df
dst
,
int
border_type
,
cudaStream_t
stream
);
void
cornerMinEigenVal_gpu
(
int
block_size
,
DevMem2Df
Dx
,
DevMem2Df
Dy
,
DevMem2Df
dst
,
int
border_type
,
cudaStream_t
stream
);
}
}}}
namespace
{
template
<
typename
T
>
void
extractCovData
(
const
GpuMat
&
src
,
GpuMat
&
Dx
,
GpuMat
&
Dy
,
GpuMat
&
buf
,
int
blockSize
,
int
ksize
,
int
borderType
,
Stream
&
stream
)
{
double
scale
=
(
double
)(
1
<<
((
ksize
>
0
?
ksize
:
3
)
-
1
))
*
blockSize
;
{
double
scale
=
static_cast
<
double
>
(
1
<<
((
ksize
>
0
?
ksize
:
3
)
-
1
))
*
blockSize
;
if
(
ksize
<
0
)
scale
*=
2.
;
if
(
src
.
depth
()
==
CV_8U
)
scale
*=
255.
;
scale
=
1.
/
scale
;
Dx
.
create
(
src
.
size
(),
CV_32F
);
...
...
@@ -1376,23 +1377,7 @@ namespace
Scharr
(
src
,
Dy
,
CV_32F
,
0
,
1
,
buf
,
scale
,
borderType
,
-
1
,
stream
);
}
}
void
extractCovData
(
const
GpuMat
&
src
,
GpuMat
&
Dx
,
GpuMat
&
Dy
,
GpuMat
&
buf
,
int
blockSize
,
int
ksize
,
int
borderType
,
Stream
&
stream
)
{
switch
(
src
.
type
())
{
case
CV_8U
:
extractCovData
<
unsigned
char
>
(
src
,
Dx
,
Dy
,
buf
,
blockSize
,
ksize
,
borderType
,
stream
);
break
;
case
CV_32F
:
extractCovData
<
float
>
(
src
,
Dx
,
Dy
,
buf
,
blockSize
,
ksize
,
borderType
,
stream
);
break
;
default
:
CV_Error
(
CV_StsBadArg
,
"extractCovData: unsupported type of the source matrix"
);
}
}
}
// Anonymous namespace
}
bool
cv
::
gpu
::
tryConvertToGpuBorderType
(
int
cpuBorderType
,
int
&
gpuBorderType
)
{
...
...
@@ -1433,17 +1418,18 @@ void cv::gpu::cornerHarris(const GpuMat& src, GpuMat& dst, GpuMat& Dx, GpuMat& D
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
)
{
using
namespace
::
cv
::
gpu
::
device
::
imgproc
;
using
namespace
cv
::
gpu
::
device
::
imgproc
;
CV_Assert
(
borderType
==
cv
::
BORDER_REFLECT101
||
borderType
==
cv
::
BORDER_REPLICATE
);
CV_Assert
(
borderType
==
cv
::
BORDER_REFLECT101
||
borderType
==
cv
::
BORDER_REPLICATE
||
borderType
==
cv
::
BORDER_REFLECT
);
int
gpuBorderType
;
CV_Assert
(
tryConvertToGpuBorderType
(
borderType
,
gpuBorderType
));
extractCovData
(
src
,
Dx
,
Dy
,
buf
,
blockSize
,
ksize
,
borderType
,
stream
);
dst
.
create
(
src
.
size
(),
CV_32F
);
cornerHarris_caller
(
blockSize
,
(
float
)
k
,
Dx
,
Dy
,
dst
,
gpuBorderType
,
StreamAccessor
::
getStream
(
stream
));
cornerHarris_gpu
(
blockSize
,
static_cast
<
float
>
(
k
),
Dx
,
Dy
,
dst
,
gpuBorderType
,
StreamAccessor
::
getStream
(
stream
));
}
void
cv
::
gpu
::
cornerMinEigenVal
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
int
blockSize
,
int
ksize
,
int
borderType
)
...
...
@@ -1462,15 +1448,16 @@ void cv::gpu::cornerMinEigenVal(const GpuMat& src, GpuMat& dst, GpuMat& Dx, GpuM
{
using
namespace
::
cv
::
gpu
::
device
::
imgproc
;
CV_Assert
(
borderType
==
cv
::
BORDER_REFLECT101
||
borderType
==
cv
::
BORDER_REPLICATE
);
CV_Assert
(
borderType
==
cv
::
BORDER_REFLECT101
||
borderType
==
cv
::
BORDER_REPLICATE
||
borderType
==
cv
::
BORDER_REFLECT
);
int
gpuBorderType
;
CV_Assert
(
tryConvertToGpuBorderType
(
borderType
,
gpuBorderType
));
extractCovData
(
src
,
Dx
,
Dy
,
buf
,
blockSize
,
ksize
,
borderType
,
stream
);
extractCovData
(
src
,
Dx
,
Dy
,
buf
,
blockSize
,
ksize
,
borderType
,
stream
);
dst
.
create
(
src
.
size
(),
CV_32F
);
cornerMinEigenVal_caller
(
blockSize
,
Dx
,
Dy
,
dst
,
gpuBorderType
,
StreamAccessor
::
getStream
(
stream
));
cornerMinEigenVal_gpu
(
blockSize
,
Dx
,
Dy
,
dst
,
gpuBorderType
,
StreamAccessor
::
getStream
(
stream
));
}
//////////////////////////////////////////////////////////////////////////////
...
...
modules/gpu/test/test_imgproc.cpp
View file @
1d1da9c5
...
...
@@ -2774,13 +2774,13 @@ TEST_P(CornerHarris, Accuracy)
dev_dst
.
download
(
dst
);
);
EXPECT_MAT_NEAR
(
dst_gold
,
dst
,
1e-3
);
EXPECT_MAT_NEAR
(
dst_gold
,
dst
,
0.02
);
}
INSTANTIATE_TEST_CASE_P
(
ImgProc
,
CornerHarris
,
Combine
(
ALL_DEVICES
,
Values
(
CV_8UC1
,
CV_32FC1
),
Values
((
int
)
cv
::
BORDER_REFLECT101
,
(
int
)
cv
::
BORDER_REPLICATE
)));
Values
((
int
)
cv
::
BORDER_REFLECT101
,
(
int
)
cv
::
BORDER_REPLICATE
,
(
int
)
cv
::
BORDER_REFLECT
)));
///////////////////////////////////////////////////////////////////////////////////////////////////////
// cornerMinEigen
...
...
@@ -2829,13 +2829,13 @@ TEST_P(CornerMinEigen, Accuracy)
dev_dst
.
download
(
dst
);
);
EXPECT_MAT_NEAR
(
dst_gold
,
dst
,
1e-
2
);
EXPECT_MAT_NEAR
(
dst_gold
,
dst
,
0.0
2
);
}
INSTANTIATE_TEST_CASE_P
(
ImgProc
,
CornerMinEigen
,
Combine
(
ALL_DEVICES
,
Values
(
CV_8UC1
,
CV_32FC1
),
Values
((
int
)
cv
::
BORDER_REFLECT101
,
(
int
)
cv
::
BORDER_REPLICATE
)));
Values
((
int
)
cv
::
BORDER_REFLECT101
,
(
int
)
cv
::
BORDER_REPLICATE
,
(
int
)
cv
::
BORDER_REFLECT
)));
////////////////////////////////////////////////////////////////////////
// ColumnSum
...
...
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