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
3579c613
Commit
3579c613
authored
Sep 24, 2012
by
bitwangyaoyao
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
git://code.opencv.org/opencv
parents
09359982
d09b3828
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
8 deletions
+13
-8
arithm.cpp
modules/core/src/arithm.cpp
+13
-8
No files found.
modules/core/src/arithm.cpp
View file @
3579c613
...
...
@@ -1218,18 +1218,23 @@ namespace cv
static
int
actualScalarDepth
(
const
Mat
&
src
)
{
double
min
=
MIN
(
MIN
(
*
((
double
*
)
src
.
data
),
*
((
double
*
)
src
.
data
+
1
)),
MIN
(
*
((
double
*
)
src
.
data
+
2
),
(
*
((
double
*
)
src
.
data
+
3
))));
double
max
=
MAX
(
MAX
(
*
((
double
*
)
src
.
data
),
*
((
double
*
)
src
.
data
+
1
)),
MAX
(
*
((
double
*
)
src
.
data
+
2
),
(
*
((
double
*
)
src
.
data
+
3
))));
const
double
*
data
=
(
const
double
*
)
src
.
data
;
double
minval
=
MIN
(
data
[
0
],
data
[
1
]);
minval
=
MIN
(
minval
,
data
[
2
]);
minval
=
MIN
(
minval
,
data
[
3
]);
double
maxval
=
MAX
(
data
[
0
],
data
[
1
]);
maxval
=
MAX
(
maxval
,
data
[
2
]);
maxval
=
MAX
(
maxval
,
data
[
3
]);
int
depth
=
CV_64F
;
if
(
min
>=
0
&&
max
<=
UCHAR_MAX
)
if
(
min
val
>=
0
&&
maxval
<=
UCHAR_MAX
)
depth
=
CV_8U
;
else
if
(
min
>=
SCHAR_MIN
&&
max
<=
SCHAR_MAX
)
else
if
(
min
val
>=
SCHAR_MIN
&&
maxval
<=
SCHAR_MAX
)
depth
=
CV_8S
;
else
if
(
min
>=
0
&&
max
<=
USHRT_MAX
)
else
if
(
min
val
>=
0
&&
maxval
<=
USHRT_MAX
)
depth
=
CV_16U
;
else
if
(
min
>=
SHRT_MIN
&&
max
<=
SHRT_MAX
)
else
if
(
min
val
>=
SHRT_MIN
&&
maxval
<=
SHRT_MAX
)
depth
=
CV_16S
;
else
if
(
min
>=
INT_MIN
&&
max
<=
INT_MAX
)
else
if
(
min
val
>=
INT_MIN
&&
maxval
<=
INT_MAX
)
depth
=
CV_32S
;
return
depth
;
}
...
...
@@ -1269,7 +1274,7 @@ static void arithm_op(InputArray _src1, InputArray _src2, OutputArray _dst,
"The operation is neither 'array op array' (where arrays have the same size and the same number of channels), "
"nor 'array op scalar', nor 'scalar op array'"
);
haveScalar
=
true
;
CV_Assert
(
src2
.
type
()
==
CV_64F
&&
src2
.
rows
==
4
);
CV_Assert
(
src2
.
type
()
==
CV_64F
&&
(
src2
.
rows
==
4
||
src2
.
rows
==
1
)
);
depth2
=
actualScalarDepth
(
src2
);
}
...
...
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