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
d2409d12
Commit
d2409d12
authored
Apr 24, 2015
by
Andrey Pavlenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
porting polylines with empty `vector<Point>` from 2.4 to master
parent
755527a9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
0 deletions
+22
-0
drawing.cpp
modules/imgproc/src/drawing.cpp
+3
-0
test_contours.cpp
modules/imgproc/test/test_contours.cpp
+19
-0
No files found.
modules/imgproc/src/drawing.cpp
View file @
d2409d12
...
...
@@ -2229,7 +2229,10 @@ void cv::polylines(InputOutputArray _img, InputArrayOfArrays pts,
{
Mat
p
=
pts
.
getMat
(
manyContours
?
i
:
-
1
);
if
(
p
.
total
()
==
0
)
{
npts
[
i
]
=
0
;
continue
;
}
CV_Assert
(
p
.
checkVector
(
2
,
CV_32S
)
>=
0
);
ptsptr
[
i
]
=
p
.
ptr
<
Point
>
();
npts
[
i
]
=
p
.
rows
*
p
.
cols
*
p
.
channels
()
/
2
;
...
...
modules/imgproc/test/test_contours.cpp
View file @
d2409d12
...
...
@@ -410,4 +410,23 @@ TEST(Core_Drawing, _914)
ASSERT_EQ
(
(
3
*
rows
+
cols
)
*
3
-
3
*
9
,
pixelsDrawn
);
}
TEST
(
Core_Drawing
,
polylines_empty
)
{
Mat
img
(
100
,
100
,
CV_8UC1
,
Scalar
(
0
));
vector
<
Point
>
pts
;
// empty
polylines
(
img
,
pts
,
false
,
Scalar
(
255
));
int
cnt
=
countNonZero
(
img
);
ASSERT_EQ
(
cnt
,
0
);
}
TEST
(
Core_Drawing
,
polylines
)
{
Mat
img
(
100
,
100
,
CV_8UC1
,
Scalar
(
0
));
vector
<
Point
>
pts
;
pts
.
push_back
(
Point
(
0
,
0
));
pts
.
push_back
(
Point
(
20
,
0
));
polylines
(
img
,
pts
,
false
,
Scalar
(
255
));
int
cnt
=
countNonZero
(
img
);
ASSERT_EQ
(
cnt
,
21
);
}
/* End of file. */
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