1 | initial version |
vector<vector<point> >hull( contours.size() ); does not initialize the vector with all the contours data. What you want to do is probably :
enter vector<vector<point> >hull();
hull.insert(hull.begin(),contours.begin(),contours.end());
That will copy all the contents of contours into hull, which is how I do it. Vectors aren't like arrays in C++ because they are dynamic, so when you use hull.size(), it returns zero because you haven't put anything into the vector yet. I hope that helps!
2 | No.2 Revision |
vector<vector<point> >hull( contours.size() ); does not initialize the vector with all the contours data. What you want to do is probably :
enter vector<vector<point> >hull();
hull.insert(hull.begin(),contours.begin(),contours.end());
That will copy all the contents of contours into hull, which is how I do it. Vectors aren't like arrays in C++ because they are dynamic, so when you use hull.size(), it returns zero because you haven't put anything into the vector yet. I hope that helps!
3 | No.3 Revision |
vector<vector<point> >hull( contours.size() ); does not initialize the vector with all the contours data. What you want to do is probably :
:
vector<vector<point> >hull();
hull.insert(hull.begin(),contours.begin(),contours.end());
hull.insert(hull.begin(),contours.begin(),contours.end()); That will copy all the contents of contours into hull, which is how I do it. Vectors aren't like arrays in C++ because they are dynamic, so when you use hull.size(), it returns zero because you haven't put anything into the vector yet. I hope that helps!
4 | No.4 Revision |
vector<vector<point> >hull( contours.size() ); does not initialize the vector with all the contours data. What you want to do is probably :
:
vector<vector<point> >hull();
hull.insert(hull.begin(),contours.begin(),contours.end());hull.insert(hull.begin(),contours.begin(),contours.end());
That will copy all the contents of contours into hull, which is how I do it. Vectors aren't like arrays in C++ because they are dynamic, so when you use hull.size(), it returns zero because you haven't put anything into the vector yet. I hope that helps!