PlanarGC  1.0.2
 All Data Structures Functions Variables Enumerations Enumerator Friends Pages
Tutorial: CutShape

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.

dissim.PNG
Example of a dissimilarity matrix

In order to compute the optimal matching (which is a cut in a specific planar graph), the following steps have to be performed:

  1. Define the dissimilarity matrix.
  2. Compute the matching score.
  3. Extract the optimal matching.

In the following sections, we explain these steps with respect to the graph sketched in the images above.

Dissimilarity Matrix

After computing a nxn dissimilarity of every point pair, we just have to provide this information to the CutShape instance:

CutShape shape_cut;
shape_cut.setDissimilarityMatrix(n, dissim);

Matching Score

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

double score;
score = shape_cut.getMatchingScore();

Optimal Matching

In order to receive the matching, we just have to extract it via:

vector< pair<int,int> > matching;
matching = shape_cut.getMatching();

The complete code can be seen here: cutshape.cpp.

© 2009 - 2013 by Eno Töppe, Frank R. Schmidt
generated by Doxygen