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
368bac7a
Commit
368bac7a
authored
Dec 02, 2013
by
Andrey Pavlenko
Committed by
OpenCV Buildbot
Dec 02, 2013
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1744 from liuxing6666:2.4_fix_harris_test
parents
19ceab13
9a0d0624
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
12 deletions
+45
-12
imgproc_calcHarris.cl
modules/ocl/src/opencl/imgproc_calcHarris.cl
+23
-10
test_imgproc.cpp
modules/ocl/test/test_imgproc.cpp
+22
-2
No files found.
modules/ocl/src/opencl/imgproc_calcHarris.cl
View file @
368bac7a
...
...
@@ -47,6 +47,13 @@
/////////////////////////////////Macro
for
border
type////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
#
if
defined
(
DOUBLE_SUPPORT
)
&&
defined
(
cl_khr_fp64
)
#
pragma
OPENCL
EXTENSION
cl_khr_fp64:enable
#
define
FPTYPE
double
#
else
#
define
FPTYPE
float
#
endif
#
ifdef
BORDER_CONSTANT
#
elif
defined
BORDER_REPLICATE
#
define
EXTRAPOLATE
(
x,
maxV
)
\
...
...
@@ -116,7 +123,7 @@ __kernel void calcHarris(__global const float *Dx, __global const float *Dy, __g
int
dst_startY
=
(
gY
<<
1
)
+
dst_y_off
;
float
dx_data[ksY+1],dy_data[ksY+1],
data[3][ksY+1]
;
__local
float
temp[6][THREADS]
;
__local
FPTYPE
temp[6][THREADS]
;
#
ifdef
BORDER_CONSTANT
for
(
int
i=0
; i < ksY+1; i++)
...
...
@@ -136,7 +143,7 @@ __kernel void calcHarris(__global const float *Dx, __global const float *Dy, __g
data[2][i]
=
dy_data[i]
*
dy_data[i]
;
}
#
else
int
clamped_col
=
min
(
dst_cols,
col
)
;
int
clamped_col
=
min
(
2*
dst_cols,
col
)
;
for
(
int
i=0
; i < ksY+1; i++)
{
int
dx_selected_row
=
dx_startY+i,
dx_selected_col
=
dx_startX+clamped_col
;
...
...
@@ -154,7 +161,7 @@ __kernel void calcHarris(__global const float *Dx, __global const float *Dy, __g
data[2][i]
=
dy_data[i]
*
dy_data[i]
;
}
#
endif
float
sum0
=
0.0f,
sum1
=
0.0f,
sum2
=
0.0f
;
FPTYPE
sum0
=
0.0f,
sum1
=
0.0f,
sum2
=
0.0f
;
for
(
int
i=1
; i < ksY; i++)
{
sum0
+=
data[0][i]
;
...
...
@@ -162,16 +169,16 @@ __kernel void calcHarris(__global const float *Dx, __global const float *Dy, __g
sum2
+=
data[2][i]
;
}
float
sum01
=
sum0
+
data[0][0]
;
float
sum02
=
sum0
+
data[0][ksY]
;
FPTYPE
sum01
=
sum0
+
data[0][0]
;
FPTYPE
sum02
=
sum0
+
data[0][ksY]
;
temp[0][col]
=
sum01
;
temp[1][col]
=
sum02
;
float
sum11
=
sum1
+
data[1][0]
;
float
sum12
=
sum1
+
data[1][ksY]
;
FPTYPE
sum11
=
sum1
+
data[1][0]
;
FPTYPE
sum12
=
sum1
+
data[1][ksY]
;
temp[2][col]
=
sum11
;
temp[3][col]
=
sum12
;
float
sum21
=
sum2
+
data[2][0]
;
float
sum22
=
sum2
+
data[2][ksY]
;
FPTYPE
sum21
=
sum2
+
data[2][0]
;
FPTYPE
sum22
=
sum2
+
data[2][ksY]
;
temp[4][col]
=
sum21
;
temp[5][col]
=
sum22
;
barrier
(
CLK_LOCAL_MEM_FENCE
)
;
...
...
@@ -184,8 +191,14 @@ __kernel void calcHarris(__global const float *Dx, __global const float *Dy, __g
int
till
=
(
ksX
+
1
)
%2
;
float
tmp_sum[6]
=
{
0.0f,
0.0f,
0.0f,
0.0f,
0.0f,
0.0f
}
;
for
(
int
k=0
; k<6; k++)
{
FPTYPE
temp_sum
=
0
;
for
(
int
i=-anX
; i<=anX - till; i++)
tmp_sum[k]
+=
temp[k][col+i]
;
{
temp_sum
+=
temp[k][col+i]
;
}
tmp_sum[k]
=
temp_sum
;
}
if
(
posX
<
dst_cols
&&
(
posY
)
<
dst_rows
)
{
...
...
modules/ocl/test/test_imgproc.cpp
View file @
368bac7a
...
...
@@ -254,8 +254,28 @@ OCL_TEST_P(CornerMinEigenVal, Mat)
}
////////////////////////////////cornerHarris//////////////////////////////////////////
struct
CornerHarris
:
public
ImgprocTestBase
{
void
Near
(
double
threshold
=
0.0
)
{
Mat
whole
,
roi
;
gdst_whole
.
download
(
whole
);
gdst_roi
.
download
(
roi
);
absdiff
(
whole
,
dst_whole
,
whole
);
absdiff
(
roi
,
dst_roi
,
roi
);
typedef
CornerTestBase
CornerHarris
;
divide
(
whole
,
dst_whole
,
whole
);
divide
(
roi
,
dst_roi
,
roi
);
absdiff
(
dst_whole
,
dst_whole
,
dst_whole
);
absdiff
(
dst_roi
,
dst_roi
,
dst_roi
);
EXPECT_MAT_NEAR
(
dst_whole
,
whole
,
threshold
);
EXPECT_MAT_NEAR
(
dst_roi
,
roi
,
threshold
);
}
};
OCL_TEST_P
(
CornerHarris
,
Mat
)
{
...
...
@@ -269,7 +289,7 @@ OCL_TEST_P(CornerHarris, Mat)
cornerHarris
(
src_roi
,
dst_roi
,
blockSize
,
apertureSize
,
k
,
borderType
);
ocl
::
cornerHarris
(
gsrc_roi
,
gdst_roi
,
blockSize
,
apertureSize
,
k
,
borderType
);
Near
(
1e-5
,
true
);
Near
(
1e-5
);
}
}
...
...
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