PCTSignatures

Objective-C

@interface PCTSignatures : Algorithm

Swift

class PCTSignatures : Algorithm

Class implementing PCT (position-color-texture) signature extraction as described in CITE: 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. CITE: KrulisLS16 CITE: BeecksUS10

Member of Xfeatures2d

Methods

  • Creates PCTSignatures algorithm using sample and seed count. It generates its own sets of sampling points and clusterization seed indexes.

    Declaration

    Objective-C

    + (nonnull PCTSignatures *)create:(int)initSampleCount
                        initSeedCount:(int)initSeedCount
                    pointDistribution:(int)pointDistribution;

    Swift

    class func create(initSampleCount: Int32, initSeedCount: Int32, pointDistribution: Int32) -> PCTSignatures

    Parameters

    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.

    Return Value

    Created algorithm.

  • Creates PCTSignatures algorithm using sample and seed count. It generates its own sets of sampling points and clusterization seed indexes.

    Declaration

    Objective-C

    + (nonnull PCTSignatures *)create:(int)initSampleCount
                        initSeedCount:(int)initSeedCount;

    Swift

    class func create(initSampleCount: Int32, initSeedCount: Int32) -> PCTSignatures

    Parameters

    initSampleCount

    Number of points used for image sampling.

    initSeedCount

    Number of initial clusterization seeds. Must be lower or equal to initSampleCount Available: UNIFORM, REGULAR, NORMAL.

    Return Value

    Created algorithm.

  • Creates PCTSignatures algorithm using sample and seed count. It generates its own sets of sampling points and clusterization seed indexes.

    Declaration

    Objective-C

    + (nonnull PCTSignatures *)create:(int)initSampleCount;

    Swift

    class func create(initSampleCount: Int32) -> PCTSignatures

    Parameters

    initSampleCount

    Number of points used for image sampling. Must be lower or equal to initSampleCount Available: UNIFORM, REGULAR, NORMAL.

    Return Value

    Created algorithm.

  • Creates PCTSignatures algorithm using sample and seed count. It generates its own sets of sampling points and clusterization seed indexes. Must be lower or equal to initSampleCount Available: UNIFORM, REGULAR, NORMAL.

    Declaration

    Objective-C

    + (nonnull PCTSignatures *)create;

    Swift

    class func create() -> PCTSignatures

    Return Value

    Created algorithm.

  • 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.

    Declaration

    Objective-C

    + (nonnull PCTSignatures *)create2:
                                   (nonnull NSArray<Point2f *> *)initSamplingPoints
                         initSeedCount:(int)initSeedCount;

    Swift

    class func create(initSamplingPoints: [Point2f], initSeedCount: Int32) -> PCTSignatures

    Parameters

    initSamplingPoints

    Sampling points used in image sampling.

    initSeedCount

    Number of initial clusterization seeds. Must be lower or equal to initSamplingPoints.size().

    Return Value

    Created algorithm.

  • Creates PCTSignatures algorithm using pre-generated sampling points and clusterization seeds indexes.

    Declaration

    Objective-C

    + (nonnull PCTSignatures *)create:
                                   (nonnull NSArray<Point2f *> *)initSamplingPoints
               initClusterSeedIndexes:(nonnull IntVector *)initClusterSeedIndexes;

    Swift

    class func create(initSamplingPoints: [Point2f], initClusterSeedIndexes: IntVector) -> PCTSignatures

    Parameters

    initSamplingPoints

    Sampling points used in image sampling.

    initClusterSeedIndexes

    Indexes of initial clusterization seeds. Its size must be lower or equal to initSamplingPoints.size().

    Return Value

    Created algorithm.

  • Remove centroids in k-means whose weight is lesser or equal to given threshold.

    Declaration

    Objective-C

    - (float)getDropThreshold;

    Swift

    func getDropThreshold() -> Float
  • 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.

    Declaration

    Objective-C

    - (float)getJoiningDistance;

    Swift

    func getJoiningDistance() -> Float
  • 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)

    Declaration

    Objective-C

    - (float)getWeightA;

    Swift

    func getWeightA() -> Float
  • 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)

    Declaration

    Objective-C

    - (float)getWeightB;

    Swift

    func getWeightB() -> Float
  • 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)

    Declaration

    Objective-C

    - (float)getWeightContrast;

    Swift

    func getWeightContrast() -> Float
  • 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)

    Declaration

    Objective-C

    - (float)getWeightEntropy;

    Swift

    func getWeightEntropy() -> Float
  • 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)

    Declaration

    Objective-C

    - (float)getWeightL;

    Swift

    func getWeightL() -> Float
  • 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)

    Declaration

    Objective-C

    - (float)getWeightX;

    Swift

    func getWeightX() -> Float
  • 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)

    Declaration

    Objective-C

    - (float)getWeightY;

    Swift

    func getWeightY() -> Float
  • 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.

    Declaration

    Objective-C

    - (int)getClusterMinSize;

    Swift

    func getClusterMinSize() -> Int32
  • Distance function selector used for measuring distance between two points in k-means.

    Declaration

    Objective-C

    - (int)getDistanceFunction;

    Swift

    func getDistanceFunction() -> Int32
  • 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.

    Declaration

    Objective-C

    - (int)getGrayscaleBits;

    Swift

    func getGrayscaleBits() -> Int32
  • Number of initial seeds (initial number of clusters) for the k-means algorithm.

    Declaration

    Objective-C

    - (int)getInitSeedCount;

    Swift

    func getInitSeedCount() -> Int32
  • 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).

    Declaration

    Objective-C

    - (int)getIterationCount;

    Swift

    func getIterationCount() -> Int32
  • Maximal number of generated clusters. If the number is exceeded, the clusters are sorted by their weights and the smallest clusters are cropped.

    Declaration

    Objective-C

    - (int)getMaxClustersCount;

    Swift

    func getMaxClustersCount() -> Int32
  • Number of initial samples taken from the image.

    Declaration

    Objective-C

    - (int)getSampleCount;

    Swift

    func getSampleCount() -> Int32
  • 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).

    Declaration

    Objective-C

    - (int)getWindowRadius;

    Swift

    func getWindowRadius() -> Int32
  • Initial samples taken from the image. These sampled features become the input for clustering.

    Declaration

    Objective-C

    - (nonnull NSArray<Point2f *> *)getSamplingPoints;

    Swift

    func getSamplingPoints() -> [Point2f]
  • Initial seeds (initial number of clusters) for the k-means algorithm.

    Declaration

    Objective-C

    - (nonnull IntVector *)getInitSeedIndexes;

    Swift

    func getInitSeedIndexes() -> IntVector
  • Computes signature of given image.

    Declaration

    Objective-C

    - (void)computeSignature:(nonnull Mat *)image
                   signature:(nonnull Mat *)signature;

    Swift

    func computeSignature(image: Mat, signature: Mat)

    Parameters

    image

    Input image of CV_8U type.

    signature

    Output computed signature.

  • Computes signatures for multiple images in parallel.

    Declaration

    Objective-C

    - (void)computeSignatures:(nonnull NSArray<Mat *> *)images
                   signatures:(nonnull NSArray<Mat *> *)signatures;

    Swift

    func computeSignatures(images: [Mat], signatures: [Mat])

    Parameters

    images

    Vector of input images of CV_8U type.

    signatures

    Vector of computed signatures.

  • 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.

    Declaration

    Objective-C

    + (void)drawSignature:(nonnull Mat *)source
                       signature:(nonnull Mat *)signature
                          result:(nonnull Mat *)result
        radiusToShorterSideRatio:(float)radiusToShorterSideRatio
                 borderThickness:(int)borderThickness;

    Swift

    class func drawSignature(source: Mat, signature: Mat, result: Mat, radiusToShorterSideRatio: Float, borderThickness: Int32)

    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.

  • 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.

    Declaration

    Objective-C

    + (void)drawSignature:(nonnull Mat *)source
                       signature:(nonnull Mat *)signature
                          result:(nonnull Mat *)result
        radiusToShorterSideRatio:(float)radiusToShorterSideRatio;

    Swift

    class func drawSignature(source: Mat, signature: Mat, result: Mat, radiusToShorterSideRatio: Float)

    Parameters

    source

    Source image.

    signature

    Image signature.

    result

    Output result.

    radiusToShorterSideRatio

    Determines maximal radius of signature in the output image.

  • 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.

    Declaration

    Objective-C

    + (void)drawSignature:(nonnull Mat *)source
                signature:(nonnull Mat *)signature
                   result:(nonnull Mat *)result;

    Swift

    class func drawSignature(source: Mat, signature: Mat, result: Mat)

    Parameters

    source

    Source image.

    signature

    Image signature.

    result

    Output result.

  • Generates initial sampling points according to selected point distribution.

    Note

    Generated coordinates are in range [0..1)

    Declaration

    Objective-C

    + (void)generateInitPoints:(nonnull NSArray<Point2f *> *)initPoints
                         count:(int)count
             pointDistribution:(int)pointDistribution;

    Swift

    class func generateInitPoints(initPoints: [Point2f], count: Int32, pointDistribution: Int32)

    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.

  • 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.

    Declaration

    Objective-C

    - (void)setClusterMinSize:(int)clusterMinSize;

    Swift

    func setClusterMinSize(clusterMinSize: Int32)
  • Distance function selector used for measuring distance between two points in k-means. Available: L0_25, L0_5, L1, L2, L2SQUARED, L5, L_INFINITY.

    Declaration

    Objective-C

    - (void)setDistanceFunction:(int)distanceFunction;

    Swift

    func setDistanceFunction(distanceFunction: Int32)
  • Remove centroids in k-means whose weight is lesser or equal to given threshold.

    Declaration

    Objective-C

    - (void)setDropThreshold:(float)dropThreshold;

    Swift

    func setDropThreshold(dropThreshold: Float)
  • 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.

    Declaration

    Objective-C

    - (void)setGrayscaleBits:(int)grayscaleBits;

    Swift

    func setGrayscaleBits(grayscaleBits: Int32)
  • Initial seed indexes for the k-means algorithm.

    Declaration

    Objective-C

    - (void)setInitSeedIndexes:(nonnull IntVector *)initSeedIndexes;

    Swift

    func setInitSeedIndexes(initSeedIndexes: IntVector)
  • 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).

    Declaration

    Objective-C

    - (void)setIterationCount:(int)iterationCount;

    Swift

    func setIterationCount(iterationCount: Int32)
  • 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.

    Declaration

    Objective-C

    - (void)setJoiningDistance:(float)joiningDistance;

    Swift

    func setJoiningDistance(joiningDistance: Float)
  • Maximal number of generated clusters. If the number is exceeded, the clusters are sorted by their weights and the smallest clusters are cropped.

    Declaration

    Objective-C

    - (void)setMaxClustersCount:(int)maxClustersCount;

    Swift

    func setMaxClustersCount(maxClustersCount: Int32)
  • Sets sampling points used to sample the input image.

    Note

    Number of sampling points must be greater or equal to clusterization seed count.

    Declaration

    Objective-C

    - (void)setSamplingPoints:(nonnull NSArray<Point2f *> *)samplingPoints;

    Swift

    func setSamplingPoints(samplingPoints: [Point2f])

    Parameters

    samplingPoints

    Vector of sampling points in range [0..1)

  • Translations of the individual axes of the feature space.

    Declaration

    Objective-C

    - (void)setTranslation:(int)idx value:(float)value;

    Swift

    func setTranslation(idx: Int32, value: Float)

    Parameters

    idx

    ID of the translation

    value

    Value of the translation @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;

  • Translations of the individual axes of the feature space.

    Declaration

    Objective-C

    - (void)setTranslations:(nonnull FloatVector *)translations;

    Swift

    func setTranslations(translations: FloatVector)

    Parameters

    translations

    Values of all translations. @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;

  • Weights (multiplicative constants) that linearly stretch individual axes of the feature space.

    Declaration

    Objective-C

    - (void)setWeight:(int)idx value:(float)value;

    Swift

    func setWeight(idx: Int32, value: Float)

    Parameters

    idx

    ID of the weight

    value

    Value of the weight @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;

  • 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)

    Declaration

    Objective-C

    - (void)setWeightA:(float)weight;

    Swift

    func setWeightA(weight: Float)
  • 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)

    Declaration

    Objective-C

    - (void)setWeightB:(float)weight;

    Swift

    func setWeightB(weight: Float)
  • 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)

    Declaration

    Objective-C

    - (void)setWeightContrast:(float)weight;

    Swift

    func setWeightContrast(weight: Float)
  • 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)

    Declaration

    Objective-C

    - (void)setWeightEntropy:(float)weight;

    Swift

    func setWeightEntropy(weight: Float)
  • 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)

    Declaration

    Objective-C

    - (void)setWeightL:(float)weight;

    Swift

    func setWeightL(weight: Float)
  • 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)

    Declaration

    Objective-C

    - (void)setWeightX:(float)weight;

    Swift

    func setWeightX(weight: Float)
  • 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)

    Declaration

    Objective-C

    - (void)setWeightY:(float)weight;

    Swift

    func setWeightY(weight: Float)
  • Weights (multiplicative constants) that linearly stretch individual axes of the feature space.

    Declaration

    Objective-C

    - (void)setWeights:(nonnull FloatVector *)weights;

    Swift

    func setWeights(weights: FloatVector)

    Parameters

    weights

    Values of all weights. @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;

  • 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).

    Declaration

    Objective-C

    - (void)setWindowRadius:(int)radius;

    Swift

    func setWindowRadius(radius: Int32)