#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 () |
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.
enum CutShape::DTWMode |
|
inline |
the constructor sets all fields to 0.
CutShape::~CutShape | ( | ) |
the destructor frees the memory consumed so far.
void CutShape::setDissimilarityMatrix | ( | int | n, |
double * | dissimilarity, | ||
DTWMode | mode = EDGE_BASED |
||
) |
defines the dissimilarity score between two points on two different shapes.
n | Each shape is discretized by n shape points. |
dissimilarity | dissimilarity 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]. |
mode | see DTWMode |
References PlanarEdge::setEdge(), and PlanarVertex::setEdgesCCW().
|
inline |
returns the dissimilarity between the two shapes.
|
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.