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
06b0fe35
Commit
06b0fe35
authored
May 04, 2017
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8609 from LukeZheZhu:pyrlk_err_ocl_fix
parents
833832ac
65be9e19
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
2 deletions
+17
-2
lkpyramid.cpp
modules/video/src/lkpyramid.cpp
+3
-0
pyrlk.cl
modules/video/src/opencl/pyrlk.cl
+2
-2
test_optflowpyrlk.cpp
modules/video/test/ocl/test_optflowpyrlk.cpp
+12
-0
No files found.
modules/video/src/lkpyramid.cpp
View file @
06b0fe35
...
...
@@ -849,6 +849,9 @@ namespace
return
false
;
if
(
maxLevel
<
0
||
winSize
.
width
<=
2
||
winSize
.
height
<=
2
)
return
false
;
if
(
winSize
.
width
<
16
||
winSize
.
height
<
16
||
winSize
.
width
>
24
||
winSize
.
height
>
24
)
return
false
;
calcPatchSize
();
if
(
patch
.
x
<=
0
||
patch
.
x
>=
6
||
patch
.
y
<=
0
||
patch
.
y
>=
6
)
return
false
;
...
...
modules/video/src/opencl/pyrlk.cl
View file @
06b0fe35
...
...
@@ -260,7 +260,7 @@ inline void GetPatch(image2d_t J, float x, float y,
inline
void
GetError
(
image2d_t
J,
const
float
x,
const
float
y,
const
float*
Pch,
float*
errval
)
{
float
diff
=
read_imagef
(
J,
sampler,
(
float2
)(
x,y
))
.
x-*Pch
;
float
diff
=
(((
read_imagef
(
J,
sampler,
(
float2
)(
x,y
))
.
x
*
16384
)
+
256
)
/
512
)
-
(((
*Pch
*
16384
)
+
256
)
/512
)
;
*errval
+=
fabs
(
diff
)
;
}
...
...
@@ -526,6 +526,6 @@ __kernel void lkSparse(image2d_t I, image2d_t J,
nextPts[gid]
=
prevPt
;
if
(
calcErr
)
err[gid]
=
smem1[0]
/
(
float
)(
c_winSize_x
*
c_winSize_y
)
;
err[gid]
=
smem1[0]
/
(
float
)(
32
*
c_winSize_x
*
c_winSize_y
)
;
}
}
modules/video/test/ocl/test_optflowpyrlk.cpp
View file @
06b0fe35
...
...
@@ -77,6 +77,7 @@ OCL_TEST_P(PyrLKOpticalFlow, Mat)
{
static
const
int
npoints
=
1000
;
static
const
float
eps
=
0.03
f
;
static
const
float
erreps
=
0.1
f
;
cv
::
Mat
frame0
=
readImage
(
"optflow/RubberWhale1.png"
,
cv
::
IMREAD_GRAYSCALE
);
ASSERT_FALSE
(
frame0
.
empty
());
...
...
@@ -104,6 +105,8 @@ OCL_TEST_P(PyrLKOpticalFlow, Mat)
ASSERT_EQ
(
cpuStatusCPU
.
size
(),
status
.
size
());
size_t
mistmatch
=
0
;
size_t
errmatch
=
0
;
for
(
size_t
i
=
0
;
i
<
nextPts
.
size
();
++
i
)
{
if
(
status
[
i
]
!=
cpuStatusCPU
[
i
])
...
...
@@ -121,13 +124,22 @@ OCL_TEST_P(PyrLKOpticalFlow, Mat)
float
errdiff
=
0.0
f
;
if
(
!
eq
||
errdiff
>
1e-1
)
{
++
mistmatch
;
continue
;
}
eq
=
std
::
abs
(
cpuErr
[
i
]
-
err
[
i
])
<
0.01
;
if
(
!
eq
)
++
errmatch
;
}
}
double
bad_ratio
=
static_cast
<
double
>
(
mistmatch
)
/
(
nextPts
.
size
());
double
err_ratio
=
static_cast
<
double
>
(
errmatch
)
/
(
nextPts
.
size
());
ASSERT_LE
(
bad_ratio
,
eps
);
ASSERT_LE
(
err_ratio
,
erreps
);
}
OCL_INSTANTIATE_TEST_CASE_P
(
Video
,
PyrLKOpticalFlow
,
...
...
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