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
39b4bf18
Commit
39b4bf18
authored
Jan 31, 2013
by
Andrey Kamaev
Committed by
OpenCV Buildbot
Jan 31, 2013
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #390 from taka-no-me:fix_relative_error_check
parents
a8c014de
4f1913ed
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
18 deletions
+7
-18
ts_perf.cpp
modules/ts/src/ts_perf.cpp
+7
-18
No files found.
modules/ts/src/ts_perf.cpp
View file @
39b4bf18
...
...
@@ -334,29 +334,21 @@ void Regression::write(cv::Mat m)
write
()
<<
"val"
<<
getElem
(
m
,
y
,
x
,
cn
)
<<
"}"
;
}
static
double
evalEps
(
double
expected
,
double
actual
,
double
_eps
,
ERROR_TYPE
err
)
{
if
(
err
==
ERROR_ABSOLUTE
)
return
_eps
;
else
if
(
err
==
ERROR_RELATIVE
)
return
std
::
max
(
std
::
abs
(
expected
),
std
::
abs
(
actual
))
*
_eps
;
return
0
;
}
void
Regression
::
verify
(
cv
::
FileNode
node
,
cv
::
Mat
actual
,
double
_eps
,
std
::
string
argname
,
ERROR_TYPE
err
)
void
Regression
::
verify
(
cv
::
FileNode
node
,
cv
::
Mat
actual
,
double
eps
,
std
::
string
argname
,
ERROR_TYPE
err
)
{
if
(
!
actual
.
empty
()
&&
actual
.
dims
<
2
)
return
;
double
expect_min
=
(
double
)
node
[
"min"
];
double
expect_max
=
(
double
)
node
[
"max"
];
if
(
err
==
ERROR_RELATIVE
)
eps
*=
std
::
max
(
std
::
abs
(
expect_min
),
std
::
abs
(
expect_max
));
double
actual_min
,
actual_max
;
cv
::
minMaxIdx
(
actual
,
&
actual_min
,
&
actual_max
);
double
expect_min
=
(
double
)
node
[
"min"
];
double
eps
=
evalEps
(
expect_min
,
actual_min
,
_eps
,
err
);
ASSERT_NEAR
(
expect_min
,
actual_min
,
eps
)
<<
argname
<<
" has unexpected minimal value"
<<
std
::
endl
;
double
expect_max
=
(
double
)
node
[
"max"
];
eps
=
evalEps
(
expect_max
,
actual_max
,
_eps
,
err
);
ASSERT_NEAR
(
expect_max
,
actual_max
,
eps
)
<<
argname
<<
" has unexpected maximal value"
<<
std
::
endl
;
...
...
@@ -370,7 +362,6 @@ void Regression::verify(cv::FileNode node, cv::Mat actual, double _eps, std::str
<<
argname
<<
" has unexpected number of rows"
<<
std
::
endl
;
double
expect_last
=
(
double
)
last
[
"val"
];
eps
=
evalEps
(
expect_last
,
actual_last
,
_eps
,
err
);
ASSERT_NEAR
(
expect_last
,
actual_last
,
eps
)
<<
argname
<<
" has unexpected value of the last element"
<<
std
::
endl
;
...
...
@@ -384,7 +375,6 @@ void Regression::verify(cv::FileNode node, cv::Mat actual, double _eps, std::str
// verified that mat size is the same as recorded
double
actual_rng1
=
getElem
(
actual
,
y1
,
x1
,
cn1
);
eps
=
evalEps
(
expect_rng1
,
actual_rng1
,
_eps
,
err
);
ASSERT_NEAR
(
expect_rng1
,
actual_rng1
,
eps
)
<<
argname
<<
" has unexpected value of the ["
<<
x1
<<
":"
<<
y1
<<
":"
<<
cn1
<<
"] element"
<<
std
::
endl
;
...
...
@@ -396,7 +386,6 @@ void Regression::verify(cv::FileNode node, cv::Mat actual, double _eps, std::str
double
expect_rng2
=
(
double
)
rng2
[
"val"
];
double
actual_rng2
=
getElem
(
actual
,
y2
,
x2
,
cn2
);
eps
=
evalEps
(
expect_rng2
,
actual_rng2
,
_eps
,
err
);
ASSERT_NEAR
(
expect_rng2
,
actual_rng2
,
eps
)
<<
argname
<<
" has unexpected value of the ["
<<
x2
<<
":"
<<
y2
<<
":"
<<
cn2
<<
"] element"
<<
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