OpenCV C ++ cv :: convexityDefects error
vector<Point> hull;
vector<Point> defects;
convexHull(Mat(largest),hull,false);
convexityDefects(largest,hull,defects);
*mas grande Es mi contorno más grande en la imagen.
Pero el convexityDefects me da este error "Falló la afirmación (hull.checkVector (1, CV_32S)> 2)". Alguien, por favor, ayúdeme, no quiero recurrir al uso de la solución C.
Editado
vector<int> hull;
vector<Point> defects;
convexHull(Mat(largest),hull,false);
vector<vector<int>> testhull;
testhull.push_back(hull);
convexityDefects(largest,testhull,defects);
Intenté hacerlo con el tipovector<vector<int>>
antes de pasarlo a convexityDefects pero convexityDefects todavía me da el error "Falló la afirmación (ptnum> 3) ..".