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
c1f8d9e3
Commit
c1f8d9e3
authored
Jun 27, 2013
by
Roman Donchenko
Committed by
OpenCV Buildbot
Jun 27, 2013
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1011 from wecacuee:master
parents
53afdb4b
f15dc72b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
0 deletions
+41
-0
matx.hpp
modules/core/include/opencv2/core/matx.hpp
+15
-0
test_operations.cpp
modules/core/test/test_operations.cpp
+26
-0
No files found.
modules/core/include/opencv2/core/matx.hpp
View file @
c1f8d9e3
...
...
@@ -77,6 +77,7 @@ struct CV_EXPORTS Matx_AddOp {};
struct
CV_EXPORTS
Matx_SubOp
{};
struct
CV_EXPORTS
Matx_ScaleOp
{};
struct
CV_EXPORTS
Matx_MulOp
{};
struct
CV_EXPORTS
Matx_DivOp
{};
struct
CV_EXPORTS
Matx_MatMulOp
{};
struct
CV_EXPORTS
Matx_TOp
{};
...
...
@@ -174,6 +175,7 @@ public:
Matx
(
const
Matx
<
_Tp
,
m
,
n
>&
a
,
const
Matx
<
_Tp
,
m
,
n
>&
b
,
Matx_SubOp
);
template
<
typename
_T2
>
Matx
(
const
Matx
<
_Tp
,
m
,
n
>&
a
,
_T2
alpha
,
Matx_ScaleOp
);
Matx
(
const
Matx
<
_Tp
,
m
,
n
>&
a
,
const
Matx
<
_Tp
,
m
,
n
>&
b
,
Matx_MulOp
);
Matx
(
const
Matx
<
_Tp
,
m
,
n
>&
a
,
const
Matx
<
_Tp
,
m
,
n
>&
b
,
Matx_DivOp
);
template
<
int
l
>
Matx
(
const
Matx
<
_Tp
,
m
,
l
>&
a
,
const
Matx
<
_Tp
,
l
,
n
>&
b
,
Matx_MatMulOp
);
Matx
(
const
Matx
<
_Tp
,
n
,
m
>&
a
,
Matx_TOp
);
...
...
@@ -746,6 +748,13 @@ Matx<_Tp,m,n>::Matx(const Matx<_Tp, m, n>& a, const Matx<_Tp, m, n>& b, Matx_Mul
val
[
i
]
=
saturate_cast
<
_Tp
>
(
a
.
val
[
i
]
*
b
.
val
[
i
]);
}
template
<
typename
_Tp
,
int
m
,
int
n
>
inline
Matx
<
_Tp
,
m
,
n
>::
Matx
(
const
Matx
<
_Tp
,
m
,
n
>&
a
,
const
Matx
<
_Tp
,
m
,
n
>&
b
,
Matx_DivOp
)
{
for
(
int
i
=
0
;
i
<
channels
;
i
++
)
val
[
i
]
=
saturate_cast
<
_Tp
>
(
a
.
val
[
i
]
/
b
.
val
[
i
]);
}
template
<
typename
_Tp
,
int
m
,
int
n
>
template
<
int
l
>
inline
Matx
<
_Tp
,
m
,
n
>::
Matx
(
const
Matx
<
_Tp
,
m
,
l
>&
a
,
const
Matx
<
_Tp
,
l
,
n
>&
b
,
Matx_MatMulOp
)
{
...
...
@@ -1162,6 +1171,12 @@ Vec<_Tp, m> operator * (const Matx<_Tp, m, n>& a, const Vec<_Tp, n>& b)
return
(
const
Vec
<
_Tp
,
m
>&
)(
c
);
}
template
<
typename
_Tp
,
int
m
,
int
n
>
static
inline
Matx
<
_Tp
,
m
,
n
>
operator
/
(
const
Matx
<
_Tp
,
m
,
n
>&
a
,
const
Matx
<
_Tp
,
m
,
n
>&
b
)
{
return
Matx
<
_Tp
,
m
,
n
>
(
a
,
b
,
Matx_DivOp
());
}
template
<
typename
_Tp
,
int
m
,
int
n
>
static
inline
bool
operator
==
(
const
Matx
<
_Tp
,
m
,
n
>&
a
,
const
Matx
<
_Tp
,
m
,
n
>&
b
)
{
...
...
modules/core/test/test_operations.cpp
View file @
c1f8d9e3
...
...
@@ -75,6 +75,7 @@ protected:
bool
TestSparseMat
();
bool
TestVec
();
bool
TestMatxMultiplication
();
bool
TestMatxElementwiseDivison
();
bool
TestSubMatAccess
();
bool
TestExp
();
bool
TestSVD
();
...
...
@@ -891,6 +892,28 @@ bool CV_OperationsTest::TestMatxMultiplication()
return
true
;
}
bool
CV_OperationsTest
::
TestMatxElementwiseDivison
()
{
try
{
Matx22f
mat
(
2
,
4
,
6
,
8
);
Matx22f
mat2
(
2
,
2
,
2
,
2
);
Matx22f
res
=
mat
/
mat2
;
if
(
res
(
0
,
0
)
!=
1.0
)
throw
test_excep
();
if
(
res
(
0
,
1
)
!=
2.0
)
throw
test_excep
();
if
(
res
(
1
,
0
)
!=
3.0
)
throw
test_excep
();
if
(
res
(
1
,
1
)
!=
4.0
)
throw
test_excep
();
}
catch
(
const
test_excep
&
)
{
ts
->
set_failed_test_info
(
cvtest
::
TS
::
FAIL_INVALID_OUTPUT
);
return
false
;
}
return
true
;
}
bool
CV_OperationsTest
::
TestVec
()
{
...
...
@@ -1109,6 +1132,9 @@ void CV_OperationsTest::run( int /* start_from */)
if
(
!
TestMatxMultiplication
())
return
;
if
(
!
TestMatxElementwiseDivison
())
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