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
f93be25c
Commit
f93be25c
authored
Jan 22, 2015
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3629 from nstiurca:matx-fix
parents
4949f708
8722faa1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
111 additions
and
0 deletions
+111
-0
matrix.cpp
modules/core/src/matrix.cpp
+8
-0
test_misc.cpp
modules/core/test/test_misc.cpp
+103
-0
No files found.
modules/core/src/matrix.cpp
View file @
f93be25c
...
...
@@ -2644,6 +2644,10 @@ void _OutputArray::assign(const UMat& u) const
{
u
.
copyTo
(
*
(
Mat
*
)
obj
);
// TODO check u.getMat()
}
else
if
(
k
==
MATX
)
{
u
.
copyTo
(
getMat
());
// TODO check u.getMat()
}
else
{
CV_Error
(
Error
::
StsNotImplemented
,
""
);
...
...
@@ -2662,6 +2666,10 @@ void _OutputArray::assign(const Mat& m) const
{
*
(
Mat
*
)
obj
=
m
;
}
else
if
(
k
==
MATX
)
{
m
.
copyTo
(
getMat
());
}
else
{
CV_Error
(
Error
::
StsNotImplemented
,
""
);
...
...
modules/core/test/test_misc.cpp
View file @
f93be25c
...
...
@@ -26,3 +26,106 @@ TEST(Core_SaturateCast, NegativeNotClipped)
ASSERT_EQ
(
0xffffffff
,
val
);
}
template
<
typename
T
,
typename
U
>
static
double
maxAbsDiff
(
const
T
&
t
,
const
U
&
u
)
{
Mat_
<
double
>
d
;
absdiff
(
t
,
u
,
d
);
double
ret
;
minMaxLoc
(
d
,
NULL
,
&
ret
);
return
ret
;
}
TEST
(
Core_OutputArrayAssign
,
_Matxd_Matd
)
{
Mat
expected
=
(
Mat_
<
double
>
(
2
,
3
)
<<
1
,
2
,
3
,
.1
,
.2
,
.3
);
Matx23d
actualx
;
{
OutputArray
oa
(
actualx
);
oa
.
assign
(
expected
);
}
Mat
actual
=
(
Mat
)
actualx
;
EXPECT_LE
(
maxAbsDiff
(
expected
,
actual
),
0.0
);
}
TEST
(
Core_OutputArrayAssign
,
_Matxd_Matf
)
{
Mat
expected
=
(
Mat_
<
float
>
(
2
,
3
)
<<
1
,
2
,
3
,
.1
,
.2
,
.3
);
Matx23d
actualx
;
{
OutputArray
oa
(
actualx
);
oa
.
assign
(
expected
);
}
Mat
actual
=
(
Mat
)
actualx
;
EXPECT_LE
(
maxAbsDiff
(
expected
,
actual
),
FLT_EPSILON
);
}
TEST
(
Core_OutputArrayAssign
,
_Matxf_Matd
)
{
Mat
expected
=
(
Mat_
<
double
>
(
2
,
3
)
<<
1
,
2
,
3
,
.1
,
.2
,
.3
);
Matx23f
actualx
;
{
OutputArray
oa
(
actualx
);
oa
.
assign
(
expected
);
}
Mat
actual
=
(
Mat
)
actualx
;
EXPECT_LE
(
maxAbsDiff
(
expected
,
actual
),
FLT_EPSILON
);
}
TEST
(
Core_OutputArrayAssign
,
_Matxd_UMatd
)
{
Mat
expected
=
(
Mat_
<
double
>
(
2
,
3
)
<<
1
,
2
,
3
,
.1
,
.2
,
.3
);
UMat
uexpected
=
expected
.
getUMat
(
ACCESS_READ
);
Matx23d
actualx
;
{
OutputArray
oa
(
actualx
);
oa
.
assign
(
uexpected
);
}
Mat
actual
=
(
Mat
)
actualx
;
EXPECT_LE
(
maxAbsDiff
(
expected
,
actual
),
0.0
);
}
TEST
(
Core_OutputArrayAssign
,
_Matxd_UMatf
)
{
Mat
expected
=
(
Mat_
<
float
>
(
2
,
3
)
<<
1
,
2
,
3
,
.1
,
.2
,
.3
);
UMat
uexpected
=
expected
.
getUMat
(
ACCESS_READ
);
Matx23d
actualx
;
{
OutputArray
oa
(
actualx
);
oa
.
assign
(
uexpected
);
}
Mat
actual
=
(
Mat
)
actualx
;
EXPECT_LE
(
maxAbsDiff
(
expected
,
actual
),
FLT_EPSILON
);
}
TEST
(
Core_OutputArrayAssign
,
_Matxf_UMatd
)
{
Mat
expected
=
(
Mat_
<
double
>
(
2
,
3
)
<<
1
,
2
,
3
,
.1
,
.2
,
.3
);
UMat
uexpected
=
expected
.
getUMat
(
ACCESS_READ
);
Matx23f
actualx
;
{
OutputArray
oa
(
actualx
);
oa
.
assign
(
uexpected
);
}
Mat
actual
=
(
Mat
)
actualx
;
EXPECT_LE
(
maxAbsDiff
(
expected
,
actual
),
FLT_EPSILON
);
}
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