0

Here's the code I am using for Convexity Defects and have searched a lot online for its solution, unfortunately I have seen the question, but never a solution posted worked out, if someone has ever used Convexity Defects kindly help....

vector<vector <Vec4i> > convdefect(contours.size());
vector<vector<Point> >hull( contours.size() );
vector<vector<Point> >hull1( contours.size() );
vector<vector<int> >hull2;

if(hull2[i].size() > 3 && hull2[i].size() > 2  )
{
    convexityDefects(Mat(contours[i]),hull2[i],convdefect[i]);
}
  • How do we even know those indices you're using in the vector are valid? Use `at()` instead of `vector::operator [ ]` to verify that you are accessing valid entries in the vector. – PaulMcKenzie Nov 30 '15 at 17:25
  • Check my other answer [here](http://stackoverflow.com/a/31358401/5008845) – Miki Nov 30 '15 at 18:20
  • I have another code which works with [ ] but for satisfaction we have applied at(), but still the error continues..... – Anvesh Jadon Dec 03 '15 at 09:13

0 Answers0