[][src]Trait opencv::xfeatures2d::PCTSignatures

pub trait PCTSignatures: AlgorithmTrait {
    fn as_raw_PCTSignatures(&self) -> *mut c_void;

    fn compute_signature(
        &self,
        image: &dyn ToInputArray,
        signature: &mut dyn ToOutputArray
    ) -> Result<()> { ... }
fn compute_signatures(
        &self,
        images: &VectorOfMat,
        signatures: &mut VectorOfMat
    ) -> Result<()> { ... }
fn get_sample_count(&self) -> Result<i32> { ... }
fn get_grayscale_bits(&self) -> Result<i32> { ... }
fn set_grayscale_bits(&mut self, grayscale_bits: i32) -> Result<()> { ... }
fn get_window_radius(&self) -> Result<i32> { ... }
fn set_window_radius(&mut self, radius: i32) -> Result<()> { ... }
fn get_weight_x(&self) -> Result<f32> { ... }
fn set_weight_x(&mut self, weight: f32) -> Result<()> { ... }
fn get_weight_y(&self) -> Result<f32> { ... }
fn set_weight_y(&mut self, weight: f32) -> Result<()> { ... }
fn get_weight_l(&self) -> Result<f32> { ... }
fn set_weight_l(&mut self, weight: f32) -> Result<()> { ... }
fn get_weight_a(&self) -> Result<f32> { ... }
fn set_weight_a(&mut self, weight: f32) -> Result<()> { ... }
fn get_weight_b(&self) -> Result<f32> { ... }
fn set_weight_b(&mut self, weight: f32) -> Result<()> { ... }
fn get_weight_contrast(&self) -> Result<f32> { ... }
fn set_weight_contrast(&mut self, weight: f32) -> Result<()> { ... }
fn get_weight_entropy(&self) -> Result<f32> { ... }
fn set_weight_entropy(&mut self, weight: f32) -> Result<()> { ... }
fn get_sampling_points(&self) -> Result<VectorOfPoint2f> { ... }
fn set_weight(&mut self, idx: i32, value: f32) -> Result<()> { ... }
fn set_weights(&mut self, weights: &VectorOffloat) -> Result<()> { ... }
fn set_translation(&mut self, idx: i32, value: f32) -> Result<()> { ... }
fn set_translations(&mut self, translations: &VectorOffloat) -> Result<()> { ... }
fn set_sampling_points(
        &mut self,
        sampling_points: &VectorOfPoint2f
    ) -> Result<()> { ... }
fn get_init_seed_indexes(&self) -> Result<VectorOfint> { ... }
fn set_init_seed_indexes(
        &mut self,
        init_seed_indexes: &VectorOfint
    ) -> Result<()> { ... }
fn get_init_seed_count(&self) -> Result<i32> { ... }
fn get_iteration_count(&self) -> Result<i32> { ... }
fn set_iteration_count(&mut self, iteration_count: i32) -> Result<()> { ... }
fn get_max_clusters_count(&self) -> Result<i32> { ... }
fn set_max_clusters_count(&mut self, max_clusters_count: i32) -> Result<()> { ... }
fn get_cluster_min_size(&self) -> Result<i32> { ... }
fn set_cluster_min_size(&mut self, cluster_min_size: i32) -> Result<()> { ... }
fn get_joining_distance(&self) -> Result<f32> { ... }
fn set_joining_distance(&mut self, joining_distance: f32) -> Result<()> { ... }
fn get_drop_threshold(&self) -> Result<f32> { ... }
fn set_drop_threshold(&mut self, drop_threshold: f32) -> Result<()> { ... }
fn get_distance_function(&self) -> Result<i32> { ... }
fn set_distance_function(&mut self, distance_function: i32) -> Result<()> { ... } }

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

Required methods

Loading content...

Provided methods

fn compute_signature(
    &self,
    image: &dyn ToInputArray,
    signature: &mut dyn ToOutputArray
) -> Result<()>

Computes signature of given image.

Parameters

  • image: Input image of CV_8U type.
  • signature: Output computed signature.

fn compute_signatures(
    &self,
    images: &VectorOfMat,
    signatures: &mut VectorOfMat
) -> Result<()>

Computes signatures for multiple images in parallel.

Parameters

  • images: Vector of input images of CV_8U type.
  • signatures: Vector of computed signatures.

fn get_sample_count(&self) -> Result<i32>

Number of initial samples taken from the image.

fn get_grayscale_bits(&self) -> Result<i32>

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.

fn set_grayscale_bits(&mut self, grayscale_bits: i32) -> Result<()>

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.

fn get_window_radius(&self) -> Result<i32>

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

fn set_window_radius(&mut self, radius: i32) -> Result<()>

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

fn get_weight_x(&self) -> Result<f32>

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)

fn set_weight_x(&mut self, weight: f32) -> Result<()>

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)

fn get_weight_y(&self) -> Result<f32>

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)

fn set_weight_y(&mut self, weight: f32) -> Result<()>

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)

fn get_weight_l(&self) -> Result<f32>

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)

fn set_weight_l(&mut self, weight: f32) -> Result<()>

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)

fn get_weight_a(&self) -> Result<f32>

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)

fn set_weight_a(&mut self, weight: f32) -> Result<()>

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)

fn get_weight_b(&self) -> Result<f32>

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)

fn set_weight_b(&mut self, weight: f32) -> Result<()>

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)

fn get_weight_contrast(&self) -> Result<f32>

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)

fn set_weight_contrast(&mut self, weight: f32) -> Result<()>

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)

fn get_weight_entropy(&self) -> Result<f32>

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)

fn set_weight_entropy(&mut self, weight: f32) -> Result<()>

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)

fn get_sampling_points(&self) -> Result<VectorOfPoint2f>

Initial samples taken from the image. These sampled features become the input for clustering.

fn set_weight(&mut self, idx: i32, value: f32) -> Result<()>

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;

fn set_weights(&mut self, weights: &VectorOffloat) -> Result<()>

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;

fn set_translation(&mut self, idx: i32, value: f32) -> Result<()>

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;

fn set_translations(&mut self, translations: &VectorOffloat) -> Result<()>

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;

fn set_sampling_points(
    &mut self,
    sampling_points: &VectorOfPoint2f
) -> Result<()>

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.

fn get_init_seed_indexes(&self) -> Result<VectorOfint>

Initial seeds (initial number of clusters) for the k-means algorithm.

fn set_init_seed_indexes(
    &mut self,
    init_seed_indexes: &VectorOfint
) -> Result<()>

Initial seed indexes for the k-means algorithm.

fn get_init_seed_count(&self) -> Result<i32>

Number of initial seeds (initial number of clusters) for the k-means algorithm.

fn get_iteration_count(&self) -> Result<i32>

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

fn set_iteration_count(&mut self, iteration_count: i32) -> Result<()>

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

fn get_max_clusters_count(&self) -> Result<i32>

Maximal number of generated clusters. If the number is exceeded, the clusters are sorted by their weights and the smallest clusters are cropped.

fn set_max_clusters_count(&mut self, max_clusters_count: i32) -> Result<()>

Maximal number of generated clusters. If the number is exceeded, the clusters are sorted by their weights and the smallest clusters are cropped.

fn get_cluster_min_size(&self) -> Result<i32>

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.

fn set_cluster_min_size(&mut self, cluster_min_size: i32) -> Result<()>

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.

fn get_joining_distance(&self) -> Result<f32>

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.

fn set_joining_distance(&mut self, joining_distance: f32) -> Result<()>

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.

fn get_drop_threshold(&self) -> Result<f32>

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

fn set_drop_threshold(&mut self, drop_threshold: f32) -> Result<()>

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

fn get_distance_function(&self) -> Result<i32>

Distance function selector used for measuring distance between two points in k-means.

fn set_distance_function(&mut self, distance_function: i32) -> Result<()>

Distance function selector used for measuring distance between two points in k-means. Available: L0_25, L0_5, L1, L2, L2SQUARED, L5, L_INFINITY.

Loading content...

Methods

impl<'_> dyn PCTSignatures + '_[src]

pub fn create(
    init_sample_count: i32,
    init_seed_count: i32,
    point_distribution: i32
) -> Result<PtrOfPCTSignatures>
[src]

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.

C++ default parameters

  • init_sample_count: 2000
  • init_seed_count: 400
  • point_distribution: 0

pub fn create_1(
    init_sampling_points: &VectorOfPoint2f,
    init_seed_count: i32
) -> Result<PtrOfPCTSignatures>
[src]

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.

pub fn create_2(
    init_sampling_points: &VectorOfPoint2f,
    init_cluster_seed_indexes: &VectorOfint
) -> Result<PtrOfPCTSignatures>
[src]

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.

pub fn draw_signature(
    source: &dyn ToInputArray,
    signature: &dyn ToInputArray,
    result: &mut dyn ToOutputArray,
    radius_to_shorter_side_ratio: f32,
    border_thickness: i32
) -> Result<()>
[src]

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.

C++ default parameters

  • radius_to_shorter_side_ratio: 1.0 / 8
  • border_thickness: 1

pub fn generate_init_points(
    init_points: &mut VectorOfPoint2f,
    count: i32,
    point_distribution: i32
) -> Result<()>
[src]

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)

Implementors

Loading content...