PlanarGC  1.0.2
 All Data Structures Functions Variables Enumerations Enumerator Friends Pages
CutShape Class Reference

#include <CutShape.h>

Public Types

enum  DTWMode {
  VERTEX_BASED,
  EDGE_BASED
}

Public Member Functions

 CutShape ()
 ~CutShape ()
void setDissimilarityMatrix (int n, double *dissimilarity, DTWMode mode=EDGE_BASED)
double getMatchingScore ()
std::vector< std::pair< int,
int > > 
getMatching ()

Detailed Description

CutShape provides an interface to the classical DTW-based shape matching between two different shapes. Because a graph cut approach is used, the runtime complexity is almost quadratic instead of being cubic for the naive approach.
The only thing that has to be provided by the user is the dissimilarity matrix of any pair of points (pt1,pt2) where pt1 is a point on the first and pt2 is a point on the second shape (see setDissimilarityMatrix). Afterwards the dissimilarity between two shapes can be obtained via getMatchingScore and the explicit matching can be extracted via getMatching.

Examples:
cutshape.cpp.

Member Enumeration Documentation

Enumerator:
VERTEX_BASED 

the cost of a matching path is the sum of its vertices' costs

EDGE_BASED 

the cost of a matching path is the sum of its edges' costs The cost of every edge is defined as the average cost of its vertices' costs scaled by the length of the edge. This is more consistent than the vertex based interpretation of the dissimilarity matrix.

Constructor & Destructor Documentation

CutShape::CutShape ( )
inline

the constructor sets all fields to 0.

CutShape::~CutShape ( )

the destructor frees the memory consumed so far.

Member Function Documentation

void CutShape::setDissimilarityMatrix ( int  n,
double *  dissimilarity,
DTWMode  mode = EDGE_BASED 
)

defines the dissimilarity score between two points on two different shapes.

Parameters
nEach shape is discretized by n shape points.
dissimilaritydissimilarity stores n*n dissimilarity values. The dissimilarity between the point x (starting at 0) of the first shape and the point y (starting at 0) of the second shape, is stored in dissimilarity[x+y*n].
modesee DTWMode
Examples:
cutshape.cpp.

References PlanarEdge::setEdge(), and PlanarVertex::setEdgesCCW().

double CutShape::getMatchingScore ( )
inline

returns the dissimilarity between the two shapes.

Examples:
cutshape.cpp.
std::vector< std::pair< int, int > > CutShape::getMatching ( )
inline

returns the optimal matching between two different shapes.
The return value consist of k different pairs with n<k<2n, where the first element of the pair represents a point of the first shape and the second element of the pair represents a point of the second shape.

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