CutShape finds an optimal matching between two shapes via a graph cut. The only thing the user has to provide is a quadratic dissimilarity matrix where the non-negative value at position (i,j) describes the dissimilarity between the point i on the first shape and the point j on the second shape.
In order to compute the optimal matching (which is a cut in a specific planar graph), the following steps have to be performed:
In the following sections, we explain these steps with respect to the graph sketched in the images above.
After computing a nxn dissimilarity of every point pair, we just have to provide this information to the CutShape instance:
Now that the problem is formulated, we have to compute the matching score. This is the most time consuming method of the class and is called via
In order to receive the matching, we just have to extract it via:
The complete code can be seen here: cutshape.cpp.