Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv_contrib
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_contrib
Commits
3442a8de
Commit
3442a8de
authored
Jul 24, 2017
by
Vladislav Samsonov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle incorrect flow vectors in gpc_evaluate; fixes opencv/opencv#9183
parent
617db6c4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
gpc_evaluate.cpp
modules/optflow/samples/gpc_evaluate.cpp
+13
-3
No files found.
modules/optflow/samples/gpc_evaluate.cpp
View file @
3442a8de
...
...
@@ -114,6 +114,7 @@ int main( int argc, const char **argv )
std
::
cout
<<
"Found "
<<
corr
.
size
()
<<
" matches."
<<
std
::
endl
;
std
::
cout
<<
"Time: "
<<
meter
.
getTimeSec
()
<<
" sec."
<<
std
::
endl
;
double
error
=
0
;
int
totalCorrectFlowVectors
=
0
;
Mat
dispErr
=
Mat
::
zeros
(
from
.
size
(),
CV_32FC3
);
dispErr
=
Scalar
(
0
,
0
,
1
);
Mat
disp
=
Mat
::
zeros
(
from
.
size
(),
CV_32FC3
);
...
...
@@ -123,13 +124,22 @@ int main( int argc, const char **argv )
{
const
Point2f
a
=
corr
[
i
].
first
;
const
Point2f
b
=
corr
[
i
].
second
;
const
Point2f
c
=
a
+
gt
.
at
<
Point2f
>
(
corr
[
i
].
first
.
y
,
corr
[
i
].
first
.
x
);
const
Point2f
gtDisplacement
=
gt
.
at
<
Point2f
>
(
corr
[
i
].
first
.
y
,
corr
[
i
].
first
.
x
);
// Check that flow vector is correct
if
(
!
cvIsNaN
(
gtDisplacement
.
x
)
&&
!
cvIsNaN
(
gtDisplacement
.
y
)
&&
gtDisplacement
.
x
<
1e9
&&
gtDisplacement
.
y
<
1e9
)
{
const
Point2f
c
=
a
+
gtDisplacement
;
error
+=
normL2
(
b
-
c
);
circle
(
disp
,
a
,
3
,
getFlowColor
(
b
-
a
),
-
1
);
circle
(
dispErr
,
a
,
3
,
getFlowColor
(
b
-
c
,
false
,
32
),
-
1
);
++
totalCorrectFlowVectors
;
}
circle
(
disp
,
a
,
3
,
getFlowColor
(
b
-
a
),
-
1
);
}
error
/=
corr
.
size
();
if
(
totalCorrectFlowVectors
)
error
/=
totalCorrectFlowVectors
;
std
::
cout
<<
"Average endpoint error: "
<<
error
<<
" px."
<<
std
::
endl
;
...
...
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