vector hull;
vector defects;
convexHull(Mat(largest),hull,false);
convexityDefects(largest,hull,defects);
*largest i
The second argument of convexityDefects
has to be the type of vector<vector<int>
, while yours is vector<Point>
.
for hull you should use a vector of vectors like this:
vector<vector<Point>> hullsP( contours.size() );
vector<vector<int> > hullsI(contours.size());
and pass the "int" type to covexityDefects.like this :
vector<vector<Vec4i>> convdefect(contours.size());
for( int i = 0; i < contours.size(); i++ )
{
convexHull( Mat(contours[i]), hullsP[i], false );
convexHull( Mat(contours[i]), hullsI[i], false );
if(hullsI[i].size() > 3 )
convexityDefects(contours[i],hullsI[i],convdefect[i]);
}