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
4248f822
Commit
4248f822
authored
Nov 08, 2013
by
Ilya Lavrenov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added ROI support to ocl::buildWarp*Maps functions
parent
0be27523
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
89 deletions
+60
-89
build_warps.cpp
modules/ocl/src/build_warps.cpp
+0
-0
build_warps.cl
modules/ocl/src/opencl/build_warps.cl
+60
-89
No files found.
modules/ocl/src/build_warps.cpp
View file @
4248f822
This diff is collapsed.
Click to expand it.
modules/ocl/src/opencl/build_warps.cl
View file @
4248f822
...
@@ -43,31 +43,25 @@
...
@@ -43,31 +43,25 @@
//
//
//M*/
//M*/
__kernel
__kernel
void
buildWarpPlaneMaps
(
__global
float
*
xmap,
__global
float
*
ymap,
void
buildWarpPlaneMaps
__constant
float
*
KRT,
(
int
tl_u,
int
tl_v,
__global
float
*
map_x,
int
cols,
int
rows,
__global
float
*
map_y,
int
xmap_step,
int
ymap_step,
__constant
float
*
KRT,
int
xmap_offset,
int
ymap_offset,
int
tl_u,
float
scale
)
int
tl_v,
int
cols,
int
rows,
int
step_x,
int
step_y,
float
scale
)
{
{
int
du
=
get_global_id
(
0
)
;
int
du
=
get_global_id
(
0
)
;
int
dv
=
get_global_id
(
1
)
;
int
dv
=
get_global_id
(
1
)
;
step_x
/=
sizeof
(
float
)
;
step_y
/=
sizeof
(
float
)
;
__constant
float
*
ck_rinv
=
KRT
;
__constant
float
*
ck_rinv
=
KRT
;
__constant
float
*
ct
=
KRT
+
9
;
__constant
float
*
ct
=
KRT
+
9
;
if
(
du
<
cols
&&
dv
<
rows
)
if
(
du
<
cols
&&
dv
<
rows
)
{
{
int
xmap_index
=
mad24
(
dv,
xmap_step,
xmap_offset
+
du
)
;
int
ymap_index
=
mad24
(
dv,
ymap_step,
ymap_offset
+
du
)
;
float
u
=
tl_u
+
du
;
float
u
=
tl_u
+
du
;
float
v
=
tl_v
+
dv
;
float
v
=
tl_v
+
dv
;
float
x,
y
;
float
x,
y
;
...
@@ -83,33 +77,27 @@ __kernel
...
@@ -83,33 +77,27 @@ __kernel
x
/=
z
;
x
/=
z
;
y
/=
z
;
y
/=
z
;
map_x[dv
*
step_x
+
du
]
=
x
;
xmap[xmap_index
]
=
x
;
map_y[dv
*
step_y
+
du
]
=
y
;
ymap[ymap_index
]
=
y
;
}
}
}
}
__kernel
__kernel
void
buildWarpCylindricalMaps
(
__global
float
*
xmap,
__global
float
*
ymap,
void
buildWarpCylindricalMaps
__constant
float
*
ck_rinv,
(
int
tl_u,
int
tl_v,
__global
float
*
map_x,
int
cols,
int
rows,
__global
float
*
map_y,
int
xmap_step,
int
ymap_step,
__constant
float
*
ck_rinv,
int
xmap_offset,
int
ymap_offset,
int
tl_u,
float
scale
)
int
tl_v,
int
cols,
int
rows,
int
step_x,
int
step_y,
float
scale
)
{
{
int
du
=
get_global_id
(
0
)
;
int
du
=
get_global_id
(
0
)
;
int
dv
=
get_global_id
(
1
)
;
int
dv
=
get_global_id
(
1
)
;
step_x
/=
sizeof
(
float
)
;
step_y
/=
sizeof
(
float
)
;
if
(
du
<
cols
&&
dv
<
rows
)
if
(
du
<
cols
&&
dv
<
rows
)
{
{
int
xmap_index
=
mad24
(
dv,
xmap_step,
xmap_offset
+
du
)
;
int
ymap_index
=
mad24
(
dv,
ymap_step,
ymap_offset
+
du
)
;
float
u
=
tl_u
+
du
;
float
u
=
tl_u
+
du
;
float
v
=
tl_v
+
dv
;
float
v
=
tl_v
+
dv
;
float
x,
y
;
float
x,
y
;
...
@@ -127,33 +115,27 @@ __kernel
...
@@ -127,33 +115,27 @@ __kernel
if
(
z
>
0
)
{
x
/=
z
; y /= z; }
if
(
z
>
0
)
{
x
/=
z
; y /= z; }
else
x
=
y
=
-1
;
else
x
=
y
=
-1
;
map_x[dv
*
step_x
+
du
]
=
x
;
xmap[xmap_index
]
=
x
;
map_y[dv
*
step_y
+
du
]
=
y
;
ymap[ymap_index
]
=
y
;
}
}
}
}
__kernel
__kernel
void
buildWarpSphericalMaps
(
__global
float
*
xmap,
__global
float
*
ymap,
void
buildWarpSphericalMaps
__constant
float
*
ck_rinv,
(
int
tl_u,
int
tl_v,
__global
float
*
map_x,
int
cols,
int
rows,
__global
float
*
map_y,
int
xmap_step,
int
ymap_step,
__constant
float
*
ck_rinv,
int
xmap_offset,
int
ymap_offset,
int
tl_u,
float
scale
)
int
tl_v,
int
cols,
int
rows,
int
step_x,
int
step_y,
float
scale
)
{
{
int
du
=
get_global_id
(
0
)
;
int
du
=
get_global_id
(
0
)
;
int
dv
=
get_global_id
(
1
)
;
int
dv
=
get_global_id
(
1
)
;
step_x
/=
sizeof
(
float
)
;
step_y
/=
sizeof
(
float
)
;
if
(
du
<
cols
&&
dv
<
rows
)
if
(
du
<
cols
&&
dv
<
rows
)
{
{
int
xmap_index
=
mad24
(
dv,
xmap_step,
xmap_offset
+
du
)
;
int
ymap_index
=
mad24
(
dv,
ymap_step,
ymap_offset
+
du
)
;
float
u
=
tl_u
+
du
;
float
u
=
tl_u
+
du
;
float
v
=
tl_v
+
dv
;
float
v
=
tl_v
+
dv
;
float
x,
y
;
float
x,
y
;
...
@@ -174,63 +156,52 @@ __kernel
...
@@ -174,63 +156,52 @@ __kernel
if
(
z
>
0
)
{
x
/=
z
; y /= z; }
if
(
z
>
0
)
{
x
/=
z
; y /= z; }
else
x
=
y
=
-1
;
else
x
=
y
=
-1
;
map_x[dv
*
step_x
+
du
]
=
x
;
xmap[xmap_index
]
=
x
;
map_y[dv
*
step_y
+
du
]
=
y
;
ymap[ymap_index
]
=
y
;
}
}
}
}
__kernel
__kernel
void
buildWarpAffineMaps
(
__global
float
*
xmap,
__global
float
*
ymap,
void
buildWarpAffineMaps
__constant
float
*
c_warpMat,
(
int
cols,
int
rows,
__global
float
*
xmap,
int
xmap_step,
int
ymap_step,
__global
float
*
ymap,
int
xmap_offset,
int
ymap_offset
)
__constant
float
*
c_warpMat,
int
cols,
int
rows,
int
step_x,
int
step_y
)
{
{
int
x
=
get_global_id
(
0
)
;
int
x
=
get_global_id
(
0
)
;
int
y
=
get_global_id
(
1
)
;
int
y
=
get_global_id
(
1
)
;
step_x
/=
sizeof
(
float
)
;
step_y
/=
sizeof
(
float
)
;
if
(
x
<
cols
&&
y
<
rows
)
if
(
x
<
cols
&&
y
<
rows
)
{
{
const
float
xcoo
=
c_warpMat[0]
*
x
+
c_warpMat[1]
*
y
+
c_warpMat[2]
;
int
xmap_index
=
mad24
(
y,
xmap_step,
x
+
xmap_offset
)
;
const
float
ycoo
=
c_warpMat[3]
*
x
+
c_warpMat[4]
*
y
+
c_warpMat[5]
;
int
ymap_index
=
mad24
(
y,
ymap_step,
x
+
ymap_offset
)
;
float
xcoo
=
c_warpMat[0]
*
x
+
c_warpMat[1]
*
y
+
c_warpMat[2]
;
float
ycoo
=
c_warpMat[3]
*
x
+
c_warpMat[4]
*
y
+
c_warpMat[5]
;
map_x[y
*
step_x
+
x]
=
xcoo
;
xmap[xmap_inde
x]
=
xcoo
;
map_y[y
*
step_y
+
x]
=
ycoo
;
ymap[ymap_inde
x]
=
ycoo
;
}
}
}
}
__kernel
__kernel
void
buildWarpPerspectiveMaps
(
__global
float
*
xmap,
__global
float
*
ymap,
void
buildWarpPerspectiveMaps
__constant
float
*
c_warpMat,
(
int
cols,
int
rows,
__global
float
*
xmap,
int
xmap_step,
int
ymap_step,
__global
float
*
ymap,
int
xmap_offset,
int
ymap_offset
)
__constant
float
*
c_warpMat,
int
cols,
int
rows,
int
step_x,
int
step_y
)
{
{
int
x
=
get_global_id
(
0
)
;
int
x
=
get_global_id
(
0
)
;
int
y
=
get_global_id
(
1
)
;
int
y
=
get_global_id
(
1
)
;
step_x
/=
sizeof
(
float
)
;
step_y
/=
sizeof
(
float
)
;
if
(
x
<
cols
&&
y
<
rows
)
if
(
x
<
cols
&&
y
<
rows
)
{
{
const
float
coeff
=
1.0f
/
(
c_warpMat[6]
*
x
+
c_warpMat[7]
*
y
+
c_warpMat[8]
)
;
int
xmap_index
=
mad24
(
y,
xmap_step,
x
+
xmap_offset
)
;
int
ymap_index
=
mad24
(
y,
ymap_step,
x
+
ymap_offset
)
;
const
float
xcoo
=
coeff
*
(
c_warpMat[0]
*
x
+
c_warpMat[1]
*
y
+
c_warpMat[2]
)
;
float
coeff
=
1.0f
/
(
c_warpMat[6]
*
x
+
c_warpMat[7]
*
y
+
c_warpMat[8]
)
;
const
float
ycoo
=
coeff
*
(
c_warpMat[3]
*
x
+
c_warpMat[4]
*
y
+
c_warpMat[5]
)
;
float
xcoo
=
coeff
*
(
c_warpMat[0]
*
x
+
c_warpMat[1]
*
y
+
c_warpMat[2]
)
;
float
ycoo
=
coeff
*
(
c_warpMat[3]
*
x
+
c_warpMat[4]
*
y
+
c_warpMat[5]
)
;
map_x[y
*
step_x
+
x]
=
xcoo
;
xmap[xmap_inde
x]
=
xcoo
;
map_y[y
*
step_y
+
x]
=
ycoo
;
ymap[ymap_inde
x]
=
ycoo
;
}
}
}
}
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