OpenCV
3.3.0
Open Source Computer Vision
|
Class implementing PCT (position-color-texture) signature extraction as described in [92]. 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. More...
#include "xfeatures2d.hpp"
Public Types | |
enum | DistanceFunction { L0_25, L0_5, L1, L2, L2SQUARED, L5, L_INFINITY } |
Lp distance function selector. More... | |
enum | PointDistribution { UNIFORM, REGULAR, NORMAL } |
Point distributions supported by random point generator. More... | |
enum | SimilarityFunction { MINUS, GAUSSIAN, HEURISTIC } |
Similarity function selector. More... | |
Public Member Functions | |
virtual void | computeSignature (InputArray image, OutputArray signature) const =0 |
Computes signature of given image. More... | |
virtual void | computeSignatures (const std::vector< Mat > &images, std::vector< Mat > &signatures) const =0 |
Computes signatures for multiple images in parallel. More... | |
virtual int | getClusterMinSize () const =0 |
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. More... | |
virtual int | getDistanceFunction () const =0 |
Distance function selector used for measuring distance between two points in k-means. More... | |
virtual float | getDropThreshold () const =0 |
Remove centroids in k-means whose weight is lesser or equal to given threshold. More... | |
virtual int | getGrayscaleBits () const =0 |
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. More... | |
virtual int | getInitSeedCount () const =0 |
Number of initial seeds (initial number of clusters) for the k-means algorithm. More... | |
virtual std::vector< int > | getInitSeedIndexes () const =0 |
Initial seeds (initial number of clusters) for the k-means algorithm. More... | |
virtual int | getIterationCount () const =0 |
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). More... | |
virtual float | getJoiningDistance () const =0 |
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. More... | |
virtual int | getMaxClustersCount () const =0 |
Maximal number of generated clusters. If the number is exceeded, the clusters are sorted by their weights and the smallest clusters are cropped. More... | |
virtual int | getSampleCount () const =0 |
Number of initial samples taken from the image. More... | |
virtual std::vector< Point2f > | getSamplingPoints () const =0 |
Initial samples taken from the image. These sampled features become the input for clustering. More... | |
virtual float | getWeightA () const =0 |
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) More... | |
virtual float | getWeightB () const =0 |
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) More... | |
virtual float | getWeightConstrast () const =0 |
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) More... | |
virtual float | getWeightEntropy () const =0 |
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) More... | |
virtual float | getWeightL () const =0 |
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) More... | |
virtual float | getWeightX () const =0 |
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) More... | |
virtual float | getWeightY () const =0 |
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) More... | |
virtual int | getWindowRadius () const =0 |
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). More... | |
virtual void | setClusterMinSize (int clusterMinSize)=0 |
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. More... | |
virtual void | setDistanceFunction (int distanceFunction)=0 |
Distance function selector used for measuring distance between two points in k-means. Available: L0_25, L0_5, L1, L2, L2SQUARED, L5, L_INFINITY. More... | |
virtual void | setDropThreshold (float dropThreshold)=0 |
Remove centroids in k-means whose weight is lesser or equal to given threshold. More... | |
virtual void | setGrayscaleBits (int grayscaleBits)=0 |
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. More... | |
virtual void | setInitSeedIndexes (std::vector< int > initSeedIndexes)=0 |
Initial seed indexes for the k-means algorithm. More... | |
virtual void | setIterationCount (int iterationCount)=0 |
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). More... | |
virtual void | setJoiningDistance (float joiningDistance)=0 |
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. More... | |
virtual void | setMaxClustersCount (int maxClustersCount)=0 |
Maximal number of generated clusters. If the number is exceeded, the clusters are sorted by their weights and the smallest clusters are cropped. More... | |
virtual void | setSamplingPoints (std::vector< Point2f > samplingPoints)=0 |
Sets sampling points used to sample the input image. More... | |
virtual void | setTranslation (int idx, float value)=0 |
Translations of the individual axes of the feature space. More... | |
virtual void | setTranslations (const std::vector< float > &translations)=0 |
Translations of the individual axes of the feature space. More... | |
virtual void | setWeight (int idx, float value)=0 |
Weights (multiplicative constants) that linearly stretch individual axes of the feature space. More... | |
virtual void | setWeightA (float weight)=0 |
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) More... | |
virtual void | setWeightB (float weight)=0 |
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) More... | |
virtual void | setWeightContrast (float weight)=0 |
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) More... | |
virtual void | setWeightEntropy (float weight)=0 |
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) More... | |
virtual void | setWeightL (float weight)=0 |
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) More... | |
virtual void | setWeights (const std::vector< float > &weights)=0 |
Weights (multiplicative constants) that linearly stretch individual axes of the feature space. More... | |
virtual void | setWeightX (float weight)=0 |
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) More... | |
virtual void | setWeightY (float weight)=0 |
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) More... | |
virtual void | setWindowRadius (int radius)=0 |
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). More... | |
Public Member Functions inherited from cv::Algorithm | |
Algorithm () | |
virtual | ~Algorithm () |
virtual void | clear () |
Clears the algorithm state. More... | |
virtual bool | empty () const |
Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read. More... | |
virtual String | getDefaultName () const |
virtual void | read (const FileNode &fn) |
Reads algorithm parameters from a file storage. More... | |
virtual void | save (const String &filename) const |
virtual void | write (FileStorage &fs) const |
Stores algorithm parameters in a file storage. More... | |
Static Public Member Functions | |
static Ptr< 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. More... | |
static Ptr< 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. More... | |
static Ptr< PCTSignatures > | create (const std::vector< Point2f > &initSamplingPoints, const std::vector< int > &initClusterSeedIndexes) |
Creates PCTSignatures algorithm using pre-generated sampling points and clusterization seeds indexes. More... | |
static void | 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. More... | |
static void | generateInitPoints (std::vector< Point2f > &initPoints, const int count, int pointDistribution) |
Generates initial sampling points according to selected point distribution. More... | |
Static Public Member Functions inherited from cv::Algorithm | |
template<typename _Tp > | |
static Ptr< _Tp > | load (const String &filename, const String &objname=String()) |
Loads algorithm from the file. More... | |
template<typename _Tp > | |
static Ptr< _Tp > | loadFromString (const String &strModel, const String &objname=String()) |
Loads algorithm from a String. More... | |
template<typename _Tp > | |
static Ptr< _Tp > | read (const FileNode &fn) |
Reads algorithm from the file node. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from cv::Algorithm | |
void | writeFormat (FileStorage &fs) const |
Class implementing PCT (position-color-texture) signature extraction as described in [92]. 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. [92] [10]
Similarity function selector.
\[ d(c_i, c_j) \]
and parameter:\[ \alpha \]
Enumerator | |
---|---|
MINUS | \[ -d(c_i, c_j) \] |
GAUSSIAN | \[ e^{ -\alpha * d^2(c_i, c_j)} \] |
HEURISTIC | \[ \frac{1}{\alpha + d(c_i, c_j)} \] |
|
pure virtual |
Computes signature of given image.
image | Input image of CV_8U type. |
signature | Output computed signature. |
|
pure virtual |
Computes signatures for multiple images in parallel.
images | Vector of input images of CV_8U type. |
signatures | Vector of computed signatures. |
|
static |
Creates PCTSignatures algorithm using sample and seed count. It generates its own sets of sampling points and clusterization seed indexes.
initSampleCount | Number of points used for image sampling. |
initSeedCount | Number of initial clusterization seeds. Must be lower or equal to initSampleCount |
pointDistribution | Distribution of generated points. Default: UNIFORM. Available: UNIFORM, REGULAR, NORMAL. |
|
static |
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.
initSamplingPoints | Sampling points used in image sampling. |
initSeedCount | Number of initial clusterization seeds. Must be lower or equal to initSamplingPoints.size(). |
|
static |
Creates PCTSignatures algorithm using pre-generated sampling points and clusterization seeds indexes.
initSamplingPoints | Sampling points used in image sampling. |
initClusterSeedIndexes | Indexes of initial clusterization seeds. Its size must be lower or equal to initSamplingPoints.size(). |
|
static |
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.
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. |
|
static |
Generates initial sampling points according to selected point distribution.
initPoints | Output vector where the generated points will be saved. |
count | Number of points to generate. |
pointDistribution | Point distribution selector. Available: UNIFORM, REGULAR, NORMAL. |
|
pure virtual |
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.
|
pure virtual |
Distance function selector used for measuring distance between two points in k-means.
|
pure virtual |
Remove centroids in k-means whose weight is lesser or equal to given threshold.
|
pure virtual |
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.
|
pure virtual |
Number of initial seeds (initial number of clusters) for the k-means algorithm.
|
pure virtual |
Initial seeds (initial number of clusters) for the k-means algorithm.
|
pure virtual |
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).
|
pure virtual |
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.
|
pure virtual |
Maximal number of generated clusters. If the number is exceeded, the clusters are sorted by their weights and the smallest clusters are cropped.
|
pure virtual |
Number of initial samples taken from the image.
|
pure virtual |
Initial samples taken from the image. These sampled features become the input for clustering.
|
pure virtual |
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)
|
pure virtual |
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)
|
pure virtual |
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)
|
pure virtual |
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)
|
pure virtual |
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)
|
pure virtual |
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)
|
pure virtual |
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)
|
pure virtual |
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).
|
pure virtual |
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.
|
pure virtual |
|
pure virtual |
Remove centroids in k-means whose weight is lesser or equal to given threshold.
|
pure virtual |
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.
|
pure virtual |
Initial seed indexes for the k-means algorithm.
|
pure virtual |
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).
|
pure virtual |
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.
|
pure virtual |
Maximal number of generated clusters. If the number is exceeded, the clusters are sorted by their weights and the smallest clusters are cropped.
|
pure virtual |
Sets sampling points used to sample the input image.
samplingPoints | Vector of sampling points in range [0..1) |
|
pure virtual |
Translations of the individual axes of the feature space.
idx | ID of the translation |
value | Value of the translation |
|
pure virtual |
Translations of the individual axes of the feature space.
translations | Values of all translations. |
|
pure virtual |
Weights (multiplicative constants) that linearly stretch individual axes of the feature space.
idx | ID of the weight |
value | Value of the weight |
|
pure virtual |
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)
|
pure virtual |
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)
|
pure virtual |
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)
|
pure virtual |
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)
|
pure virtual |
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)
|
pure virtual |
Weights (multiplicative constants) that linearly stretch individual axes of the feature space.
weights | Values of all weights. |
|
pure virtual |
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)
|
pure virtual |
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)
|
pure virtual |
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).