Skip to content

ShapeContextDistanceExtractor

shapeclassOpenCV 5.0.0
import { ShapeContextDistanceExtractor } from '@banou/opencv-wasm'

Use after await initOpenCV(). See the initialization and named imports guide.

ARGUMENTSConstructor or factory
CLASSShapeContextDistanceExtractor
RETURN TYPEOwned native handle
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Native object: release it with using or delete(). Factories can return null; check before calling methods. Inherits ShapeDistanceExtractor.

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.

Constructors and members

clone

Create another handle to the same native object. This retains the object without copying its pixels or algorithm state; dispose both handles separately.

clone(): this;
Returns

The this result.

setAngularBins

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

setAngularBins(nAngularBins: number): void;
nAngularBins

The number of angular bins in the shape context descriptor.

getAngularBins

Read the angular bins.

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

getAngularBins(): number;
Returns

The number result.

setRadialBins

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

setRadialBins(nRadialBins: number): void;
nRadialBins

The number of radial bins in the shape context descriptor.

getRadialBins

Read the radial bins.

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

getRadialBins(): number;
Returns

The number result.

setInnerRadius

Set the inner radius of the shape context descriptor.

setInnerRadius(innerRadius: number): void;
innerRadius

The value of the inner radius.

getInnerRadius

Read the inner radius.

Set the inner radius of the shape context descriptor.

getInnerRadius(): number;
Returns

The number result.

setOuterRadius

Set the outer radius of the shape context descriptor.

setOuterRadius(outerRadius: number): void;
outerRadius

The value of the outer radius.

getOuterRadius

Read the outer radius.

Set the outer radius of the shape context descriptor.

getOuterRadius(): number;
Returns

The number result.

setRotationInvariant

Set the rotation invariant used by this ShapeContextDistanceExtractor object.

setRotationInvariant(rotationInvariant: boolean): void;
rotationInvariant

rotation invariant argument (boolean).

getRotationInvariant

Return the rotation invariant configured on this ShapeContextDistanceExtractor object.

getRotationInvariant(): boolean;
Returns

The boolean result.

setShapeContextWeight

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.

setShapeContextWeight(shapeContextWeight: number): void;
shapeContextWeight

The weight of the shape context distance in the final distance value.

getShapeContextWeight

Read the shape context weight.

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.

getShapeContextWeight(): number;
Returns

The number result.

setImageAppearanceWeight

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.

setImageAppearanceWeight(imageAppearanceWeight: number): void;
imageAppearanceWeight

The weight of the appearance cost in the final distance value.

getImageAppearanceWeight

Read the image appearance weight.

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.

getImageAppearanceWeight(): number;
Returns

The number result.

setBendingEnergyWeight

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.

setBendingEnergyWeight(bendingEnergyWeight: number): void;
bendingEnergyWeight

The weight of the Bending Energy in the final distance value.

getBendingEnergyWeight

Read the bending energy weight.

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.

getBendingEnergyWeight(): number;
Returns

The number result.

setImages

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

setImages(image1: Mat, image2: Mat): void;
image1

Image corresponding to the shape defined by contours1.

image2

Image corresponding to the shape defined by contours2.

getImages

Read the images.

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

getImages(image1: Mat, image2: Mat): void;
image1

Output destination, filled by the native operation. image1 argument (Mat).

image2

Output destination, filled by the native operation. image2 argument (Mat).

setIterations

Set the iterations used by this ShapeContextDistanceExtractor object.

setIterations(iterations: number): void;
iterations

iterations argument (number).

getIterations

Return the iterations configured on this ShapeContextDistanceExtractor object.

getIterations(): number;
Returns

The number result.

setCostExtractor

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

setCostExtractor(comparer: HistogramCostExtractor | null): void;
comparer

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

getCostExtractor

Read the cost extractor.

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

getCostExtractor(): HistogramCostExtractor | null;
Returns

The HistogramCostExtractor | null result.

setStdDev

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

setStdDev(sigma: number): void;
sigma

Standard Deviation.

getStdDev

Read the std dev.

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

getStdDev(): number;
Returns

The number result.

setTransformAlgorithm

Set the algorithm used for aligning the shapes.

setTransformAlgorithm(transformer: ShapeTransformer | null): void;
transformer

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

getTransformAlgorithm

Read the transform algorithm.

Set the algorithm used for aligning the shapes.

getTransformAlgorithm(): ShapeTransformer | null;
Returns

The ShapeTransformer | null result.

These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.