There is fillPoly bugs on the bellow overload function in drawing folder, It must change as polylines function:
void cv::fillPoly(InputOutputArray img, InputArrayOfArrays pts,
const Scalar& color, int lineType, int shift, Point offset)
{
CV_INSTRUMENT_REGION();
int i, ncontours = (int)pts.total();
if( ncontours == 0 )
return;
AutoBuffer<Point*> _ptsptr(ncontours);
AutoBuffer<int> _npts(ncontours);
Point** ptsptr = _ptsptr.data();
int* npts = _npts.data();
for( i = 0; i < ncontours; i++ )
{
Mat p = pts.getMat(i);
CV_Assert(p.checkVector(2, CV_32S) >= 0);
ptsptr[i] = p.ptr<Point>();
npts[i] = p.rows*p.cols*p.channels()/2;
}
fillPoly(img, (const Point**)ptsptr, npts, (int)ncontours, color, lineType, shift, offset);
}
void cv::polylines(InputOutputArray img, InputArrayOfArrays pts,
bool isClosed, const Scalar& color,
int thickness, int lineType, int shift)
{
CV_INSTRUMENT_REGION();
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);
AutoBuffer<int> _npts(ncontours);
Point** ptsptr = _ptsptr.data();
int* npts = _npts.data();
for( i = 0; i < ncontours; i++ )
{
Mat p = pts.getMat(manyContours ? i : -1);
if( p.total() == 0 )
{
ptsptr[i] = NULL;
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;
}
polylines(img, (const Point**)ptsptr, npts, (int)ncontours, isClosed, color, thickness, lineType, shift);
}
int i, ncontours = (int)pts.total();
System information (version)
Detailed description
There is fillPoly bugs on the bellow overload function in drawing folder, It must change as polylines function:
Steps to reproduce
We have to change after CV_INSTRUMENT_REGION();
until if( ncontours == 0 )
It is ncontours number problem it generate error
should let
replace by
bool manyContours = pts.kind() == _InputArray::STD_VECTOR_VECTOR ||
pts.kind() == _InputArray::STD_VECTOR_MAT;
int i, ncontours = manyContours ? (int)pts.total() : 1;
Issue submission checklist
answers.opencv.org, Stack Overflow, etc and have not found solution