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
e2c7adc7
Commit
e2c7adc7
authored
May 07, 2014
by
Alexander Alekhin
Committed by
OpenCV Buildbot
May 07, 2014
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2703 from jet47:subtract-create-dst-mat
parents
b1a28a52
4c66614e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletion
+15
-1
arithm.cpp
modules/core/src/arithm.cpp
+5
-1
test_arithm.cpp
modules/core/test/test_arithm.cpp
+10
-0
No files found.
modules/core/src/arithm.cpp
View file @
e2c7adc7
...
...
@@ -1562,8 +1562,12 @@ void cv::subtract( InputArray src1, InputArray src2, OutputArray dst,
if
(
dtype
==
-
1
&&
dst
.
fixedType
())
dtype
=
dst
.
depth
();
if
(
!
dst
.
fixedType
()
||
dtype
==
dst
.
depth
())
dtype
=
CV_MAKE_TYPE
(
CV_MAT_DEPTH
(
dtype
),
src1
.
channels
());
if
(
!
dst
.
fixedType
()
||
dtype
==
dst
.
type
())
{
dst
.
create
(
src1
.
size
(),
dtype
);
if
(
dtype
==
CV_16S
)
{
Mat
_dst
=
dst
.
getMat
();
...
...
modules/core/test/test_arithm.cpp
View file @
e2c7adc7
...
...
@@ -1579,3 +1579,13 @@ TEST_P(Mul1, One)
}
INSTANTIATE_TEST_CASE_P
(
Arithm
,
Mul1
,
testing
::
Values
(
Size
(
2
,
2
),
Size
(
1
,
1
)));
TEST
(
Subtract8u8u16s
,
EmptyOutputMat
)
{
cv
::
Mat
src1
=
cv
::
Mat
::
zeros
(
16
,
16
,
CV_8UC1
);
cv
::
Mat
src2
=
cv
::
Mat
::
zeros
(
16
,
16
,
CV_8UC1
);
cv
::
Mat
dst
;
cv
::
subtract
(
src1
,
src2
,
dst
,
cv
::
noArray
(),
CV_16S
);
ASSERT_FALSE
(
dst
.
empty
());
ASSERT_EQ
(
0
,
cv
::
countNonZero
(
dst
));
}
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