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
f566f6ba
Commit
f566f6ba
authored
Jan 13, 2015
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3535 from wangyan42164:use_hypot
parents
2ecca8f5
9699fde8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
19 deletions
+16
-19
objdetect_hog.cl
modules/objdetect/src/opencl/objdetect_hog.cl
+16
-19
No files found.
modules/objdetect/src/opencl/objdetect_hog.cl
View file @
f566f6ba
...
...
@@ -48,7 +48,7 @@
#
define
CELLS_PER_BLOCK_X
2
#
define
CELLS_PER_BLOCK_Y
2
#
define
NTHREADS
256
#
define
CV_PI_F
3.1415926535897932384626433832795f
#
define
CV_PI_F
M_PI_F
#
ifdef
INTEL_DEVICE
#
define
QANGLE_TYPE
int
...
...
@@ -606,23 +606,23 @@ __kernel void compute_gradients_8UC4_kernel(
barrier
(
CLK_LOCAL_MEM_FENCE
)
;
if
(
x
<
width
)
{
float
3
a
=
(
float3
)
(
sh_row[tid],
sh_row[tid
+
(
NTHREADS
+
2
)
],
sh_row[tid
+
2
*
(
NTHREADS
+
2
)
]
)
;
float
3
b
=
(
float3
)
(
sh_row[tid
+
2],
sh_row[tid
+
2
+
(
NTHREADS
+
2
)
],
sh_row[tid
+
2
+
2
*
(
NTHREADS
+
2
)
]
)
;
float
4
a
=
(
float4
)
(
sh_row[tid],
sh_row[tid
+
(
NTHREADS
+
2
)
],
sh_row[tid
+
2
*
(
NTHREADS
+
2
)
]
,
0
)
;
float
4
b
=
(
float4
)
(
sh_row[tid
+
2],
sh_row[tid
+
2
+
(
NTHREADS
+
2
)
],
sh_row[tid
+
2
+
2
*
(
NTHREADS
+
2
)
]
,
0
)
;
float
3
dx
;
float
4
dx
;
if
(
correct_gamma
==
1
)
dx
=
sqrt
(
b
)
-
sqrt
(
a
)
;
else
dx
=
b
-
a
;
float
3
dy
=
(
float3
)
0.f
;
float
4
dy
=
(
float4
)
0.f
;
if
(
gidY
>
0
&&
gidY
<
height
-
1
)
{
a
=
convert_float
3
(
img[
(
gidY
-
1
)
*
img_step
+
x].xyz
)
;
b
=
convert_float
3
(
img[
(
gidY
+
1
)
*
img_step
+
x].xyz
)
;
a
=
convert_float
4
(
img[
(
gidY
-
1
)
*
img_step
+
x].xyzw
)
;
b
=
convert_float
4
(
img[
(
gidY
+
1
)
*
img_step
+
x].xyzw
)
;
if
(
correct_gamma
==
1
)
dy
=
sqrt
(
b
)
-
sqrt
(
a
)
;
...
...
@@ -630,28 +630,25 @@ __kernel void compute_gradients_8UC4_kernel(
dy
=
b
-
a
;
}
float4
mag
=
hypot
(
dx,
dy
)
;
float
best_dx
=
dx.x
;
float
best_dy
=
dy.x
;
float
mag0
=
dx.x
*
dx.x
+
dy.x
*
dy.x
;
float
mag1
=
dx.y
*
dx.y
+
dy.y
*
dy.y
;
if
(
mag0
<
mag1
)
float
mag0
=
mag.x
;
if
(
mag0
<
mag.y
)
{
best_dx
=
dx.y
;
best_dy
=
dy.y
;
mag0
=
mag
1
;
mag0
=
mag
.y
;
}
mag1
=
dx.z
*
dx.z
+
dy.z
*
dy.z
;
if
(
mag0
<
mag1
)
if
(
mag0
<
mag.z
)
{
best_dx
=
dx.z
;
best_dy
=
dy.z
;
mag0
=
mag
1
;
mag0
=
mag
.z
;
}
mag0
=
sqrt
(
mag0
)
;
float
ang
=
(
atan2
(
best_dy,
best_dx
)
+
CV_PI_F
)
*
angle_scale
-
0.5f
;
int
hidx
=
(
int
)
floor
(
ang
)
;
ang
-=
hidx
;
...
...
@@ -710,7 +707,7 @@ __kernel void compute_gradients_8UC1_kernel(
else
dy
=
a
-
b
;
}
float
mag
=
sqrt
(
dx
*
dx
+
dy
*
dy
)
;
float
mag
=
hypot
(
dx,
dy
)
;
float
ang
=
(
atan2
(
dy,
dx
)
+
CV_PI_F
)
*
angle_scale
-
0.5f
;
int
hidx
=
(
int
)
floor
(
ang
)
;
...
...
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