Class cv::ShapeContextDistanceExtractor#

Implementation of the Shape Context descriptor and matching algorithm. View details

Collaboration diagram for cv::ShapeContextDistanceExtractor:

Public Member Functions#

Public Member Functions inherited from cv::ShapeDistanceExtractor

Return

Name

Description

float

computeDistance(
    InputArray contour1,
    InputArray contour2 )

Compute the shape distance between two shapes defined by its contours.

Public Member Functions inherited from cv::Algorithm

Return

Name

Description

Algorithm()

~Algorithm()

void

clear()

Clears the algorithm state.

bool

empty()

Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read.

String

getDefaultName()

void

read(const FileNode & fn)

Reads algorithm parameters from a file storage.

void

save(const String & filename)

void

write(
    const Ptr< FileStorage > & fs,
    const String & name = String() )

void

write(FileStorage & fs)

Stores algorithm parameters in a file storage.

void

write(
    FileStorage & fs,
    const String & name )

Static Public Member Functions#

Static Public Member Functions inherited from cv::Algorithm

Return

Name

Description

static Ptr< _Tp >

load(
    const String & filename,
    const String & objname = String() )

Loads algorithm from the file.

static Ptr< _Tp >

loadFromString(
    const String & strModel,
    const String & objname = String() )

Loads algorithm from a String.

static Ptr< _Tp >

read(const FileNode & fn)

Reads algorithm from the file node.

Additional Inherited Members#

Protected Member Functions inherited from cv::Algorithm

Return

Name

Description

void

writeFormat(FileStorage & fs)

Detailed Description#

Implementation of the Shape Context descriptor and matching algorithm.

proposed by Belongie et al. in “Shape Matching and Object Recognition Using Shape Contexts” (PAMI 2002). This implementation is packaged in a generic scheme, in order to allow you the implementation of the common variations of the original pipeline.

Member Function Documentation#

getAngularBins()#

int cv::ShapeContextDistanceExtractor::getAngularBins()

getBendingEnergyWeight()#

float cv::ShapeContextDistanceExtractor::getBendingEnergyWeight()

getCostExtractor()#

Ptr< HistogramCostExtractor > cv::ShapeContextDistanceExtractor::getCostExtractor()

getImageAppearanceWeight()#

float cv::ShapeContextDistanceExtractor::getImageAppearanceWeight()

getImages()#

void cv::ShapeContextDistanceExtractor::getImages(
OutputArray image1,
OutputArray image2 )

getInnerRadius()#

float cv::ShapeContextDistanceExtractor::getInnerRadius()

getIterations()#

int cv::ShapeContextDistanceExtractor::getIterations()

getOuterRadius()#

float cv::ShapeContextDistanceExtractor::getOuterRadius()

getRadialBins()#

int cv::ShapeContextDistanceExtractor::getRadialBins()

getRotationInvariant()#

bool cv::ShapeContextDistanceExtractor::getRotationInvariant()

getShapeContextWeight()#

float cv::ShapeContextDistanceExtractor::getShapeContextWeight()

getStdDev()#

float cv::ShapeContextDistanceExtractor::getStdDev()

getTransformAlgorithm()#

Ptr< ShapeTransformer > cv::ShapeContextDistanceExtractor::getTransformAlgorithm()

setAngularBins()#

void cv::ShapeContextDistanceExtractor::setAngularBins(int nAngularBins)

Establish the number of angular bins for the Shape Context Descriptor used in the shape matching pipeline.

Parameters

  • nAngularBins — The number of angular bins in the shape context descriptor.

setBendingEnergyWeight()#

void cv::ShapeContextDistanceExtractor::setBendingEnergyWeight(float bendingEnergyWeight)

Set the weight of the Bending Energy in the final value of the shape distance. The bending energy definition depends on what transformation is being used to align the shapes. The final value of the shape distance is a user-defined linear combination of the shape context distance, an image appearance distance, and a bending energy.

Parameters

  • bendingEnergyWeight — The weight of the Bending Energy in the final distance value.

setCostExtractor()#

void cv::ShapeContextDistanceExtractor::setCostExtractor(Ptr< HistogramCostExtractor > comparer)

Set the algorithm used for building the shape context descriptor cost matrix.

Parameters

  • comparer — Smart pointer to a HistogramCostExtractor, an algorithm that defines the cost matrix between descriptors.

setImageAppearanceWeight()#

void cv::ShapeContextDistanceExtractor::setImageAppearanceWeight(float imageAppearanceWeight)

Set the weight of the Image Appearance cost in the final value of the shape distance. The image appearance cost is defined as the sum of squared brightness differences in Gaussian windows around corresponding image points. The final value of the shape distance is a user-defined linear combination of the shape context distance, an image appearance distance, and a bending energy. If this value is set to a number different from 0, is mandatory to set the images that correspond to each shape.

Parameters

  • imageAppearanceWeight — The weight of the appearance cost in the final distance value.

setImages()#

void cv::ShapeContextDistanceExtractor::setImages(
InputArray image1,
InputArray image2 )

Set the images that correspond to each shape. This images are used in the calculation of the Image Appearance cost.

Parameters

  • image1 — Image corresponding to the shape defined by contours1.

  • image2 — Image corresponding to the shape defined by contours2.

setInnerRadius()#

void cv::ShapeContextDistanceExtractor::setInnerRadius(float innerRadius)

Set the inner radius of the shape context descriptor.

Parameters

  • innerRadius — The value of the inner radius.

setIterations()#

void cv::ShapeContextDistanceExtractor::setIterations(int iterations)

setOuterRadius()#

void cv::ShapeContextDistanceExtractor::setOuterRadius(float outerRadius)

Set the outer radius of the shape context descriptor.

Parameters

  • outerRadius — The value of the outer radius.

setRadialBins()#

void cv::ShapeContextDistanceExtractor::setRadialBins(int nRadialBins)

Establish the number of radial bins for the Shape Context Descriptor used in the shape matching pipeline.

Parameters

  • nRadialBins — The number of radial bins in the shape context descriptor.

setRotationInvariant()#

void cv::ShapeContextDistanceExtractor::setRotationInvariant(bool rotationInvariant)

setShapeContextWeight()#

void cv::ShapeContextDistanceExtractor::setShapeContextWeight(float shapeContextWeight)

Set the weight of the shape context distance in the final value of the shape distance. The shape context distance between two shapes is defined as the symmetric sum of shape context matching costs over best matching points. The final value of the shape distance is a user-defined linear combination of the shape context distance, an image appearance distance, and a bending energy.

Parameters

  • shapeContextWeight — The weight of the shape context distance in the final distance value.

setStdDev()#

void cv::ShapeContextDistanceExtractor::setStdDev(float sigma)

Set the value of the standard deviation for the Gaussian window for the image appearance cost.

Parameters

  • sigma — Standard Deviation.

setTransformAlgorithm()#

void cv::ShapeContextDistanceExtractor::setTransformAlgorithm(Ptr< ShapeTransformer > transformer)

Set the algorithm used for aligning the shapes.

Parameters

  • transformer — Smart pointer to a ShapeTransformer, an algorithm that defines the aligning transformation.

Source file#

The documentation for this class was generated from the following file: