### cv::goodFeaturesToTrack on a contour

Hi, I am trying to solve the following problem: given a contour found on a binary blob, I want to create a list of ordered corners in order to track them over time. Blobs are quite irregular, and can be convex or concave. I am already taking the n-first corners, among all of the results of the cv::goodFeaturesToTrack function, and they tends to coincide with the most evident corner of the blob (since it orders corners for score instead of position). Thus, I am taking this output and swapping corners by starting with the top-leftmost coordinate, and then order the corner over the contour. Not rotation invariant, but for this first version it can be ok.

The problem is that the pixel positions of the corners, although very close, are not always on a contour pixel (I am taking all of the contour pixels, and not the extrema, by using RETR_EXTERNAL or RETR_CC_COMP). Even if I call cv::cornerSubPix, output will be a closer pixel, but still not necessarily on the contour. I am solving by performing an hand-made local search, substituting my corner with the closest point among the contour. Anyway, such solution "void" all the efforts made with cv::cornerSubPix, giving me some point that lies on the line (very close to the corner, but not in that point). Is there any other solution to solve this problem? Moreover, since ordering a set of points among the contour is quite an easy task... why the output of cv::goodFeaturesToTrack on a contour does not necessarily gives me points lying on the contour? Is there some error I made, or is there any reason that I am ignoring?

Thank you very much for your help.