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
bce98376
Commit
bce98376
authored
Mar 05, 2020
by
Maxim Pashchenkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added assert for create Mat with negative dims, added tets for this case
parent
bc036e1e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
0 deletions
+20
-0
mat.hpp
modules/gapi/include/opencv2/gapi/own/mat.hpp
+1
-0
mat_tests.cpp
modules/gapi/test/own/mat_tests.cpp
+19
-0
No files found.
modules/gapi/include/opencv2/gapi/own/mat.hpp
View file @
bce98376
...
...
@@ -230,6 +230,7 @@ namespace cv { namespace gapi { namespace own {
*/
void
create
(
Size
_size
,
int
_type
)
{
GAPI_Assert
(
_size
.
height
>=
0
&&
_size
.
width
>=
0
);
if
(
_size
!=
Size
{
cols
,
rows
}
)
{
Mat
tmp
{
_size
.
height
,
_size
.
width
,
_type
,
nullptr
};
...
...
modules/gapi/test/own/mat_tests.cpp
View file @
bce98376
...
...
@@ -588,4 +588,23 @@ TEST(OwnMat, ROIView)
<<
to_ocv
(
roi_view
)
<<
std
::
endl
<<
expected_cv_mat
<<
std
::
endl
;
}
TEST
(
OwnMat
,
CreateWithNegativeDims
)
{
Mat
own_mat
;
ASSERT_ANY_THROW
(
own_mat
.
create
(
cv
::
Size
{
-
1
,
-
1
},
CV_8U
));
}
TEST
(
OwnMat
,
CreateWithNegativeWidth
)
{
Mat
own_mat
;
ASSERT_ANY_THROW
(
own_mat
.
create
(
cv
::
Size
{
-
1
,
1
},
CV_8U
));
}
TEST
(
OwnMat
,
CreateWithNegativeHeight
)
{
Mat
own_mat
;
ASSERT_ANY_THROW
(
own_mat
.
create
(
cv
::
Size
{
1
,
-
1
},
CV_8U
));
}
}
// namespace opencv_test
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