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
c473718b
Commit
c473718b
authored
Jul 17, 2018
by
Maksim Shabunin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check for empty Mat in compare, operator= and RNG::fill, fixed related tests
parent
1da46fe6
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
4 deletions
+8
-4
arithm.cpp
modules/core/src/arithm.cpp
+1
-1
copy.cpp
modules/core/src/copy.cpp
+2
-0
rand.cpp
modules/core/src/rand.cpp
+2
-0
test_rand.cpp
modules/core/test/test_rand.cpp
+3
-2
test_grabcut.cpp
modules/imgproc/test/test_grabcut.cpp
+0
-1
No files found.
modules/core/src/arithm.cpp
View file @
c473718b
...
...
@@ -1233,7 +1233,7 @@ void cv::compare(InputArray _src1, InputArray _src2, OutputArray _dst, int op)
CV_Assert
(
op
==
CMP_LT
||
op
==
CMP_LE
||
op
==
CMP_EQ
||
op
==
CMP_NE
||
op
==
CMP_GE
||
op
==
CMP_GT
);
if
(
_src1
.
empty
()
&&
_src2
.
empty
())
if
(
_src1
.
empty
()
||
_src2
.
empty
())
{
_dst
.
release
();
return
;
...
...
modules/core/src/copy.cpp
View file @
c473718b
...
...
@@ -411,6 +411,8 @@ Mat& Mat::operator = (const Scalar& s)
{
CV_INSTRUMENT_REGION
()
if
(
empty
())
return
*
this
;
const
Mat
*
arrays
[]
=
{
this
};
uchar
*
dptr
;
NAryMatIterator
it
(
arrays
,
&
dptr
,
1
);
...
...
modules/core/src/rand.cpp
View file @
c473718b
...
...
@@ -511,6 +511,8 @@ static RandnScaleFunc randnScaleTab[] =
void
RNG
::
fill
(
InputOutputArray
_mat
,
int
disttype
,
InputArray
_param1arg
,
InputArray
_param2arg
,
bool
saturateRange
)
{
if
(
_mat
.
empty
())
return
;
Mat
mat
=
_mat
.
getMat
(),
_param1
=
_param1arg
.
getMat
(),
_param2
=
_param2arg
.
getMat
();
int
depth
=
mat
.
depth
(),
cn
=
mat
.
channels
();
AutoBuffer
<
double
>
_parambuf
;
...
...
modules/core/test/test_rand.cpp
View file @
c473718b
...
...
@@ -168,11 +168,12 @@ void Core_RandTest::run( int )
{
tested_rng
=
saved_rng
;
int
sz
=
0
,
dsz
=
0
,
slice
;
for
(
slice
=
0
;
slice
<
maxSlice
;
slice
++
,
sz
+=
dsz
)
for
(
slice
=
0
;
slice
<
maxSlice
&&
sz
<
SZ
;
slice
++
,
sz
+=
dsz
)
{
dsz
=
slice
+
1
<
maxSlice
?
(
int
)(
cvtest
::
randInt
(
rng
)
%
(
SZ
-
sz
+
1
)
)
:
SZ
-
sz
;
dsz
=
slice
+
1
<
maxSlice
?
(
int
)(
cvtest
::
randInt
(
rng
)
%
(
SZ
-
sz
)
+
1
)
:
SZ
-
sz
;
Mat
aslice
=
arr
[
k
].
colRange
(
sz
,
sz
+
dsz
);
tested_rng
.
fill
(
aslice
,
dist_type
,
A
,
B
);
printf
(
"%d - %d
\n
"
,
sz
,
sz
+
dsz
);
}
}
...
...
modules/imgproc/test/test_grabcut.cpp
View file @
c473718b
...
...
@@ -89,7 +89,6 @@ void CV_GrabcutTest::run( int /* start_from */)
Mat
exp_bgdModel
,
exp_fgdModel
;
Mat
mask
;
mask
=
Scalar
(
0
);
Mat
bgdModel
,
fgdModel
;
grabCut
(
img
,
mask
,
rect
,
bgdModel
,
fgdModel
,
0
,
GC_INIT_WITH_RECT
);
bgdModel
.
copyTo
(
exp_bgdModel
);
...
...
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