Package org.opencv.xfeatures2d
Class PCTSignatures
- java.lang.Object
- 
- org.opencv.core.Algorithm
- 
- org.opencv.xfeatures2d.PCTSignatures
 
 
- 
 public class PCTSignatures extends 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
- 
- 
Constructor SummaryConstructors Modifier Constructor Description protectedPCTSignatures(long addr)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PCTSignatures__fromPtr__(long addr)voidcomputeSignature(Mat image, Mat signature)Computes signature of given image.voidcomputeSignatures(java.util.List<Mat> images, java.util.List<Mat> signatures)Computes signatures for multiple images in parallel.static PCTSignaturescreate()Creates PCTSignatures algorithm using sample and seed count.static PCTSignaturescreate(int initSampleCount)Creates PCTSignatures algorithm using sample and seed count.static PCTSignaturescreate(int initSampleCount, int initSeedCount)Creates PCTSignatures algorithm using sample and seed count.static PCTSignaturescreate(int initSampleCount, int initSeedCount, int pointDistribution)Creates PCTSignatures algorithm using sample and seed count.static PCTSignaturescreate(MatOfPoint2f initSamplingPoints, int initSeedCount)Creates PCTSignatures algorithm using pre-generated sampling points and number of clusterization seeds.static PCTSignaturescreate(MatOfPoint2f initSamplingPoints, MatOfInt initClusterSeedIndexes)Creates PCTSignatures algorithm using pre-generated sampling points and clusterization seeds indexes.static voiddrawSignature(Mat source, Mat signature, Mat result)Draws signature in the source image and outputs the result.static voiddrawSignature(Mat source, Mat signature, Mat result, float radiusToShorterSideRatio)Draws signature in the source image and outputs the result.static voiddrawSignature(Mat source, Mat signature, Mat result, float radiusToShorterSideRatio, int borderThickness)Draws signature in the source image and outputs the result.protected voidfinalize()static voidgenerateInitPoints(MatOfPoint2f initPoints, int count, int pointDistribution)Generates initial sampling points according to selected point distribution.intgetClusterMinSize()This parameter multiplied by the index of iteration gives lower limit for cluster size.intgetDistanceFunction()Distance function selector used for measuring distance between two points in k-means.floatgetDropThreshold()Remove centroids in k-means whose weight is lesser or equal to given threshold.intgetGrayscaleBits()Color resolution of the greyscale bitmap represented in allocated bits (i.e., value 4 means that 16 shades of grey are used).intgetInitSeedCount()Number of initial seeds (initial number of clusters) for the k-means algorithm.MatOfIntgetInitSeedIndexes()Initial seeds (initial number of clusters) for the k-means algorithm.intgetIterationCount()Number of iterations of the k-means clustering.floatgetJoiningDistance()Threshold euclidean distance between two centroids.intgetMaxClustersCount()Maximal number of generated clusters.intgetSampleCount()Number of initial samples taken from the image.MatOfPoint2fgetSamplingPoints()Initial samples taken from the image.floatgetWeightA()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.floatgetWeightB()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.floatgetWeightContrast()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.floatgetWeightEntropy()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.floatgetWeightL()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.floatgetWeightX()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.floatgetWeightY()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.intgetWindowRadius()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).voidsetClusterMinSize(int clusterMinSize)This parameter multiplied by the index of iteration gives lower limit for cluster size.voidsetDistanceFunction(int distanceFunction)Distance function selector used for measuring distance between two points in k-means.voidsetDropThreshold(float dropThreshold)Remove centroids in k-means whose weight is lesser or equal to given threshold.voidsetGrayscaleBits(int grayscaleBits)Color resolution of the greyscale bitmap represented in allocated bits (i.e., value 4 means that 16 shades of grey are used).voidsetInitSeedIndexes(MatOfInt initSeedIndexes)Initial seed indexes for the k-means algorithm.voidsetIterationCount(int iterationCount)Number of iterations of the k-means clustering.voidsetJoiningDistance(float joiningDistance)Threshold euclidean distance between two centroids.voidsetMaxClustersCount(int maxClustersCount)Maximal number of generated clusters.voidsetSamplingPoints(MatOfPoint2f samplingPoints)Sets sampling points used to sample the input image.voidsetTranslation(int idx, float value)Translations of the individual axes of the feature space.voidsetTranslations(MatOfFloat translations)Translations of the individual axes of the feature space.voidsetWeight(int idx, float value)Weights (multiplicative constants) that linearly stretch individual axes of the feature space.voidsetWeightA(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.voidsetWeightB(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.voidsetWeightContrast(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.voidsetWeightEntropy(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.voidsetWeightL(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.voidsetWeights(MatOfFloat weights)Weights (multiplicative constants) that linearly stretch individual axes of the feature space.voidsetWeightX(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.voidsetWeightY(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.voidsetWindowRadius(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).- 
Methods inherited from class org.opencv.core.Algorithmclear, empty, getDefaultName, getNativeObjAddr, save
 
- 
 
- 
- 
- 
Field Detail- 
L0_25public static final int L0_25 - See Also:
- Constant Field Values
 
 - 
L0_5public static final int L0_5 - See Also:
- Constant Field Values
 
 - 
L1public static final int L1 - See Also:
- Constant Field Values
 
 - 
L2public static final int L2 - See Also:
- Constant Field Values
 
 - 
L2SQUAREDpublic static final int L2SQUARED - See Also:
- Constant Field Values
 
 - 
L5public static final int L5 - See Also:
- Constant Field Values
 
 - 
L_INFINITYpublic static final int L_INFINITY - See Also:
- Constant Field Values
 
 - 
UNIFORMpublic static final int UNIFORM - See Also:
- Constant Field Values
 
 - 
REGULARpublic static final int REGULAR - See Also:
- Constant Field Values
 
 - 
NORMALpublic static final int NORMAL - See Also:
- Constant Field Values
 
 - 
MINUSpublic static final int MINUS - See Also:
- Constant Field Values
 
 - 
GAUSSIANpublic static final int GAUSSIAN - See Also:
- Constant Field Values
 
 - 
HEURISTICpublic static final int HEURISTIC - See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
__fromPtr__public static PCTSignatures __fromPtr__(long addr) 
 - 
createpublic static PCTSignatures create(int initSampleCount, int initSeedCount, int pointDistribution) 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 initSampleCount
- pointDistribution- Distribution of generated points. Default: UNIFORM. Available: UNIFORM, REGULAR, NORMAL.
- Returns:
- Created algorithm.
 
 - 
createpublic static PCTSignatures create(int initSampleCount, int initSeedCount) 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 initSampleCount Available: UNIFORM, REGULAR, NORMAL.
- Returns:
- Created algorithm.
 
 - 
createpublic static PCTSignatures create(int initSampleCount) 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. Must be lower or equal to initSampleCount Available: UNIFORM, REGULAR, NORMAL.
- Returns:
- Created algorithm.
 
 - 
createpublic static PCTSignatures create() 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.- Returns:
- Created algorithm.
 
 - 
createpublic static PCTSignatures create(MatOfPoint2f initSamplingPoints, 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.
 
 - 
createpublic static PCTSignatures create(MatOfPoint2f initSamplingPoints, MatOfInt 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.
 
 - 
computeSignaturepublic void computeSignature(Mat image, Mat signature) Computes signature of given image.- Parameters:
- image- Input image of CV_8U type.
- signature- Output computed signature.
 
 - 
computeSignaturespublic void computeSignatures(java.util.List<Mat> images, java.util.List<Mat> signatures) Computes signatures for multiple images in parallel.- Parameters:
- images- Vector of input images of CV_8U type.
- signatures- Vector of computed signatures.
 
 - 
drawSignaturepublic static void drawSignature(Mat source, Mat signature, Mat result, float radiusToShorterSideRatio, int borderThickness) 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.
 
 - 
drawSignaturepublic static void drawSignature(Mat source, Mat signature, Mat result, float radiusToShorterSideRatio) 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.
 
 - 
drawSignaturepublic static void drawSignature(Mat source, Mat signature, Mat result) 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.
 
 - 
generateInitPointspublic static void generateInitPoints(MatOfPoint2f initPoints, int count, int pointDistribution) Generates initial sampling points according to selected point distribution.- 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. Note: Generated coordinates are in range [0..1)
 
 - 
getSampleCountpublic int getSampleCount() Number of initial samples taken from the image.- Returns:
- automatically generated
 
 - 
getGrayscaleBitspublic int 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.- Returns:
- automatically generated
 
 - 
setGrayscaleBitspublic void 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.- Parameters:
- grayscaleBits- automatically generated
 
 - 
getWindowRadiuspublic int 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).- Returns:
- automatically generated
 
 - 
setWindowRadiuspublic void 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).- Parameters:
- radius- automatically generated
 
 - 
getWeightXpublic float 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)- Returns:
- automatically generated
 
 - 
setWeightXpublic void 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)- Parameters:
- weight- automatically generated
 
 - 
getWeightYpublic float 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)- Returns:
- automatically generated
 
 - 
setWeightYpublic void 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)- Parameters:
- weight- automatically generated
 
 - 
getWeightLpublic float 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)- Returns:
- automatically generated
 
 - 
setWeightLpublic void 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)- Parameters:
- weight- automatically generated
 
 - 
getWeightApublic float 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)- Returns:
- automatically generated
 
 - 
setWeightApublic void 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)- Parameters:
- weight- automatically generated
 
 - 
getWeightBpublic float 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)- Returns:
- automatically generated
 
 - 
setWeightBpublic void 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)- Parameters:
- weight- automatically generated
 
 - 
getWeightContrastpublic float 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)- Returns:
- automatically generated
 
 - 
setWeightContrastpublic void 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)- Parameters:
- weight- automatically generated
 
 - 
getWeightEntropypublic float 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)- Returns:
- automatically generated
 
 - 
setWeightEntropypublic void 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)- Parameters:
- weight- automatically generated
 
 - 
getSamplingPointspublic MatOfPoint2f getSamplingPoints() Initial samples taken from the image. These sampled features become the input for clustering.- Returns:
- automatically generated
 
 - 
setWeightpublic void setWeight(int idx, float value)Weights (multiplicative constants) that linearly stretch individual axes of the feature space.- 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;
 
 - 
setWeightspublic void setWeights(MatOfFloat weights) Weights (multiplicative constants) that linearly stretch individual axes of the feature space.- 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;
 
 - 
setTranslationpublic void setTranslation(int idx, float value)Translations of the individual axes of the feature space.- 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;
 
 - 
setTranslationspublic void setTranslations(MatOfFloat translations) Translations of the individual axes of the feature space.- 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;
 
 - 
setSamplingPointspublic void setSamplingPoints(MatOfPoint2f samplingPoints) Sets sampling points used to sample the input image.- Parameters:
- samplingPoints- Vector of sampling points in range [0..1) Note: Number of sampling points must be greater or equal to clusterization seed count.
 
 - 
getInitSeedIndexespublic MatOfInt getInitSeedIndexes() Initial seeds (initial number of clusters) for the k-means algorithm.- Returns:
- automatically generated
 
 - 
setInitSeedIndexespublic void setInitSeedIndexes(MatOfInt initSeedIndexes) Initial seed indexes for the k-means algorithm.- Parameters:
- initSeedIndexes- automatically generated
 
 - 
getInitSeedCountpublic int getInitSeedCount() Number of initial seeds (initial number of clusters) for the k-means algorithm.- Returns:
- automatically generated
 
 - 
getIterationCountpublic int 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).- Returns:
- automatically generated
 
 - 
setIterationCountpublic void 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).- Parameters:
- iterationCount- automatically generated
 
 - 
getMaxClustersCountpublic int getMaxClustersCount() Maximal number of generated clusters. If the number is exceeded, the clusters are sorted by their weights and the smallest clusters are cropped.- Returns:
- automatically generated
 
 - 
setMaxClustersCountpublic void 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.- Parameters:
- maxClustersCount- automatically generated
 
 - 
getClusterMinSizepublic int 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.- Returns:
- automatically generated
 
 - 
setClusterMinSizepublic void 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.- Parameters:
- clusterMinSize- automatically generated
 
 - 
getJoiningDistancepublic float 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.- Returns:
- automatically generated
 
 - 
setJoiningDistancepublic void 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.- Parameters:
- joiningDistance- automatically generated
 
 - 
getDropThresholdpublic float getDropThreshold() Remove centroids in k-means whose weight is lesser or equal to given threshold.- Returns:
- automatically generated
 
 - 
setDropThresholdpublic void setDropThreshold(float dropThreshold) Remove centroids in k-means whose weight is lesser or equal to given threshold.- Parameters:
- dropThreshold- automatically generated
 
 - 
getDistanceFunctionpublic int getDistanceFunction() Distance function selector used for measuring distance between two points in k-means.- Returns:
- automatically generated
 
 - 
setDistanceFunctionpublic void 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.- Parameters:
- distanceFunction- automatically generated
 
 
- 
 
-