Błąd cv :: convexityDefects OpenCV C ++

vector<Point> hull;
vector<Point> defects;
convexHull(Mat(largest),hull,false);
convexityDefects(largest,hull,defects);

*Największa to mój największy kontur na obrazie

Ale defekty Convexity dają mi ten błąd "Asercja nie powiodła się (hull.checkVector (1, CV_32S)> 2)". Ktoś proszę mi pomóc, nie chcę uciekać się do używania rozwiązania C.

EDYCJA

vector<int> hull;
vector<Point> defects;
convexHull(Mat(largest),hull,false);

vector<vector<int>> testhull;
testhull.push_back(hull);
convexityDefects(largest,testhull,defects);

Próbowałem zrobić z tym typemvector<vector<int>> przed przekazaniem go do convexityDefects, ale convexityDefects nadal daje mi błąd „Asercja nie powiodła się (ptnum> 3) ..”.

questionAnswers(2)

yourAnswerToTheQuestion