xfeatures2d_PCTSignatures
import { xfeatures2d_PCTSignatures } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
Native object: release it with using or delete(). Factories can return null; check before calling methods. Inherits Algorithm.
Position-Color-Texture signatures Class implementing PCT (position-color-texture) signature extraction as described in [KrulisLS16]. The algorithm is divided to a feature sampler and a clusterizer. Feature sampler produces samples at given set of coordinates. Clusterizer then produces clusters of these samples using k-means algorithm. Resulting set of clusters is the signature of the input image.
A signature is an array of SIGNATURE_DIMENSION-dimensional points.
Used dimensions are:
weight, x, y position; lab color, contrast, entropy.
[KrulisLS16] [BeecksUS10]
Constructors and members
static create
Creates PCTSignatures algorithm using sample and seed count. It generates its own sets of sampling points and clusterization seed indexes.
create(initSampleCount: number, initSeedCount: number, pointDistribution: number): xfeatures2d_PCTSignatures | null;4 available overloads
create(): xfeatures2d_PCTSignatures | null;create(initSampleCount: number): xfeatures2d_PCTSignatures | null;create(initSampleCount: number, initSeedCount: number): xfeatures2d_PCTSignatures | null;create(initSampleCount: number, initSeedCount: number, pointDistribution: number): xfeatures2d_PCTSignatures | null;initSampleCountNumber of points used for image sampling.
initSeedCountNumber of initial clusterization seeds. Must be lower or equal to initSampleCount
pointDistributionDistribution of generated points. Default: UNIFORM. Available: UNIFORM, REGULAR, NORMAL.
Created algorithm.
static create1
Creates PCTSignatures algorithm using pre-generated sampling points and number of clusterization seeds. It uses the provided sampling points and generates its own clusterization seed indexes.
create1(initSamplingPoints: Point2fVector, initSeedCount: number): xfeatures2d_PCTSignatures | null;initSamplingPointsSampling points used in image sampling.
initSeedCountNumber of initial clusterization seeds. Must be lower or equal to initSamplingPoints.size().
Created algorithm.
static create2
Creates PCTSignatures algorithm using pre-generated sampling points and clusterization seeds indexes.
create2(initSamplingPoints: Point2fVector, initClusterSeedIndexes: IntVector): xfeatures2d_PCTSignatures | null;initSamplingPointsSampling points used in image sampling.
initClusterSeedIndexesIndexes of initial clusterization seeds. Its size must be lower or equal to initSamplingPoints.size().
Created algorithm.
static drawSignature
Draws signature in the source image and outputs the result. Signatures are visualized as a circle with radius based on signature weight and color based on signature color. Contrast and entropy are not visualized.
drawSignature(source: Mat, signature: Mat, result: Mat, radiusToShorterSideRatio: number, borderThickness: number): void;3 available overloads
drawSignature(source: Mat, signature: Mat, result: Mat): void;drawSignature(source: Mat, signature: Mat, result: Mat, radiusToShorterSideRatio: number): void;drawSignature(source: Mat, signature: Mat, result: Mat, radiusToShorterSideRatio: number, borderThickness: number): void;sourceSource image.
signatureImage signature.
resultOutput destination, filled by the native operation. Output result.
radiusToShorterSideRatioDetermines maximal radius of signature in the output image.
borderThicknessBorder thickness of the visualized signature.
static generateInitPoints
Generates initial sampling points according to selected point distribution.
Note: Generated coordinates are in range [0..1)
generateInitPoints(initPoints: Point2fVector, count: number, pointDistribution: number): void;initPointsOutput vector where the generated points will be saved.
countNumber of points to generate.
pointDistributionPoint distribution selector. Available: UNIFORM, REGULAR, NORMAL.
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;The this result.
computeSignature
Computes signature of given image.
computeSignature(image: Mat, signature: Mat): void;imageInput image of CV_8U type.
signatureOutput destination, filled by the native operation. Output computed signature.
computeSignatures
Computes signatures for multiple images in parallel.
computeSignatures(images: MatVector, signatures: MatVector): void;imagesVector of input images of CV_8U type.
signaturesVector of computed signatures.
getSampleCount
sampler *** Number of initial samples taken from the image.
getSampleCount(): number;The number result.
getGrayscaleBits
Color resolution of the greyscale bitmap represented in allocated bits (i.e., value 4 means that 16 shades of grey are used). The greyscale bitmap is used for computing contrast and entropy values.
getGrayscaleBits(): number;The number result.
setGrayscaleBits
Color resolution of the greyscale bitmap represented in allocated bits (i.e., value 4 means that 16 shades of grey are used). The greyscale bitmap is used for computing contrast and entropy values.
setGrayscaleBits(grayscaleBits: number): void;grayscaleBitsgrayscale bits argument (number).
getWindowRadius
Size of the texture sampling window used to compute contrast and entropy (center of the window is always in the pixel selected by x,y coordinates of the corresponding feature sample).
getWindowRadius(): number;The number result.
setWindowRadius
Size of the texture sampling window used to compute contrast and entropy (center of the window is always in the pixel selected by x,y coordinates of the corresponding feature sample).
setWindowRadius(radius: number): void;radiusradius argument (number).
getWeightX
Weights (multiplicative constants) that linearly stretch individual axes of the feature space (x,y = position; L,a,b = color in CIE Lab space; c = contrast. e = entropy)
getWeightX(): number;The number result.
setWeightX
Weights (multiplicative constants) that linearly stretch individual axes of the feature space (x,y = position; L,a,b = color in CIE Lab space; c = contrast. e = entropy)
setWeightX(weight: number): void;weightweight argument (number).
getWeightY
Weights (multiplicative constants) that linearly stretch individual axes of the feature space (x,y = position; L,a,b = color in CIE Lab space; c = contrast. e = entropy)
getWeightY(): number;The number result.
setWeightY
Weights (multiplicative constants) that linearly stretch individual axes of the feature space (x,y = position; L,a,b = color in CIE Lab space; c = contrast. e = entropy)
setWeightY(weight: number): void;weightweight argument (number).
getWeightL
Weights (multiplicative constants) that linearly stretch individual axes of the feature space (x,y = position; L,a,b = color in CIE Lab space; c = contrast. e = entropy)
getWeightL(): number;The number result.
setWeightL
Weights (multiplicative constants) that linearly stretch individual axes of the feature space (x,y = position; L,a,b = color in CIE Lab space; c = contrast. e = entropy)
setWeightL(weight: number): void;weightweight argument (number).
getWeightA
Weights (multiplicative constants) that linearly stretch individual axes of the feature space (x,y = position; L,a,b = color in CIE Lab space; c = contrast. e = entropy)
getWeightA(): number;The number result.
setWeightA
Weights (multiplicative constants) that linearly stretch individual axes of the feature space (x,y = position; L,a,b = color in CIE Lab space; c = contrast. e = entropy)
setWeightA(weight: number): void;weightweight argument (number).
getWeightB
Weights (multiplicative constants) that linearly stretch individual axes of the feature space (x,y = position; L,a,b = color in CIE Lab space; c = contrast. e = entropy)
getWeightB(): number;The number result.
setWeightB
Weights (multiplicative constants) that linearly stretch individual axes of the feature space (x,y = position; L,a,b = color in CIE Lab space; c = contrast. e = entropy)
setWeightB(weight: number): void;weightweight argument (number).
getWeightContrast
Weights (multiplicative constants) that linearly stretch individual axes of the feature space (x,y = position; L,a,b = color in CIE Lab space; c = contrast. e = entropy)
getWeightContrast(): number;The number result.
setWeightContrast
Weights (multiplicative constants) that linearly stretch individual axes of the feature space (x,y = position; L,a,b = color in CIE Lab space; c = contrast. e = entropy)
setWeightContrast(weight: number): void;weightweight argument (number).
getWeightEntropy
Weights (multiplicative constants) that linearly stretch individual axes of the feature space (x,y = position; L,a,b = color in CIE Lab space; c = contrast. e = entropy)
getWeightEntropy(): number;The number result.
setWeightEntropy
Weights (multiplicative constants) that linearly stretch individual axes of the feature space (x,y = position; L,a,b = color in CIE Lab space; c = contrast. e = entropy)
setWeightEntropy(weight: number): void;weightweight argument (number).
getSamplingPoints
Initial samples taken from the image. These sampled features become the input for clustering.
getSamplingPoints(): Point2fVector;The Point2fVector result. Release returned native handles with using or delete(), including handles nested in results.
setWeight
Weights (multiplicative constants) that linearly stretch individual axes of the feature space.
Note: WEIGHT_IDX = 0; X_IDX = 1; Y_IDX = 2; L_IDX = 3; A_IDX = 4; B_IDX = 5; CONTRAST_IDX = 6; ENTROPY_IDX = 7;
setWeight(idx: number, value: number): void;idxID of the weight
valueValue of the weight
setWeights
Weights (multiplicative constants) that linearly stretch individual axes of the feature space.
Note: WEIGHT_IDX = 0; X_IDX = 1; Y_IDX = 2; L_IDX = 3; A_IDX = 4; B_IDX = 5; CONTRAST_IDX = 6; ENTROPY_IDX = 7;
setWeights(weights: FloatVector): void;weightsValues of all weights.
setTranslation
Translations of the individual axes of the feature space.
Note: WEIGHT_IDX = 0; X_IDX = 1; Y_IDX = 2; L_IDX = 3; A_IDX = 4; B_IDX = 5; CONTRAST_IDX = 6; ENTROPY_IDX = 7;
setTranslation(idx: number, value: number): void;idxID of the translation
valueValue of the translation
setTranslations
Translations of the individual axes of the feature space.
Note: WEIGHT_IDX = 0; X_IDX = 1; Y_IDX = 2; L_IDX = 3; A_IDX = 4; B_IDX = 5; CONTRAST_IDX = 6; ENTROPY_IDX = 7;
setTranslations(translations: FloatVector): void;translationsValues of all translations.
setSamplingPoints
Sets sampling points used to sample the input image.
Note: Number of sampling points must be greater or equal to clusterization seed count.
setSamplingPoints(samplingPoints: Point2fVector): void;samplingPointsVector of sampling points in range [0..1)
getInitSeedIndexes
clusterizer *** Initial seeds (initial number of clusters) for the k-means algorithm.
getInitSeedIndexes(): IntVector;The IntVector result. Release returned native handles with using or delete(), including handles nested in results.
setInitSeedIndexes
Initial seed indexes for the k-means algorithm.
setInitSeedIndexes(initSeedIndexes: IntVector): void;initSeedIndexesinit seed indexes argument (IntVector).
getInitSeedCount
Number of initial seeds (initial number of clusters) for the k-means algorithm.
getInitSeedCount(): number;The number result.
getIterationCount
Number of iterations of the k-means clustering. We use fixed number of iterations, since the modified clustering is pruning clusters (not iteratively refining k clusters).
getIterationCount(): number;The number result.
setIterationCount
Number of iterations of the k-means clustering. We use fixed number of iterations, since the modified clustering is pruning clusters (not iteratively refining k clusters).
setIterationCount(iterationCount: number): void;iterationCountiteration count argument (number).
getMaxClustersCount
Maximal number of generated clusters. If the number is exceeded, the clusters are sorted by their weights and the smallest clusters are cropped.
getMaxClustersCount(): number;The number result.
setMaxClustersCount
Maximal number of generated clusters. If the number is exceeded, the clusters are sorted by their weights and the smallest clusters are cropped.
setMaxClustersCount(maxClustersCount: number): void;maxClustersCountmax clusters count argument (number).
getClusterMinSize
This parameter multiplied by the index of iteration gives lower limit for cluster size. Clusters containing fewer points than specified by the limit have their centroid dismissed and points are reassigned.
getClusterMinSize(): number;The number result.
setClusterMinSize
This parameter multiplied by the index of iteration gives lower limit for cluster size. Clusters containing fewer points than specified by the limit have their centroid dismissed and points are reassigned.
setClusterMinSize(clusterMinSize: number): void;clusterMinSizecluster min size argument (number).
getJoiningDistance
Threshold euclidean distance between two centroids. If two cluster centers are closer than this distance, one of the centroid is dismissed and points are reassigned.
getJoiningDistance(): number;The number result.
setJoiningDistance
Threshold euclidean distance between two centroids. If two cluster centers are closer than this distance, one of the centroid is dismissed and points are reassigned.
setJoiningDistance(joiningDistance: number): void;joiningDistancejoining distance argument (number).
getDropThreshold
Remove centroids in k-means whose weight is lesser or equal to given threshold.
getDropThreshold(): number;The number result.
setDropThreshold
Remove centroids in k-means whose weight is lesser or equal to given threshold.
setDropThreshold(dropThreshold: number): void;dropThresholddrop threshold argument (number).
getDistanceFunction
Distance function selector used for measuring distance between two points in k-means.
getDistanceFunction(): number;The number result.
setDistanceFunction
Distance function selector used for measuring distance between two points in k-means. Available: L0_25, L0_5, L1, L2, L2SQUARED, L5, L_INFINITY.
setDistanceFunction(distanceFunction: number): void;distanceFunctiondistance function argument (number).
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.