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
c0ba0c90
Commit
c0ba0c90
authored
Mar 05, 2013
by
cuda-geek
Committed by
OpenCV Buildbot
Mar 05, 2013
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #596 from ArtanisCV:master
parents
7e9f1c33
11f8c74c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
4 deletions
+46
-4
matop.cpp
modules/core/src/matop.cpp
+25
-1
test_math.cpp
modules/core/test/test_math.cpp
+21
-3
No files found.
modules/core/src/matop.cpp
View file @
c0ba0c90
...
...
@@ -200,6 +200,7 @@ public:
void
multiply
(
const
MatExpr
&
e
,
double
s
,
MatExpr
&
res
)
const
;
static
void
makeExpr
(
MatExpr
&
res
,
int
method
,
Size
sz
,
int
type
,
double
alpha
=
1
);
static
void
makeExpr
(
MatExpr
&
res
,
int
method
,
int
ndims
,
const
int
*
sizes
,
int
type
,
double
alpha
=
1
);
};
static
MatOp_Initializer
g_MatOp_Initializer
;
...
...
@@ -1551,8 +1552,13 @@ void MatOp_Initializer::assign(const MatExpr& e, Mat& m, int _type) const
{
if
(
_type
==
-
1
)
_type
=
e
.
a
.
type
();
if
(
e
.
a
.
dims
<=
2
)
m
.
create
(
e
.
a
.
size
(),
_type
);
if
(
e
.
flags
==
'I'
)
else
m
.
create
(
e
.
a
.
dims
,
e
.
a
.
size
,
_type
);
if
(
e
.
flags
==
'I'
&&
e
.
a
.
dims
<=
2
)
setIdentity
(
m
,
Scalar
(
e
.
alpha
));
else
if
(
e
.
flags
==
'0'
)
m
=
Scalar
();
...
...
@@ -1573,6 +1579,10 @@ inline void MatOp_Initializer::makeExpr(MatExpr& res, int method, Size sz, int t
res
=
MatExpr
(
&
g_MatOp_Initializer
,
method
,
Mat
(
sz
,
type
,
(
void
*
)
0
),
Mat
(),
Mat
(),
alpha
,
0
);
}
inline
void
MatOp_Initializer
::
makeExpr
(
MatExpr
&
res
,
int
method
,
int
ndims
,
const
int
*
sizes
,
int
type
,
double
alpha
)
{
res
=
MatExpr
(
&
g_MatOp_Initializer
,
method
,
Mat
(
ndims
,
sizes
,
type
,
(
void
*
)
0
),
Mat
(),
Mat
(),
alpha
,
0
);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////
...
...
@@ -1618,6 +1628,13 @@ MatExpr Mat::zeros(Size size, int type)
return
e
;
}
MatExpr
Mat
::
zeros
(
int
ndims
,
const
int
*
sizes
,
int
type
)
{
MatExpr
e
;
MatOp_Initializer
::
makeExpr
(
e
,
'0'
,
ndims
,
sizes
,
type
);
return
e
;
}
MatExpr
Mat
::
ones
(
int
rows
,
int
cols
,
int
type
)
{
MatExpr
e
;
...
...
@@ -1632,6 +1649,13 @@ MatExpr Mat::ones(Size size, int type)
return
e
;
}
MatExpr
Mat
::
ones
(
int
ndims
,
const
int
*
sizes
,
int
type
)
{
MatExpr
e
;
MatOp_Initializer
::
makeExpr
(
e
,
'1'
,
ndims
,
sizes
,
type
);
return
e
;
}
MatExpr
Mat
::
eye
(
int
rows
,
int
cols
,
int
type
)
{
MatExpr
e
;
...
...
modules/core/test/test_math.cpp
View file @
c0ba0c90
...
...
@@ -2536,12 +2536,30 @@ TYPED_TEST_P(Core_CheckRange, Zero)
double
min_bound
=
0.0
;
double
max_bound
=
0.1
;
cv
::
Mat
src
=
cv
::
Mat
::
zeros
(
3
,
3
,
cv
::
DataDepth
<
TypeParam
>::
value
);
cv
::
Mat
src
1
=
cv
::
Mat
::
zeros
(
3
,
3
,
cv
::
DataDepth
<
TypeParam
>::
value
);
ASSERT_TRUE
(
checkRange
(
src
,
true
,
NULL
,
min_bound
,
max_bound
)
);
int
sizes
[]
=
{
5
,
6
,
7
};
cv
::
Mat
src2
=
cv
::
Mat
::
zeros
(
3
,
sizes
,
cv
::
DataDepth
<
TypeParam
>::
value
);
ASSERT_TRUE
(
checkRange
(
src1
,
true
,
NULL
,
min_bound
,
max_bound
)
);
ASSERT_TRUE
(
checkRange
(
src2
,
true
,
NULL
,
min_bound
,
max_bound
)
);
}
TYPED_TEST_P
(
Core_CheckRange
,
One
)
{
double
min_bound
=
1.0
;
double
max_bound
=
1.1
;
cv
::
Mat
src1
=
cv
::
Mat
::
ones
(
3
,
3
,
cv
::
DataDepth
<
TypeParam
>::
value
);
int
sizes
[]
=
{
5
,
6
,
7
};
cv
::
Mat
src2
=
cv
::
Mat
::
ones
(
3
,
sizes
,
cv
::
DataDepth
<
TypeParam
>::
value
);
ASSERT_TRUE
(
checkRange
(
src1
,
true
,
NULL
,
min_bound
,
max_bound
)
);
ASSERT_TRUE
(
checkRange
(
src2
,
true
,
NULL
,
min_bound
,
max_bound
)
);
}
REGISTER_TYPED_TEST_CASE_P
(
Core_CheckRange
,
Negative
,
Positive
,
Bounds
,
Zero
);
REGISTER_TYPED_TEST_CASE_P
(
Core_CheckRange
,
Negative
,
Positive
,
Bounds
,
Zero
,
One
);
typedef
::
testing
::
Types
<
signed
char
,
unsigned
char
,
signed
short
,
unsigned
short
,
signed
int
>
mat_data_types
;
INSTANTIATE_TYPED_TEST_CASE_P
(
Negative_Test
,
Core_CheckRange
,
mat_data_types
);
...
...
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