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
c146c54b
Commit
c146c54b
authored
Oct 09, 2012
by
Andrey Kamaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix sanity checks for empty objects
parent
f8672d49
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
38 deletions
+62
-38
ts_perf.cpp
modules/ts/src/ts_perf.cpp
+62
-38
No files found.
modules/ts/src/ts_perf.cpp
View file @
c146c54b
...
@@ -392,30 +392,42 @@ void Regression::verify(cv::FileNode node, cv::InputArray array, double eps, ERR
...
@@ -392,30 +392,42 @@ void Regression::verify(cv::FileNode node, cv::InputArray array, double eps, ERR
cv
::
Mat
expected
;
cv
::
Mat
expected
;
valnode
>>
expected
;
valnode
>>
expected
;
ASSERT_EQ
(
expected
.
size
(),
actual
.
size
())
if
(
expected
.
empty
())
<<
" "
<<
node
.
name
()
<<
"["
<<
idx
<<
"] has unexpected size"
;
{
ASSERT_TRUE
(
actual
.
empty
())
<<
" expected empty "
<<
node
.
name
()
<<
"["
<<
idx
<<
"]"
;
}
else
{
ASSERT_EQ
(
expected
.
size
(),
actual
.
size
())
<<
" "
<<
node
.
name
()
<<
"["
<<
idx
<<
"] has unexpected size"
;
cv
::
Mat
diff
;
cv
::
Mat
diff
;
cv
::
absdiff
(
expected
,
actual
,
diff
);
cv
::
absdiff
(
expected
,
actual
,
diff
);
if
(
err
==
ERROR_ABSOLUTE
)
if
(
err
==
ERROR_ABSOLUTE
)
{
if
(
!
cv
::
checkRange
(
diff
,
true
,
0
,
0
,
eps
))
{
{
double
max
;
if
(
!
cv
::
checkRange
(
diff
,
true
,
0
,
0
,
eps
))
cv
::
minMaxLoc
(
diff
.
reshape
(
1
),
0
,
&
max
);
{
FAIL
()
<<
" Absolute difference (="
<<
max
<<
") between argument
\"
"
if
(
expected
.
total
()
*
expected
.
channels
()
<
12
)
<<
node
.
name
()
<<
"["
<<
idx
<<
"]
\"
and expected value is bugger than "
<<
eps
;
std
::
cout
<<
" Expected: "
<<
std
::
endl
<<
expected
<<
std
::
endl
<<
" Actual:"
<<
std
::
endl
<<
actual
<<
std
::
endl
;
double
max
;
cv
::
minMaxLoc
(
diff
.
reshape
(
1
),
0
,
&
max
);
FAIL
()
<<
" Absolute difference (="
<<
max
<<
") between argument
\"
"
<<
node
.
name
()
<<
"["
<<
idx
<<
"]
\"
and expected value is bugger than "
<<
eps
;
}
}
}
}
else
if
(
err
==
ERROR_RELATIVE
)
else
if
(
err
==
ERROR_RELATIVE
)
{
double
maxv
,
maxa
;
int
violations
=
countViolations
(
expected
,
actual
,
diff
,
eps
,
&
maxv
,
&
maxa
);
if
(
violations
>
0
)
{
{
FAIL
()
<<
" Relative difference ("
<<
maxv
<<
" of "
<<
maxa
<<
" allowed) between argument
\"
"
double
maxv
,
maxa
;
<<
node
.
name
()
<<
"["
<<
idx
<<
"]
\"
and expected value is bugger than "
<<
eps
<<
" in "
<<
violations
<<
" points"
;
int
violations
=
countViolations
(
expected
,
actual
,
diff
,
eps
,
&
maxv
,
&
maxa
);
if
(
violations
>
0
)
{
FAIL
()
<<
" Relative difference ("
<<
maxv
<<
" of "
<<
maxa
<<
" allowed) between argument
\"
"
<<
node
.
name
()
<<
"["
<<
idx
<<
"]
\"
and expected value is bugger than "
<<
eps
<<
" in "
<<
violations
<<
" points"
;
}
}
}
}
}
}
}
...
@@ -434,30 +446,42 @@ void Regression::verify(cv::FileNode node, cv::InputArray array, double eps, ERR
...
@@ -434,30 +446,42 @@ void Regression::verify(cv::FileNode node, cv::InputArray array, double eps, ERR
valnode
>>
expected
;
valnode
>>
expected
;
cv
::
Mat
actual
=
array
.
getMat
();
cv
::
Mat
actual
=
array
.
getMat
();
ASSERT_EQ
(
expected
.
size
(),
actual
.
size
())
if
(
expected
.
empty
())
<<
" Argument
\"
"
<<
node
.
name
()
<<
"
\"
has unexpected size"
;
{
ASSERT_TRUE
(
actual
.
empty
())
<<
" expected empty "
<<
node
.
name
();
}
else
{
ASSERT_EQ
(
expected
.
size
(),
actual
.
size
())
<<
" Argument
\"
"
<<
node
.
name
()
<<
"
\"
has unexpected size"
;
cv
::
Mat
diff
;
cv
::
Mat
diff
;
cv
::
absdiff
(
expected
,
actual
,
diff
);
cv
::
absdiff
(
expected
,
actual
,
diff
);
if
(
err
==
ERROR_ABSOLUTE
)
if
(
err
==
ERROR_ABSOLUTE
)
{
if
(
!
cv
::
checkRange
(
diff
,
true
,
0
,
0
,
eps
))
{
{
double
max
;
if
(
!
cv
::
checkRange
(
diff
,
true
,
0
,
0
,
eps
))
cv
::
minMaxLoc
(
diff
.
reshape
(
1
),
0
,
&
max
);
{
FAIL
()
<<
" Difference (="
<<
max
<<
") between argument
\"
"
<<
node
.
name
()
if
(
expected
.
total
()
*
expected
.
channels
()
<
12
)
<<
"
\"
and expected value is bugger than "
<<
eps
;
std
::
cout
<<
" Expected: "
<<
std
::
endl
<<
expected
<<
std
::
endl
<<
" Actual:"
<<
std
::
endl
<<
actual
<<
std
::
endl
;
double
max
;
cv
::
minMaxLoc
(
diff
.
reshape
(
1
),
0
,
&
max
);
FAIL
()
<<
" Difference (="
<<
max
<<
") between argument1
\"
"
<<
node
.
name
()
<<
"
\"
and expected value is bugger than "
<<
eps
;
}
}
}
}
else
if
(
err
==
ERROR_RELATIVE
)
else
if
(
err
==
ERROR_RELATIVE
)
{
double
maxv
,
maxa
;
int
violations
=
countViolations
(
expected
,
actual
,
diff
,
eps
,
&
maxv
,
&
maxa
);
if
(
violations
>
0
)
{
{
FAIL
()
<<
" Relative difference ("
<<
maxv
<<
" of "
<<
maxa
<<
" allowed) between argument
\"
"
<<
node
.
name
()
double
maxv
,
maxa
;
<<
"
\"
and expected value is bugger than "
<<
eps
<<
" in "
<<
violations
<<
" points"
;
int
violations
=
countViolations
(
expected
,
actual
,
diff
,
eps
,
&
maxv
,
&
maxa
);
if
(
violations
>
0
)
{
FAIL
()
<<
" Relative difference ("
<<
maxv
<<
" of "
<<
maxa
<<
" allowed) between argument
\"
"
<<
node
.
name
()
<<
"
\"
and expected value is bugger than "
<<
eps
<<
" in "
<<
violations
<<
" points"
;
}
}
}
}
}
}
}
...
...
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