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
cd169941
Commit
cd169941
authored
Dec 21, 2018
by
Vitaly Tuzov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added test for addition of Mat and Matx
parent
c8f59bf1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
72 additions
and
0 deletions
+72
-0
test_operations.cpp
modules/core/test/test_operations.cpp
+72
-0
No files found.
modules/core/test/test_operations.cpp
View file @
cd169941
...
...
@@ -69,6 +69,7 @@ protected:
bool
TestVec
();
bool
TestMatxMultiplication
();
bool
TestMatxElementwiseDivison
();
bool
TestMatMatxCastSum
();
bool
TestSubMatAccess
();
bool
TestExp
();
bool
TestSVD
();
...
...
@@ -885,6 +886,74 @@ bool CV_OperationsTest::TestMatxMultiplication()
return
true
;
}
bool
CV_OperationsTest
::
TestMatMatxCastSum
()
{
try
{
Mat
ref1
=
(
Mat_
<
double
>
(
3
,
1
)
<<
1
,
2
,
3
);
Mat
ref2
=
(
Mat_
<
double
>
(
3
,
1
)
<<
3
,
4
,
5
);
Mat
ref3
=
Mat
::
ones
(
3
,
1
,
CV_64FC1
);
Mat
mat
=
Mat
::
zeros
(
3
,
1
,
CV_64FC1
);
Mat
tst1
=
ref1
.
clone
();
Mat_
<
double
>
tst2
=
ref2
.
clone
();
Matx
<
double
,
3
,
1
>
tst3
(
1
,
2
,
3
);
Vec3d
tst4
(
3
,
4
,
5
);
Scalar
tst5
(
1
,
2
,
3
);
Mat
res
;
res
=
mat
+
tst1
;
CHECK_DIFF_FLT
(
res
,
ref1
);
res
=
mat
+
tst2
;
CHECK_DIFF_FLT
(
res
,
ref2
);
res
=
mat
+
tst3
;
CHECK_DIFF_FLT
(
res
,
ref1
);
res
=
mat
+
tst4
;
CHECK_DIFF_FLT
(
res
,
ref2
);
res
=
mat
+
tst5
;
CHECK_DIFF_FLT
(
res
,
ref3
);
res
=
mat
+
1
;
CHECK_DIFF_FLT
(
res
,
ref3
);
cv
::
add
(
mat
,
tst1
,
res
);
CHECK_DIFF_FLT
(
res
,
ref1
);
cv
::
add
(
mat
,
tst2
,
res
);
CHECK_DIFF_FLT
(
res
,
ref2
);
cv
::
add
(
mat
,
tst3
,
res
);
CHECK_DIFF_FLT
(
res
,
ref1
);
cv
::
add
(
mat
,
tst4
,
res
);
CHECK_DIFF_FLT
(
res
,
ref2
);
cv
::
add
(
mat
,
tst5
,
res
);
CHECK_DIFF_FLT
(
res
,
ref3
);
cv
::
add
(
mat
,
1
,
res
);
CHECK_DIFF_FLT
(
res
,
ref3
);
res
=
mat
.
clone
();
res
+=
tst1
;
CHECK_DIFF_FLT
(
res
,
ref1
);
res
=
mat
.
clone
();
res
+=
tst2
;
CHECK_DIFF_FLT
(
res
,
ref2
);
res
=
mat
.
clone
();
res
+=
tst3
;
CHECK_DIFF_FLT
(
res
,
ref1
);
res
=
mat
.
clone
();
res
+=
tst4
;
CHECK_DIFF_FLT
(
res
,
ref2
);
res
=
mat
.
clone
();
res
+=
tst5
;
CHECK_DIFF_FLT
(
res
,
ref3
);
res
=
mat
.
clone
();
res
+=
1
;
CHECK_DIFF_FLT
(
res
,
ref3
);
}
catch
(
const
test_excep
&
e
)
{
ts
->
printf
(
cvtest
::
TS
::
LOG
,
"%s
\n
"
,
e
.
s
.
c_str
());
ts
->
set_failed_test_info
(
cvtest
::
TS
::
FAIL_MISMATCH
);
return
false
;
}
return
true
;
}
bool
CV_OperationsTest
::
TestMatxElementwiseDivison
()
{
try
...
...
@@ -1135,6 +1204,9 @@ void CV_OperationsTest::run( int /* start_from */)
if
(
!
TestMatxElementwiseDivison
())
return
;
if
(
!
TestMatMatxCastSum
())
return
;
if
(
!
TestSubMatAccess
())
return
;
...
...
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