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
75b1788c
Commit
75b1788c
authored
Apr 24, 2012
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added "Matx*Vec -> Vec" operator (ticket #1830)
parent
476c453e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
4 deletions
+19
-4
operations.hpp
modules/core/include/opencv2/core/operations.hpp
+8
-0
test_operations.cpp
modules/core/test/test_operations.cpp
+11
-4
No files found.
modules/core/include/opencv2/core/operations.hpp
View file @
75b1788c
...
...
@@ -638,6 +638,14 @@ Matx<_Tp, m, n> operator * (const Matx<_Tp, m, l>& a, const Matx<_Tp, l, n>& b)
}
template
<
typename
_Tp
,
int
m
,
int
n
>
static
inline
Vec
<
_Tp
,
m
>
operator
*
(
const
Matx
<
_Tp
,
m
,
n
>&
a
,
const
Vec
<
_Tp
,
n
>&
b
)
{
Matx
<
_Tp
,
m
,
1
>
c
(
a
,
b
,
Matx_MatMulOp
());
return
reinterpret_cast
<
const
Vec
<
_Tp
,
m
>&>
(
c
);
}
template
<
typename
_Tp
>
static
inline
Point_
<
_Tp
>
operator
*
(
const
Matx
<
_Tp
,
2
,
2
>&
a
,
const
Point_
<
_Tp
>&
b
)
{
...
...
modules/core/test/test_operations.cpp
View file @
75b1788c
...
...
@@ -754,12 +754,19 @@ bool CV_OperationsTest::TestMatxMultiplication()
{
try
{
Matx33f
mat
(
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
);
// Identity matrix
Matx33f
mat
(
1
,
1
,
1
,
0
,
1
,
1
,
0
,
0
,
1
);
// Identity matrix
Point2f
pt
(
3
,
4
);
Point3f
res
=
mat
*
pt
;
// Correctly assumes homogeneous coordinates
if
(
res
.
x
!=
3.0
)
throw
test_excep
();
if
(
res
.
y
!=
4.0
)
throw
test_excep
();
if
(
res
.
z
!=
1.0
)
throw
test_excep
();
Vec3f
res2
=
mat
*
Vec3f
(
res
.
x
,
res
.
y
,
res
.
z
);
if
(
res
.
x
!=
8.0
)
throw
test_excep
();
if
(
res
.
y
!=
5.0
)
throw
test_excep
();
if
(
res
.
z
!=
1.0
)
throw
test_excep
();
if
(
res2
[
0
]
!=
14.0
)
throw
test_excep
();
if
(
res2
[
1
]
!=
6.0
)
throw
test_excep
();
if
(
res2
[
2
]
!=
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