Class cv::xfeatures2d::PCTSignatures#
Class implementing PCT (position-color-texture) signature extraction as described in [171]. 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. View details
#include <opencv2/xfeatures2d.hpp>Collaboration diagram for cv::xfeatures2d::PCTSignatures:
Public Types#
Lp distance function selector.
enum DistanceFunction {
L0_25,
L0_5,
L1,
L2,
L2SQUARED,
L5,
L_INFINITY
}Point distributions supported by random point generator.
enum PointDistribution {
UNIFORM,
REGULAR,
NORMAL
}Similarity function selector.
enum SimilarityFunction {
MINUS,
GAUSSIAN,
HEURISTIC
}Public Member Functions#
Public Member Functions inherited from cv::Algorithm
Return |
Name |
Description |
|---|---|---|
|
Clears the algorithm state. |
|
|
Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read. |
|
|
Reads algorithm parameters from a file storage. |
|
|
||
|
|
|
|
Stores algorithm parameters in a file storage. |
|
|
Static Public Member Functions#
Static Public Member Functions inherited from cv::Algorithm
Return |
Name |
Description |
|---|---|---|
|
|
Loads algorithm from the file. |
|
|
Loads algorithm from a String. |
|
Reads algorithm from the file node. |
Additional Inherited Members#
Protected Member Functions inherited from cv::Algorithm
Return |
Name |
Description |
|---|---|---|
|
Detailed Description#
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
Member Enumeration Documentation#
enum DistanceFunction
Lp distance function selector.
enum PointDistribution
Point distributions supported by random point generator.
|
Generate numbers uniformly. |
|
Generate points in a regular grid. |
|
Generate points with normal (gaussian) distribution. |
enum SimilarityFunction
Similarity function selector.
|
\[
-d(c_i, c_j)
\]
|
|
\[
e^{ -\alpha * d^2(c_i, c_j)}
\]
|
|
\[
\frac{1}{\alpha + d(c_i, c_j)}
\]
|
Member Function Documentation#
create()#
static Ptr< PCTSignatures > cv::xfeatures2d::PCTSignatures::create(
const int initSampleCount = 2000,
const int initSeedCount = 400,
const int pointDistribution = 0 )
Creates PCTSignatures algorithm using sample and seed count. It generates its own sets of sampling points and clusterization seed indexes.
Parameters
initSampleCount— Number of points used for image sampling.initSeedCount— Number of initial clusterization seeds. Must be lower or equal to initSampleCountpointDistribution— Distribution of generated points. Default: UNIFORM. Available: UNIFORM, REGULAR, NORMAL.
Returns
Created algorithm.
create()#
static Ptr< PCTSignatures > cv::xfeatures2d::PCTSignatures::create(
const std::vector< Point2f > & initSamplingPoints,
const int initSeedCount )
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.
Parameters
initSamplingPoints— Sampling points used in image sampling.initSeedCount— Number of initial clusterization seeds. Must be lower or equal to initSamplingPoints.size().
Returns
Created algorithm.
create()#
static Ptr< PCTSignatures > cv::xfeatures2d::PCTSignatures::create(
const std::vector< Point2f > & initSamplingPoints,
const std::vector< int > & initClusterSeedIndexes )
Creates PCTSignatures algorithm using pre-generated sampling points and clusterization seeds indexes.
Parameters
initSamplingPoints— Sampling points used in image sampling.initClusterSeedIndexes— Indexes of initial clusterization seeds. Its size must be lower or equal to initSamplingPoints.size().
Returns
Created algorithm.
drawSignature()#
static void cv::xfeatures2d::PCTSignatures::drawSignature(
InputArray source,
InputArray signature,
OutputArray result,
float radiusToShorterSideRatio = 1.0/8,
int borderThickness = 1 )
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.
Parameters
source— Source image.signature— Image signature.result— Output result.radiusToShorterSideRatio— Determines maximal radius of signature in the output image.borderThickness— Border thickness of the visualized signature.
generateInitPoints()#
static void cv::xfeatures2d::PCTSignatures::generateInitPoints(
std::vector< Point2f > & initPoints,
const int count,
int pointDistribution )
Generates initial sampling points according to selected point distribution.
Note
Generated coordinates are in range [0..1)
Parameters
initPoints— Output vector where the generated points will be saved.count— Number of points to generate.pointDistribution— Point distribution selector. Available: UNIFORM, REGULAR, NORMAL.
computeSignature()#
void cv::xfeatures2d::PCTSignatures::computeSignature(
InputArray image,
OutputArray signature )
Computes signature of given image.
Parameters
image— Input image of CV_8U type.signature— Output computed signature.
computeSignatures()#
void cv::xfeatures2d::PCTSignatures::computeSignatures(
const std::vector< Mat > & images,
std::vector< Mat > & signatures )
Computes signatures for multiple images in parallel.
Parameters
images— Vector of input images of CV_8U type.signatures— Vector of computed signatures.
getClusterMinSize()#
int cv::xfeatures2d::PCTSignatures::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.
getDistanceFunction()#
int cv::xfeatures2d::PCTSignatures::getDistanceFunction()
Distance function selector used for measuring distance between two points in k-means.
getDropThreshold()#
float cv::xfeatures2d::PCTSignatures::getDropThreshold()
Remove centroids in k-means whose weight is lesser or equal to given threshold.
getGrayscaleBits()#
int cv::xfeatures2d::PCTSignatures::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.
getInitSeedCount()#
int cv::xfeatures2d::PCTSignatures::getInitSeedCount()
Number of initial seeds (initial number of clusters) for the k-means algorithm.
getInitSeedIndexes()#
std::vector< int > cv::xfeatures2d::PCTSignatures::getInitSeedIndexes()
Initial seeds (initial number of clusters) for the k-means algorithm.
getIterationCount()#
int cv::xfeatures2d::PCTSignatures::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).
getJoiningDistance()#
float cv::xfeatures2d::PCTSignatures::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.
getMaxClustersCount()#
int cv::xfeatures2d::PCTSignatures::getMaxClustersCount()
Maximal number of generated clusters. If the number is exceeded, the clusters are sorted by their weights and the smallest clusters are cropped.
getSampleCount()#
int cv::xfeatures2d::PCTSignatures::getSampleCount()
Number of initial samples taken from the image.
getSamplingPoints()#
std::vector< Point2f > cv::xfeatures2d::PCTSignatures::getSamplingPoints()
Initial samples taken from the image. These sampled features become the input for clustering.
getWeightA()#
float cv::xfeatures2d::PCTSignatures::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)
getWeightB()#
float cv::xfeatures2d::PCTSignatures::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)
getWeightContrast()#
float cv::xfeatures2d::PCTSignatures::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)
getWeightEntropy()#
float cv::xfeatures2d::PCTSignatures::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)
getWeightL()#
float cv::xfeatures2d::PCTSignatures::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)
getWeightX()#
float cv::xfeatures2d::PCTSignatures::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)
getWeightY()#
float cv::xfeatures2d::PCTSignatures::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)
getWindowRadius()#
int cv::xfeatures2d::PCTSignatures::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).
setClusterMinSize()#
void cv::xfeatures2d::PCTSignatures::setClusterMinSize(int clusterMinSize)
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.
setDistanceFunction()#
void cv::xfeatures2d::PCTSignatures::setDistanceFunction(int distanceFunction)
Distance function selector used for measuring distance between two points in k-means. Available: L0_25, L0_5, L1, L2, L2SQUARED, L5, L_INFINITY.
setDropThreshold()#
void cv::xfeatures2d::PCTSignatures::setDropThreshold(float dropThreshold)
Remove centroids in k-means whose weight is lesser or equal to given threshold.
setGrayscaleBits()#
void cv::xfeatures2d::PCTSignatures::setGrayscaleBits(int grayscaleBits)
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.
setInitSeedIndexes()#
void cv::xfeatures2d::PCTSignatures::setInitSeedIndexes(std::vector< int > initSeedIndexes)
Initial seed indexes for the k-means algorithm.
setIterationCount()#
void cv::xfeatures2d::PCTSignatures::setIterationCount(int iterationCount)
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).
setJoiningDistance()#
void cv::xfeatures2d::PCTSignatures::setJoiningDistance(float joiningDistance)
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.
setMaxClustersCount()#
void cv::xfeatures2d::PCTSignatures::setMaxClustersCount(int maxClustersCount)
Maximal number of generated clusters. If the number is exceeded, the clusters are sorted by their weights and the smallest clusters are cropped.
setSamplingPoints()#
void cv::xfeatures2d::PCTSignatures::setSamplingPoints(std::vector< Point2f > samplingPoints)
Sets sampling points used to sample the input image.
Note
Number of sampling points must be greater or equal to clusterization seed count.
Parameters
samplingPoints— Vector of sampling points in range [0..1)
setTranslation()#
void cv::xfeatures2d::PCTSignatures::setTranslation(
int idx,
float value )
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;
Parameters
idx— ID of the translationvalue— Value of the translation
setTranslations()#
void cv::xfeatures2d::PCTSignatures::setTranslations(const std::vector< float > & translations)
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;
Parameters
translations— Values of all translations.
setWeight()#
void cv::xfeatures2d::PCTSignatures::setWeight(
int idx,
float value )
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;
Parameters
idx— ID of the weightvalue— Value of the weight
setWeightA()#
void cv::xfeatures2d::PCTSignatures::setWeightA(float weight)
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()#
void cv::xfeatures2d::PCTSignatures::setWeightB(float weight)
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()#
void cv::xfeatures2d::PCTSignatures::setWeightContrast(float weight)
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()#
void cv::xfeatures2d::PCTSignatures::setWeightEntropy(float weight)
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()#
void cv::xfeatures2d::PCTSignatures::setWeightL(float weight)
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)
setWeights()#
void cv::xfeatures2d::PCTSignatures::setWeights(const std::vector< float > & weights)
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;
Parameters
weights— Values of all weights.
setWeightX()#
void cv::xfeatures2d::PCTSignatures::setWeightX(float weight)
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()#
void cv::xfeatures2d::PCTSignatures::setWeightY(float weight)
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)
setWindowRadius()#
void cv::xfeatures2d::PCTSignatures::setWindowRadius(int radius)
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).
Source file#
The documentation for this class was generated from the following file:
opencv2/xfeatures2d.hpp