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
87888984
Commit
87888984
authored
Apr 25, 2012
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added Matx<4,4>*Scalar operator (ticket #1830)
parent
ed1932df
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
3 deletions
+28
-3
operations.hpp
modules/core/include/opencv2/core/operations.hpp
+12
-3
test_operations.cpp
modules/core/test/test_operations.cpp
+16
-0
No files found.
modules/core/include/opencv2/core/operations.hpp
View file @
87888984
...
...
@@ -676,14 +676,23 @@ Matx<_Tp, 4, 1> operator * (const Matx<_Tp, 4, 4>& a, const Point3_<_Tp>& b)
return
a
*
Matx
<
_Tp
,
4
,
1
>
(
b
.
x
,
b
.
y
,
b
.
z
,
1
);
}
template
<
typename
_Tp
>
static
inline
Scalar
operator
*
(
const
Matx
<
_Tp
,
4
,
4
>&
a
,
const
Scalar
&
b
)
{
return
Scalar
(
a
*
Matx
<
_Tp
,
4
,
1
>
(
b
[
0
],
b
[
1
],
b
[
2
],
b
[
3
]));
}
Matx
<
double
,
4
,
1
>
c
(
Matx
<
double
,
4
,
4
>
(
a
),
b
,
Matx_MatMulOp
());
return
reinterpret_cast
<
const
Scalar
&>
(
c
);
}
static
inline
Scalar
operator
*
(
const
Matx
<
double
,
4
,
4
>&
a
,
const
Scalar
&
b
)
{
Matx
<
double
,
4
,
1
>
c
(
a
,
b
,
Matx_MatMulOp
());
return
reinterpret_cast
<
const
Scalar
&>
(
c
);
}
template
<
typename
_Tp
,
int
m
,
int
n
>
inline
Matx
<
_Tp
,
m
,
n
>
Matx
<
_Tp
,
m
,
n
>::
mul
(
const
Matx
<
_Tp
,
m
,
n
>&
a
)
const
{
...
...
modules/core/test/test_operations.cpp
View file @
87888984
...
...
@@ -808,6 +808,22 @@ bool CV_OperationsTest::TestMatxMultiplication()
if
(
res2
[
0
]
!=
14.0
)
throw
test_excep
();
if
(
res2
[
1
]
!=
6.0
)
throw
test_excep
();
if
(
res2
[
2
]
!=
1.0
)
throw
test_excep
();
Matx44f
mat44f
(
1
,
1
,
1
,
1
,
0
,
1
,
1
,
1
,
0
,
0
,
1
,
1
,
0
,
0
,
0
,
1
);
Matx44d
mat44d
(
1
,
1
,
1
,
1
,
0
,
1
,
1
,
1
,
0
,
0
,
1
,
1
,
0
,
0
,
0
,
1
);
Scalar
s
(
4
,
3
,
2
,
1
);
Scalar
sf
=
mat44f
*
s
;
Scalar
sd
=
mat44d
*
s
;
if
(
sf
[
0
]
!=
10.0
)
throw
test_excep
();
if
(
sf
[
1
]
!=
6.0
)
throw
test_excep
();
if
(
sf
[
2
]
!=
3.0
)
throw
test_excep
();
if
(
sf
[
3
]
!=
1.0
)
throw
test_excep
();
if
(
sd
[
0
]
!=
10.0
)
throw
test_excep
();
if
(
sd
[
1
]
!=
6.0
)
throw
test_excep
();
if
(
sd
[
2
]
!=
3.0
)
throw
test_excep
();
if
(
sd
[
3
]
!=
1.0
)
throw
test_excep
();
}
catch
(
const
test_excep
&
)
{
...
...
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