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
d59a6fa5
Commit
d59a6fa5
authored
Sep 05, 2014
by
Alexander Karsakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimization for getLines
parent
fee8f29f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
6 deletions
+13
-6
hough.cpp
modules/imgproc/src/hough.cpp
+2
-1
hough_lines.cl
modules/imgproc/src/opencl/hough_lines.cl
+11
-5
No files found.
modules/imgproc/src/hough.cpp
View file @
d59a6fa5
...
...
@@ -728,6 +728,7 @@ static bool ocl_HoughLines(InputArray _src, OutputArray _lines, double rho, doub
if
(
!
fillAccumKernel
.
run
(
2
,
globalThreads
,
fillAccumLT
,
false
))
return
false
;
const
int
pixPerWI
=
8
;
ocl
::
Kernel
getLinesKernel
(
"get_lines"
,
ocl
::
imgproc
::
hough_lines_oclsrc
,
format
(
"-D GET_LINES"
));
if
(
getLinesKernel
.
empty
())
...
...
@@ -740,7 +741,7 @@ static bool ocl_HoughLines(InputArray _src, OutputArray _lines, double rho, doub
getLinesKernel
.
args
(
ocl
::
KernelArg
::
ReadOnly
(
accum
),
ocl
::
KernelArg
::
WriteOnlyNoSize
(
lines
),
ocl
::
KernelArg
::
PtrWriteOnly
(
counters
),
linesMax
,
threshold
,
(
float
)
rho
,
(
float
)
theta
);
globalThreads
[
0
]
=
numrho
;
globalThreads
[
1
]
=
numangle
;
globalThreads
[
0
]
=
(
numrho
+
pixPerWI
-
1
)
/
pixPerWI
;
globalThreads
[
1
]
=
numangle
;
if
(
!
getLinesKernel
.
run
(
2
,
globalThreads
,
NULL
,
false
))
return
false
;
...
...
modules/imgproc/src/opencl/hough_lines.cl
View file @
d59a6fa5
...
...
@@ -88,7 +88,7 @@ __kernel void fill_accum_local(__global const uchar * list_ptr, int list_step, i
__global
uchar
*
accum_ptr,
int
accum_step,
int
accum_offset,
int
accum_rows,
int
accum_cols,
int
total_points,
float
irho,
float
theta,
int
numrho,
int
numangle
)
{
int
theta_idx
=
get_g
lobal
_id
(
1
)
;
int
theta_idx
=
get_g
roup
_id
(
1
)
;
int
count_idx
=
get_local_id
(
0
)
;
if
(
theta_idx
>
0
&&
theta_idx
<
numangle
+
1
)
...
...
@@ -140,15 +140,18 @@ __kernel void get_lines(__global uchar * accum_ptr, int accum_step, int accum_of
__global
uchar
*
lines_ptr,
int
lines_step,
int
lines_offset,
__global
int*
lines_index_ptr,
int
linesMax,
int
threshold,
float
rho,
float
theta
)
{
int
x
=
get_global_id
(
0
)
;
int
x
0
=
get_global_id
(
0
)
;
int
y
=
get_global_id
(
1
)
;
int
gl_size
=
get_global_size
(
0
)
;
if
(
x
<
accum_cols-2
&&
y
<
accum_rows-2
)
if
(
y
<
accum_rows-2
)
{
__global
uchar*
accum
=
accum_ptr
+
mad24
(
y+1,
accum_step,
mad24
(
x+1,
(
int
)
sizeof
(
int
)
,
accum_offset
))
;
__global
uchar*
accum
=
accum_ptr
+
mad24
(
y+1,
accum_step,
mad24
(
x
0
+1,
(
int
)
sizeof
(
int
)
,
accum_offset
))
;
__global
float2*
lines
=
(
__global
float2*
)(
lines_ptr
+
lines_offset
)
;
__global
int*
lines_index
=
lines_index_ptr
+
1
;
for
(
int
x=x0
; x<accum_cols-2; x+=gl_size)
{
int
curVote
=
ACCUM
(
accum
)
;
if
(
curVote
>
threshold
&&
curVote
>
ACCUM
(
accum
-
sizeof
(
int
))
&&
curVote
>=
ACCUM
(
accum
+
sizeof
(
int
))
&&
...
...
@@ -164,8 +167,10 @@ __kernel void get_lines(__global uchar * accum_ptr, int accum_step, int accum_of
lines[index]
=
(
float2
)(
radius,
angle
)
;
}
}
accum
+=
gl_size
*
(
int
)
sizeof
(
int
)
;
}
}
}
#
endif
\ No newline at end of file
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