I have a black and white image made up of lines, like the following:
I am trying to get the points that can describe the curve, so essentially the contour. However, contours trace the boundary, and so in the case of lines, it traces from start to end, and then back to start.
I am getting the contour as follows:
cv::findContours(src, contours, hierarchy, cv::RETR_TREE, cv::CHAIN_APPROX_NONE);
To try and get rid of points that are represented by backtracking i am running
approxPolyDP(contour, contour, epsilon, true); However this still leaves points on the way back.
Is there a better way of solving this problem? My line drawings can be more complicated that this one.