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
f368b27f
Commit
f368b27f
authored
Mar 21, 2014
by
Andrey Pavlenko
Committed by
OpenCV Buildbot
Mar 21, 2014
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2489 from vbystricky:iocl_pyrlk
parents
8ac93f9b
6890aa00
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
46 deletions
+2
-46
lkpyramid.cpp
modules/video/src/lkpyramid.cpp
+0
-2
pyrlk.cl
modules/video/src/opencl/pyrlk.cl
+2
-44
No files found.
modules/video/src/lkpyramid.cpp
View file @
f368b27f
...
...
@@ -975,9 +975,7 @@ namespace cv
idxArg
=
kernel
.
set
(
idxArg
,
imageI
);
//image2d_t I
idxArg
=
kernel
.
set
(
idxArg
,
imageJ
);
//image2d_t J
idxArg
=
kernel
.
set
(
idxArg
,
ocl
::
KernelArg
::
PtrReadOnly
(
prevPts
));
// __global const float2* prevPts
idxArg
=
kernel
.
set
(
idxArg
,
(
int
)
prevPts
.
step
);
// int prevPtsStep
idxArg
=
kernel
.
set
(
idxArg
,
ocl
::
KernelArg
::
PtrReadWrite
(
nextPts
));
// __global const float2* nextPts
idxArg
=
kernel
.
set
(
idxArg
,
(
int
)
nextPts
.
step
);
// int nextPtsStep
idxArg
=
kernel
.
set
(
idxArg
,
ocl
::
KernelArg
::
PtrReadWrite
(
status
));
// __global uchar* status
idxArg
=
kernel
.
set
(
idxArg
,
ocl
::
KernelArg
::
PtrReadWrite
(
err
));
// __global float* err
idxArg
=
kernel
.
set
(
idxArg
,
(
int
)
level
);
// const int level
...
...
modules/video/src/opencl/pyrlk.cl
View file @
f368b27f
...
...
@@ -262,50 +262,9 @@ inline void GetError(image2d_t J, const float x, const float y, const float* Pch
*errval
+=
fabs
(
diff
)
;
}
inline
void
SetPatch4
(
image2d_t
I,
const
float
x,
const
float
y,
float4*
Pch,
float4*
Dx,
float4*
Dy,
float*
A11,
float*
A12,
float*
A22
)
{
*Pch
=
read_imagef
(
I,
sampler,
(
float2
)(
x,
y
))
;
float4
dIdx
=
3.0f
*
read_imagef
(
I,
sampler,
(
float2
)(
x
+
1
,
y
-
1
))
+
10.0f
*
read_imagef
(
I,
sampler,
(
float2
)(
x
+
1
,
y
))
+
3.0f
*
read_imagef
(
I,
sampler,
(
float2
)(
x
+
1
,
y
+
1
))
-
(
3.0f
*
read_imagef
(
I,
sampler,
(
float2
)(
x
-
1
,
y
-
1
))
+
10.0f
*
read_imagef
(
I,
sampler,
(
float2
)(
x
-
1
,
y
))
+
3.0f
*
read_imagef
(
I,
sampler,
(
float2
)(
x
-
1
,
y
+
1
)))
;
float4
dIdy
=
3.0f
*
read_imagef
(
I,
sampler,
(
float2
)(
x
-
1
,
y
+
1
))
+
10.0f
*
read_imagef
(
I,
sampler,
(
float2
)(
x,
y
+
1
))
+
3.0f
*
read_imagef
(
I,
sampler,
(
float2
)(
x
+
1
,
y
+
1
))
-
(
3.0f
*
read_imagef
(
I,
sampler,
(
float2
)(
x
-
1
,
y
-
1
))
+
10.0f
*
read_imagef
(
I,
sampler,
(
float2
)(
x,
y
-
1
))
+
3.0f
*
read_imagef
(
I,
sampler,
(
float2
)(
x
+
1
,
y
-
1
)))
;
*Dx
=
dIdx
;
*Dy
=
dIdy
;
float4
sqIdx
=
dIdx
*
dIdx
;
*A11
+=
sqIdx.x
+
sqIdx.y
+
sqIdx.z
;
sqIdx
=
dIdx
*
dIdy
;
*A12
+=
sqIdx.x
+
sqIdx.y
+
sqIdx.z
;
sqIdx
=
dIdy
*
dIdy
;
*A22
+=
sqIdx.x
+
sqIdx.y
+
sqIdx.z
;
}
inline
void
GetPatch4
(
image2d_t
J,
const
float
x,
const
float
y,
const
float4*
Pch,
const
float4*
Dx,
const
float4*
Dy,
float*
b1,
float*
b2
)
{
float4
J_val
=
read_imagef
(
J,
sampler,
(
float2
)(
x,
y
))
;
float4
diff
=
(
J_val
-
*Pch
)
*
32.0f
;
float4
xdiff
=
diff*
*Dx
;
*b1
+=
xdiff.x
+
xdiff.y
+
xdiff.z
;
xdiff
=
diff*
*Dy
;
*b2
+=
xdiff.x
+
xdiff.y
+
xdiff.z
;
}
inline
void
GetError4
(
image2d_t
J,
const
float
x,
const
float
y,
const
float4*
Pch,
float*
errval
)
{
float4
diff
=
read_imagef
(
J,
sampler,
(
float2
)(
x,y
))
-*Pch
;
*errval
+=
fabs
(
diff.x
)
+
fabs
(
diff.y
)
+
fabs
(
diff.z
)
;
}
#
define
GRIDSIZE
3
__kernel
void
lkSparse
(
image2d_t
I,
image2d_t
J,
__global
const
float2*
prevPts,
int
prevPtsStep,
__global
float2*
nextPts,
int
nextPtsStep
,
__global
uchar*
status,
__global
float*
err,
__global
const
float2*
prevPts,
__global
float2*
nextPts
,
__global
uchar*
status,
__global
float*
err,
const
int
level,
const
int
rows,
const
int
cols,
int
PATCH_X,
int
PATCH_Y,
int
c_winSize_x,
int
c_winSize_y,
int
c_iters,
char
calcErr
)
{
__local
float
smem1[BUFFER]
;
...
...
@@ -434,9 +393,8 @@ __kernel void lkSparse(image2d_t I, image2d_t J,
{
if
(
tid
==
0
&&
level
==
0
)
status[gid]
=
0
;
return
;
break
;
}
float
b1
=
0
;
float
b2
=
0
;
...
...
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