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
7cd4edd6
Commit
7cd4edd6
authored
Feb 22, 2013
by
Andrey Kamaev
Committed by
OpenCV Buildbot
Feb 22, 2013
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #518 from asmorkalov:ts_refactor
parents
dea6148a
e21a1d31
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
34 deletions
+16
-34
ts_arrtest.cpp
modules/ts/src/ts_arrtest.cpp
+2
-24
ts_func.cpp
modules/ts/src/ts_func.cpp
+14
-10
No files found.
modules/ts/src/ts_arrtest.cpp
View file @
7cd4edd6
...
...
@@ -296,37 +296,15 @@ int ArrayTest::validate_test_results( int test_case_idx )
for
(
j
=
0
;
j
<
sizei
;
j
++
)
{
double
err_level
;
vector
<
int
>
idx
;
double
max_diff
=
0
;
int
code
;
char
msg
[
100
];
if
(
!
test_array
[
i1
][
j
]
)
continue
;
err_level
=
get_success_error_level
(
test_case_idx
,
i0
,
(
int
)
j
);
code
=
cmpEps
(
test_mat
[
i0
][
j
],
test_mat
[
i1
][
j
],
&
max_diff
,
err_level
,
&
idx
,
element_wise_relative_error
);
code
=
cmpEps
2
(
ts
,
test_mat
[
i0
][
j
],
test_mat
[
i1
][
j
],
err_level
,
element_wise_relative_error
,
arr_names
[
i0
]
);
switch
(
code
)
{
case
-
1
:
sprintf
(
msg
,
"Too big difference (=%g)"
,
max_diff
);
code
=
TS
::
FAIL_BAD_ACCURACY
;
break
;
case
-
2
:
strcpy
(
msg
,
"Invalid output"
);
code
=
TS
::
FAIL_INVALID_OUTPUT
;
break
;
case
-
3
:
strcpy
(
msg
,
"Invalid output in the reference array"
);
code
=
TS
::
FAIL_INVALID_OUTPUT
;
break
;
default
:
continue
;
}
string
idxstr
=
vec2str
(
", "
,
&
idx
[
0
],
idx
.
size
());
ts
->
printf
(
TS
::
LOG
,
"%s in %s array %d at (%s)"
,
msg
,
arr_names
[
i0
],
j
,
idxstr
.
c_str
()
);
if
(
code
==
0
)
continue
;
for
(
i0
=
0
;
i0
<
(
int
)
test_array
.
size
();
i0
++
)
{
...
...
modules/ts/src/ts_func.cpp
View file @
7cd4edd6
...
...
@@ -1934,6 +1934,10 @@ int check( const Mat& a, double fmin, double fmax, vector<int>* _idx )
return
idx
==
0
?
0
:
-
1
;
}
#define CMP_EPS_OK 0
#define CMP_EPS_BIG_DIFF -1
#define CMP_EPS_INVALID_TEST_DATA -2 // there is NaN or Inf value in test data
#define CMP_EPS_INVALID_REF_DATA -3 // there is NaN or Inf value in reference data
// compares two arrays. max_diff is the maximum actual difference,
// success_err_level is maximum allowed difference, idx is the index of the first
...
...
@@ -1946,7 +1950,7 @@ int cmpEps( const Mat& arr, const Mat& refarr, double* _realmaxdiff,
CV_Assert
(
arr
.
type
()
==
refarr
.
type
()
&&
arr
.
size
==
refarr
.
size
);
int
ilevel
=
refarr
.
depth
()
<=
CV_32S
?
cvFloor
(
success_err_level
)
:
0
;
int
result
=
0
;
int
result
=
CMP_EPS_OK
;
const
Mat
*
arrays
[]
=
{
&
arr
,
&
refarr
,
0
};
Mat
planes
[
2
];
...
...
@@ -1998,13 +2002,13 @@ int cmpEps( const Mat& arr, const Mat& refarr, double* _realmaxdiff,
continue
;
if
(
cvIsNaN
(
a_val
)
||
cvIsInf
(
a_val
)
)
{
result
=
-
2
;
result
=
CMP_EPS_INVALID_TEST_DATA
;
idx
=
startidx
+
j
;
break
;
}
if
(
cvIsNaN
(
b_val
)
||
cvIsInf
(
b_val
)
)
{
result
=
-
3
;
result
=
CMP_EPS_INVALID_REF_DATA
;
idx
=
startidx
+
j
;
break
;
}
...
...
@@ -2029,13 +2033,13 @@ int cmpEps( const Mat& arr, const Mat& refarr, double* _realmaxdiff,
continue
;
if
(
cvIsNaN
(
a_val
)
||
cvIsInf
(
a_val
)
)
{
result
=
-
2
;
result
=
CMP_EPS_INVALID_TEST_DATA
;
idx
=
startidx
+
j
;
break
;
}
if
(
cvIsNaN
(
b_val
)
||
cvIsInf
(
b_val
)
)
{
result
=
-
3
;
result
=
CMP_EPS_INVALID_REF_DATA
;
idx
=
startidx
+
j
;
break
;
}
...
...
@@ -2051,7 +2055,7 @@ int cmpEps( const Mat& arr, const Mat& refarr, double* _realmaxdiff,
break
;
default
:
assert
(
0
);
return
-
1
;
return
CMP_EPS_BIG_DIFF
;
}
if
(
_realmaxdiff
)
*
_realmaxdiff
=
MAX
(
*
_realmaxdiff
,
realmaxdiff
);
...
...
@@ -2060,7 +2064,7 @@ int cmpEps( const Mat& arr, const Mat& refarr, double* _realmaxdiff,
}
if
(
result
==
0
&&
idx
!=
0
)
result
=
-
1
;
result
=
CMP_EPS_BIG_DIFF
;
if
(
result
<
-
1
&&
_realmaxdiff
)
*
_realmaxdiff
=
exp
(
1000.
);
...
...
@@ -2081,15 +2085,15 @@ int cmpEps2( TS* ts, const Mat& a, const Mat& b, double success_err_level,
switch
(
code
)
{
case
-
1
:
case
CMP_EPS_BIG_DIFF
:
sprintf
(
msg
,
"%s: Too big difference (=%g)"
,
desc
,
diff
);
code
=
TS
::
FAIL_BAD_ACCURACY
;
break
;
case
-
2
:
case
CMP_EPS_INVALID_TEST_DATA
:
sprintf
(
msg
,
"%s: Invalid output"
,
desc
);
code
=
TS
::
FAIL_INVALID_OUTPUT
;
break
;
case
-
3
:
case
CMP_EPS_INVALID_REF_DATA
:
sprintf
(
msg
,
"%s: Invalid reference output"
,
desc
);
code
=
TS
::
FAIL_INVALID_OUTPUT
;
break
;
...
...
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