1 | initial version |
ah, easy "out of bounds" error:
your contours
vector is initially empty, so contours.size() is 0, and you allocate 0 elements in your vector<Point2f>center( contours.size() );
, so center[i]
is invalid (same for radius).
move the allocation to a stage, where you know how many contours you have , like:
if (contours.size() > 0){
vector<Point2f>center( contours.size() );
vector<float>radius_cur( contours.size() );
...