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
fba70ca1
Commit
fba70ca1
authored
Aug 15, 2011
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed bug #1306 (Vec assignment); added tests for Vec & Matx multiplication
parent
58c0bea6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
10 deletions
+59
-10
core.hpp
modules/core/include/opencv2/core/core.hpp
+0
-1
operations.hpp
modules/core/include/opencv2/core/operations.hpp
+1
-9
test_operations.cpp
modules/core/test/test_operations.cpp
+58
-0
No files found.
modules/core/include/opencv2/core/core.hpp
View file @
fba70ca1
...
...
@@ -592,7 +592,6 @@ public:
explicit
Vec
(
const
_Tp
*
values
);
Vec
(
const
Vec
<
_Tp
,
cn
>&
v
);
Vec
<
_Tp
,
cn
>&
operator
=
(
const
Matx
<
_Tp
,
cn
,
1
>&
m
);
static
Vec
all
(
_Tp
alpha
);
...
...
modules/core/include/opencv2/core/operations.hpp
View file @
fba70ca1
...
...
@@ -1038,15 +1038,7 @@ template<typename _Tp, int cn> template<typename _T2> inline
Vec
<
_Tp
,
cn
>::
Vec
(
const
Matx
<
_Tp
,
cn
,
1
>&
a
,
_T2
alpha
,
Matx_ScaleOp
op
)
:
Matx
<
_Tp
,
cn
,
1
>
(
a
,
alpha
,
op
)
{}
template
<
typename
_Tp
,
int
cn
>
inline
Vec
<
_Tp
,
cn
>&
Vec
<
_Tp
,
cn
>::
operator
=
(
const
Matx
<
_Tp
,
cn
,
1
>&
m
)
{
for
(
int
i
=
0
;
i
<
cn
;
i
++
)
this
->
val
[
i
]
=
m
.
val
[
i
];
return
*
this
;
}
template
<
typename
_Tp
,
int
cn
>
inline
Vec
<
_Tp
,
cn
>
Vec
<
_Tp
,
cn
>::
all
(
_Tp
alpha
)
{
Vec
v
;
...
...
modules/core/test/test_operations.cpp
View file @
fba70ca1
...
...
@@ -72,6 +72,8 @@ protected:
bool
TestTemplateMat
();
bool
TestMatND
();
bool
TestSparseMat
();
bool
TestVec
();
bool
TestMatxMultiplication
();
bool
operations1
();
void
checkDiff
(
const
Mat
&
m1
,
const
Mat
&
m2
,
const
string
&
s
)
{
if
(
norm
(
m1
,
m2
,
NORM_INF
)
!=
0
)
throw
test_excep
(
s
);
}
...
...
@@ -747,6 +749,56 @@ bool CV_OperationsTest::TestSparseMat()
return
true
;
}
bool
CV_OperationsTest
::
TestMatxMultiplication
()
{
try
{
Matx33f
mat
(
1
,
0
,
0
,
0
,
1
,
0
,
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
();
}
catch
(
const
test_excep
&
)
{
ts
->
set_failed_test_info
(
cvtest
::
TS
::
FAIL_INVALID_OUTPUT
);
return
false
;
}
return
true
;
}
bool
CV_OperationsTest
::
TestVec
()
{
try
{
cv
::
Mat
hsvImage_f
(
5
,
5
,
CV_32FC3
),
hsvImage_b
(
5
,
5
,
CV_8UC3
);
int
i
=
0
,
j
=
0
;
cv
::
Vec3f
a
;
//these compile
cv
::
Vec3b
b
=
a
;
hsvImage_f
.
at
<
cv
::
Vec3f
>
(
i
,
j
)
=
cv
::
Vec3f
(
i
,
0
,
1
);
hsvImage_b
.
at
<
cv
::
Vec3b
>
(
i
,
j
)
=
cv
::
Vec3b
(
cv
::
Vec3f
(
i
,
0
,
1
));
//these don't
b
=
cv
::
Vec3f
(
1
,
0
,
0
);
cv
::
Vec3b
c
;
c
=
cv
::
Vec3f
(
0
,
0
,
1
);
hsvImage_b
.
at
<
cv
::
Vec3b
>
(
i
,
j
)
=
cv
::
Vec3f
(
i
,
0
,
1
);
hsvImage_b
.
at
<
cv
::
Vec3b
>
(
i
,
j
)
=
a
;
hsvImage_b
.
at
<
cv
::
Vec3b
>
(
i
,
j
)
=
cv
::
Vec3f
(
1
,
2
,
3
);
}
catch
(
const
test_excep
&
)
{
ts
->
set_failed_test_info
(
cvtest
::
TS
::
FAIL_INVALID_OUTPUT
);
return
false
;
}
return
true
;
}
bool
CV_OperationsTest
::
operations1
()
{
try
...
...
@@ -819,6 +871,12 @@ void CV_OperationsTest::run( int /* start_from */)
if
(
!
TestSparseMat
())
return
;
if
(
!
TestVec
())
return
;
if
(
!
TestMatxMultiplication
())
return
;
if
(
!
operations1
())
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