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
8d662a1a
Commit
8d662a1a
authored
8 years ago
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7640 from alalek:fix_test_tvl1
parents
8151be9a
45bf60d1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
17 deletions
+21
-17
perf_tvl1optflow.cpp
modules/video/perf/perf_tvl1optflow.cpp
+2
-2
test_tvl1optflow.cpp
modules/video/test/test_tvl1optflow.cpp
+19
-15
No files found.
modules/video/perf/perf_tvl1optflow.cpp
View file @
8d662a1a
...
...
@@ -24,7 +24,7 @@ PERF_TEST_P(ImagePair, OpticalFlowDual_TVL1, testing::Values(impair("cv/optflow/
Ptr
<
DenseOpticalFlow
>
tvl1
=
createOptFlow_DualTVL1
();
TEST_CYCLE
_N
(
10
)
tvl1
->
calc
(
frame1
,
frame2
,
flow
);
TEST_CYCLE
(
)
tvl1
->
calc
(
frame1
,
frame2
,
flow
);
SANITY_CHECK
(
flow
,
0.8
);
SANITY_CHECK
_NOTHING
(
);
}
This diff is collapsed.
Click to expand it.
modules/video/test/test_tvl1optflow.cpp
View file @
8d662a1a
...
...
@@ -116,34 +116,39 @@ namespace
return
!
cvIsNaN
(
u
.
x
)
&&
!
cvIsNaN
(
u
.
y
)
&&
(
fabs
(
u
.
x
)
<
1e9
)
&&
(
fabs
(
u
.
y
)
<
1e9
);
}
double
calcRMSE
(
const
Mat_
<
Point2f
>&
flow1
,
const
Mat_
<
Point2f
>&
flow2
)
void
check
(
const
Mat_
<
Point2f
>&
gold
,
const
Mat_
<
Point2f
>&
flow
,
double
threshold
=
0.1
,
double
expectedAccuracy
=
0.95
)
{
double
sum
=
0.0
;
int
counter
=
0
;
threshold
=
threshold
*
threshold
;
for
(
int
i
=
0
;
i
<
flow1
.
rows
;
++
i
)
size_t
gold_counter
=
0
;
size_t
valid_counter
=
0
;
for
(
int
i
=
0
;
i
<
gold
.
rows
;
++
i
)
{
for
(
int
j
=
0
;
j
<
flow1
.
cols
;
++
j
)
for
(
int
j
=
0
;
j
<
gold
.
cols
;
++
j
)
{
const
Point2f
u1
=
flow1
(
i
,
j
);
const
Point2f
u2
=
flow
2
(
i
,
j
);
const
Point2f
u1
=
gold
(
i
,
j
);
const
Point2f
u2
=
flow
(
i
,
j
);
if
(
isFlowCorrect
(
u1
)
&&
isFlowCorrect
(
u2
))
if
(
isFlowCorrect
(
u1
))
{
gold_counter
++
;
if
(
isFlowCorrect
(
u2
))
{
const
Point2f
diff
=
u1
-
u2
;
sum
+=
diff
.
ddot
(
diff
);
++
counter
;
double
err
=
diff
.
ddot
(
diff
);
if
(
err
<=
threshold
)
valid_counter
++
;
}
}
}
return
sqrt
(
sum
/
(
1e-9
+
counter
));
}
EXPECT_GE
(
valid_counter
,
expectedAccuracy
*
gold_counter
);
}
}
TEST
(
Video_calcOpticalFlowDual_TVL1
,
Regression
)
{
const
double
MAX_RMSE
=
0.03
;
const
string
frame1_path
=
TS
::
ptr
()
->
get_data_path
()
+
"optflow/RubberWhale1.png"
;
const
string
frame2_path
=
TS
::
ptr
()
->
get_data_path
()
+
"optflow/RubberWhale2.png"
;
const
string
gold_flow_path
=
TS
::
ptr
()
->
get_data_path
()
+
"optflow/tvl1_flow.flo"
;
...
...
@@ -167,7 +172,6 @@ TEST(Video_calcOpticalFlowDual_TVL1, Regression)
ASSERT_EQ
(
gold
.
rows
,
flow
.
rows
);
ASSERT_EQ
(
gold
.
cols
,
flow
.
cols
);
double
err
=
calcRMSE
(
gold
,
flow
);
EXPECT_LE
(
err
,
MAX_RMSE
);
check
(
gold
,
flow
);
#endif
}
This diff is collapsed.
Click to expand it.
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