1 | initial version |
That is fairly simple. Each contour is in fact in the backend a vector<Point>
. However, it is quite random in which way the start and end point are defined, based on the internal logic and the edges found during the process. If you don't mind that the position selected is kind of random, then you can find those points by
vector<Point> single_contour = contours[0];
Point begin = single_contour[0];
int lenght = single_contour.size();
Point end = single_contour[length-1];