diff --git a/modules/imgproc/include/opencv2/imgproc.hpp b/modules/imgproc/include/opencv2/imgproc.hpp index 96cdf07b9d..c3b214f55e 100644 --- a/modules/imgproc/include/opencv2/imgproc.hpp +++ b/modules/imgproc/include/opencv2/imgproc.hpp @@ -4378,7 +4378,7 @@ CV_EXPORTS_W void drawMarker(InputOutputArray img, Point position, const Scalar& /* ----------------------------------------------------------------------------------------- */ /** @overload */ -CV_EXPORTS void fillConvexPoly(Mat& img, const Point* pts, int npts, +CV_EXPORTS void fillConvexPoly(InputOutputArray img, const Point* pts, int npts, const Scalar& color, int lineType = LINE_8, int shift = 0); @@ -4400,7 +4400,7 @@ CV_EXPORTS_W void fillConvexPoly(InputOutputArray img, InputArray points, int shift = 0); /** @overload */ -CV_EXPORTS void fillPoly(Mat& img, const Point** pts, +CV_EXPORTS void fillPoly(InputOutputArray img, const Point** pts, const int* npts, int ncontours, const Scalar& color, int lineType = LINE_8, int shift = 0, Point offset = Point() ); @@ -4428,7 +4428,7 @@ CV_EXPORTS_W void fillPoly(InputOutputArray img, InputArrayOfArrays pts, Point offset = Point() ); /** @overload */ -CV_EXPORTS void polylines(Mat& img, const Point* const* pts, const int* npts, +CV_EXPORTS void polylines(InputOutputArray img, const Point* const* pts, const int* npts, int ncontours, bool isClosed, const Scalar& color, int thickness = 1, int lineType = LINE_8, int shift = 0 ); diff --git a/modules/imgproc/src/drawing.cpp b/modules/imgproc/src/drawing.cpp index 3b2e6e058e..44c3b463ff 100644 --- a/modules/imgproc/src/drawing.cpp +++ b/modules/imgproc/src/drawing.cpp @@ -1971,11 +1971,13 @@ void ellipse(InputOutputArray _img, const RotatedRect& box, const Scalar& color, EllipseEx( img, center, axes, _angle, 0, 360, buf, thickness, lineType ); } -void fillConvexPoly( Mat& img, const Point* pts, int npts, +void fillConvexPoly( InputOutputArray _img, const Point* pts, int npts, const Scalar& color, int line_type, int shift ) { CV_INSTRUMENT_REGION(); + Mat img = _img.getMat(); + if( !pts || npts <= 0 ) return; @@ -1989,13 +1991,14 @@ void fillConvexPoly( Mat& img, const Point* pts, int npts, FillConvexPoly( img, _pts.data(), npts, buf, line_type, shift ); } - -void fillPoly( Mat& img, const Point** pts, const int* npts, int ncontours, +void fillPoly( InputOutputArray _img, const Point** pts, const int* npts, int ncontours, const Scalar& color, int line_type, int shift, Point offset ) { CV_INSTRUMENT_REGION(); + Mat img = _img.getMat(); + if( line_type == CV_AA && img.depth() != CV_8U ) line_type = 8; @@ -2020,12 +2023,13 @@ void fillPoly( Mat& img, const Point** pts, const int* npts, int ncontours, FillEdgeCollection(img, edges, buf); } - -void polylines( Mat& img, const Point* const* pts, const int* npts, int ncontours, bool isClosed, +void polylines( InputOutputArray _img, const Point* const* pts, const int* npts, int ncontours, bool isClosed, const Scalar& color, int thickness, int line_type, int shift ) { CV_INSTRUMENT_REGION(); + Mat img = _img.getMat(); + if( line_type == CV_AA && img.depth() != CV_8U ) line_type = 8; @@ -2370,24 +2374,21 @@ double getFontScaleFromHeight(const int fontFace, const int pixelHeight, const i } - -void cv::fillConvexPoly(InputOutputArray _img, InputArray _points, +void cv::fillConvexPoly(InputOutputArray img, InputArray _points, const Scalar& color, int lineType, int shift) { CV_INSTRUMENT_REGION(); - Mat img = _img.getMat(), points = _points.getMat(); + Mat points = _points.getMat(); CV_Assert(points.checkVector(2, CV_32S) >= 0); fillConvexPoly(img, points.ptr(), points.rows*points.cols*points.channels()/2, color, lineType, shift); } - -void cv::fillPoly(InputOutputArray _img, InputArrayOfArrays pts, +void cv::fillPoly(InputOutputArray img, InputArrayOfArrays pts, const Scalar& color, int lineType, int shift, Point offset) { CV_INSTRUMENT_REGION(); - Mat img = _img.getMat(); int i, ncontours = (int)pts.total(); if( ncontours == 0 ) return; @@ -2406,14 +2407,12 @@ void cv::fillPoly(InputOutputArray _img, InputArrayOfArrays pts, fillPoly(img, (const Point**)ptsptr, npts, (int)ncontours, color, lineType, shift, offset); } - -void cv::polylines(InputOutputArray _img, InputArrayOfArrays pts, +void cv::polylines(InputOutputArray img, InputArrayOfArrays pts, bool isClosed, const Scalar& color, - int thickness, int lineType, int shift ) + int thickness, int lineType, int shift) { CV_INSTRUMENT_REGION(); - Mat img = _img.getMat(); bool manyContours = pts.kind() == _InputArray::STD_VECTOR_VECTOR || pts.kind() == _InputArray::STD_VECTOR_MAT; int i, ncontours = manyContours ? (int)pts.total() : 1;