Struct opencv::xfeatures2d::PCTSignatures

source ·
pub struct PCTSignatures { /* private fields */ }
Expand 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

Implementations§

source§

impl PCTSignatures

source

pub fn create( init_sample_count: i32, init_seed_count: i32, point_distribution: i32 ) -> Result<Ptr<PCTSignatures>>

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
source

pub fn create_def() -> Result<Ptr<PCTSignatures>>

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.

§Note

This alternative version of PCTSignatures::create function uses the following default values for its arguments:

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

pub fn create_1( init_sampling_points: &Vector<Point2f>, init_seed_count: i32 ) -> Result<Ptr<PCTSignatures>>

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.

source

pub fn create_2( init_sampling_points: &Vector<Point2f>, init_cluster_seed_indexes: &Vector<i32> ) -> Result<Ptr<PCTSignatures>>

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.

source

pub fn draw_signature( source: &impl ToInputArray, signature: &impl ToInputArray, result: &mut impl ToOutputArray, radius_to_shorter_side_ratio: f32, border_thickness: i32 ) -> 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.
  • 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
source

pub fn draw_signature_def( source: &impl ToInputArray, signature: &impl ToInputArray, result: &mut impl ToOutputArray ) -> 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.
  • radiusToShorterSideRatio: Determines maximal radius of signature in the output image.
  • borderThickness: Border thickness of the visualized signature.
§Note

This alternative version of PCTSignatures::draw_signature function uses the following default values for its arguments:

  • radius_to_shorter_side_ratio: 1.0/8
  • border_thickness: 1
source

pub fn generate_init_points( init_points: &mut Vector<Point2f>, count: i32, point_distribution: i32 ) -> Result<()>

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)

Trait Implementations§

source§

impl AlgorithmTrait for PCTSignatures

source§

fn as_raw_mut_Algorithm(&mut self) -> *mut c_void

source§

fn clear(&mut self) -> Result<()>

Clears the algorithm state
source§

fn read(&mut self, fn_: &impl FileNodeTraitConst) -> Result<()>

Reads algorithm parameters from a file storage
source§

impl AlgorithmTraitConst for PCTSignatures

source§

fn as_raw_Algorithm(&self) -> *const c_void

source§

fn write(&self, fs: &mut impl FileStorageTrait) -> Result<()>

Stores algorithm parameters in a file storage
source§

fn write_1(&self, fs: &mut impl FileStorageTrait, name: &str) -> Result<()>

Stores algorithm parameters in a file storage Read more
source§

fn write_with_name(&self, fs: &Ptr<FileStorage>, name: &str) -> Result<()>

@deprecated Read more
source§

fn write_with_name_def(&self, fs: &Ptr<FileStorage>) -> Result<()>

👎Deprecated:

§Note

Deprecated: ## Note This alternative version of AlgorithmTraitConst::write_with_name function uses the following default values for its arguments: Read more
source§

fn empty(&self) -> Result<bool>

Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read
source§

fn save(&self, filename: &str) -> Result<()>

Saves the algorithm to a file. In order to make this method work, the derived class must implement Algorithm::write(FileStorage& fs).
source§

fn get_default_name(&self) -> Result<String>

Returns the algorithm string identifier. This string is used as top level xml/yml node tag when the object is saved to a file or string.
source§

impl Boxed for PCTSignatures

source§

unsafe fn from_raw( ptr: <PCTSignatures as OpenCVFromExtern>::ExternReceive ) -> Self

Wrap the specified raw pointer Read more
source§

fn into_raw(self) -> <PCTSignatures as OpenCVTypeExternContainer>::ExternSendMut

Return the underlying raw pointer while consuming this wrapper. Read more
source§

fn as_raw(&self) -> <PCTSignatures as OpenCVTypeExternContainer>::ExternSend

Return the underlying raw pointer. Read more
source§

fn as_raw_mut( &mut self ) -> <PCTSignatures as OpenCVTypeExternContainer>::ExternSendMut

Return the underlying mutable raw pointer Read more
source§

impl Debug for PCTSignatures

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drop for PCTSignatures

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl From<PCTSignatures> for Algorithm

source§

fn from(s: PCTSignatures) -> Self

Converts to this type from the input type.
source§

impl PCTSignaturesTrait for PCTSignatures

source§

fn as_raw_mut_PCTSignatures(&mut self) -> *mut c_void

source§

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.
source§

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

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)
source§

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)
source§

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)
source§

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)
source§

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)
source§

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)
source§

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)
source§

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

Weights (multiplicative constants) that linearly stretch individual axes of the feature space. Read more
source§

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

Weights (multiplicative constants) that linearly stretch individual axes of the feature space. Read more
source§

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

Translations of the individual axes of the feature space. Read more
source§

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

Translations of the individual axes of the feature space. Read more
source§

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

Sets sampling points used to sample the input image. Read more
source§

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

Initial seed indexes for the k-means algorithm.
source§

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

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.
source§

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.
source§

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.
source§

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

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

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.
source§

impl PCTSignaturesTraitConst for PCTSignatures

source§

fn as_raw_PCTSignatures(&self) -> *const c_void

source§

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

Computes signature of given image. Read more
source§

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

Computes signatures for multiple images in parallel. Read more
source§

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

Number of initial samples taken from the image.
source§

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.
source§

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

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)
source§

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)
source§

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)
source§

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)
source§

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)
source§

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)
source§

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)
source§

fn get_sampling_points(&self) -> Result<Vector<Point2f>>

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

fn get_init_seed_indexes(&self) -> Result<Vector<i32>>

** clusterizer *** Read more
source§

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

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

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

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.
source§

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.
source§

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.
source§

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

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

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

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

impl Send for PCTSignatures

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<Mat> ModifyInplace for Mat
where Mat: Boxed,

source§

unsafe fn modify_inplace<Res>( &mut self, f: impl FnOnce(&Mat, &mut Mat) -> Res ) -> Res

Helper function to call OpenCV functions that allow in-place modification of a Mat or another similar object. By passing a mutable reference to the Mat to this function your closure will get called with the read reference and a write references to the same Mat. This is of course unsafe as it breaks the Rust aliasing rules, but it might be useful for some performance sensitive operations. One example of an OpenCV function that allows such in-place modification is imgproc::threshold. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.