mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 15:23:05 +04:00
fixed fillPoly, the overloaded variant with InputArrayOfArrays parameter (single or multiple polygons)
This commit is contained in:
@@ -931,6 +931,7 @@ void ellipse2Poly( Point2d center, Size2d axes, int angle,
|
||||
int delta, std::vector<Point2d>& pts )
|
||||
{
|
||||
CV_INSTRUMENT_REGION();
|
||||
CV_Assert(0 < delta && delta <= 180);
|
||||
|
||||
float alpha, beta;
|
||||
int i;
|
||||
@@ -2360,7 +2361,9 @@ void cv::fillPoly(InputOutputArray _img, InputArrayOfArrays pts,
|
||||
CV_INSTRUMENT_REGION();
|
||||
|
||||
Mat img = _img.getMat();
|
||||
int i, ncontours = (int)pts.total();
|
||||
bool manyContours = pts.kind() == _InputArray::STD_VECTOR_VECTOR ||
|
||||
pts.kind() == _InputArray::STD_VECTOR_MAT;
|
||||
int i, ncontours = manyContours ? (int)pts.total() : 1;
|
||||
if( ncontours == 0 )
|
||||
return;
|
||||
AutoBuffer<Point*> _ptsptr(ncontours);
|
||||
@@ -2370,7 +2373,7 @@ void cv::fillPoly(InputOutputArray _img, InputArrayOfArrays pts,
|
||||
|
||||
for( i = 0; i < ncontours; i++ )
|
||||
{
|
||||
Mat p = pts.getMat(i);
|
||||
Mat p = pts.getMat(manyContours ? i : -1);
|
||||
CV_Assert(p.checkVector(2, CV_32S) >= 0);
|
||||
ptsptr[i] = p.ptr<Point>();
|
||||
npts[i] = p.rows*p.cols*p.channels()/2;
|
||||
|
||||
Reference in New Issue
Block a user