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.
Implementations§
source§impl PCTSignatures
impl PCTSignatures
sourcepub fn create(
init_sample_count: i32,
init_seed_count: i32,
point_distribution: i32
) -> Result<Ptr<PCTSignatures>>
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
sourcepub fn create_def() -> Result<Ptr<PCTSignatures>>
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
sourcepub fn create_1(
init_sampling_points: &Vector<Point2f>,
init_seed_count: i32
) -> Result<Ptr<PCTSignatures>>
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.
sourcepub fn create_2(
init_sampling_points: &Vector<Point2f>,
init_cluster_seed_indexes: &Vector<i32>
) -> Result<Ptr<PCTSignatures>>
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.
sourcepub fn draw_signature(
source: &impl ToInputArray,
signature: &impl ToInputArray,
result: &mut impl ToOutputArray,
radius_to_shorter_side_ratio: f32,
border_thickness: i32
) -> Result<()>
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
sourcepub fn draw_signature_def(
source: &impl ToInputArray,
signature: &impl ToInputArray,
result: &mut impl ToOutputArray
) -> Result<()>
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
sourcepub fn generate_init_points(
init_points: &mut Vector<Point2f>,
count: i32,
point_distribution: i32
) -> Result<()>
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
impl AlgorithmTrait for PCTSignatures
source§impl AlgorithmTraitConst for PCTSignatures
impl AlgorithmTraitConst for PCTSignatures
fn as_raw_Algorithm(&self) -> *const c_void
source§fn write(&self, fs: &mut impl FileStorageTrait) -> Result<()>
fn write(&self, fs: &mut impl FileStorageTrait) -> Result<()>
source§fn write_1(&self, fs: &mut impl FileStorageTrait, name: &str) -> Result<()>
fn write_1(&self, fs: &mut impl FileStorageTrait, name: &str) -> Result<()>
source§fn write_with_name(&self, fs: &Ptr<FileStorage>, name: &str) -> Result<()>
fn write_with_name(&self, fs: &Ptr<FileStorage>, name: &str) -> Result<()>
source§fn write_with_name_def(&self, fs: &Ptr<FileStorage>) -> Result<()>
fn write_with_name_def(&self, fs: &Ptr<FileStorage>) -> Result<()>
§Note
source§fn empty(&self) -> Result<bool>
fn empty(&self) -> Result<bool>
source§fn save(&self, filename: &str) -> Result<()>
fn save(&self, filename: &str) -> Result<()>
source§fn get_default_name(&self) -> Result<String>
fn get_default_name(&self) -> Result<String>
source§impl Boxed for PCTSignatures
impl Boxed for PCTSignatures
source§unsafe fn from_raw(
ptr: <PCTSignatures as OpenCVFromExtern>::ExternReceive
) -> Self
unsafe fn from_raw( ptr: <PCTSignatures as OpenCVFromExtern>::ExternReceive ) -> Self
source§fn into_raw(self) -> <PCTSignatures as OpenCVTypeExternContainer>::ExternSendMut
fn into_raw(self) -> <PCTSignatures as OpenCVTypeExternContainer>::ExternSendMut
source§fn as_raw(&self) -> <PCTSignatures as OpenCVTypeExternContainer>::ExternSend
fn as_raw(&self) -> <PCTSignatures as OpenCVTypeExternContainer>::ExternSend
source§fn as_raw_mut(
&mut self
) -> <PCTSignatures as OpenCVTypeExternContainer>::ExternSendMut
fn as_raw_mut( &mut self ) -> <PCTSignatures as OpenCVTypeExternContainer>::ExternSendMut
source§impl Debug for PCTSignatures
impl Debug for PCTSignatures
source§impl Drop for PCTSignatures
impl Drop for PCTSignatures
source§impl From<PCTSignatures> for Algorithm
impl From<PCTSignatures> for Algorithm
source§fn from(s: PCTSignatures) -> Self
fn from(s: PCTSignatures) -> Self
source§impl PCTSignaturesTrait for PCTSignatures
impl PCTSignaturesTrait for PCTSignatures
fn as_raw_mut_PCTSignatures(&mut self) -> *mut c_void
source§fn set_grayscale_bits(&mut self, grayscale_bits: i32) -> Result<()>
fn set_grayscale_bits(&mut self, grayscale_bits: i32) -> Result<()>
source§fn set_window_radius(&mut self, radius: i32) -> Result<()>
fn set_window_radius(&mut self, radius: i32) -> Result<()>
source§fn set_weight_x(&mut self, weight: f32) -> Result<()>
fn set_weight_x(&mut self, weight: f32) -> Result<()>
source§fn set_weight_y(&mut self, weight: f32) -> Result<()>
fn set_weight_y(&mut self, weight: f32) -> Result<()>
source§fn set_weight_l(&mut self, weight: f32) -> Result<()>
fn set_weight_l(&mut self, weight: f32) -> Result<()>
source§fn set_weight_a(&mut self, weight: f32) -> Result<()>
fn set_weight_a(&mut self, weight: f32) -> Result<()>
source§fn set_weight_b(&mut self, weight: f32) -> Result<()>
fn set_weight_b(&mut self, weight: f32) -> Result<()>
source§fn set_weight_contrast(&mut self, weight: f32) -> Result<()>
fn set_weight_contrast(&mut self, weight: f32) -> Result<()>
source§fn set_weight_entropy(&mut self, weight: f32) -> Result<()>
fn set_weight_entropy(&mut self, weight: f32) -> Result<()>
source§fn set_weight(&mut self, idx: i32, value: f32) -> Result<()>
fn set_weight(&mut self, idx: i32, value: f32) -> Result<()>
source§fn set_weights(&mut self, weights: &Vector<f32>) -> Result<()>
fn set_weights(&mut self, weights: &Vector<f32>) -> Result<()>
source§fn set_translation(&mut self, idx: i32, value: f32) -> Result<()>
fn set_translation(&mut self, idx: i32, value: f32) -> Result<()>
source§fn set_translations(&mut self, translations: &Vector<f32>) -> Result<()>
fn set_translations(&mut self, translations: &Vector<f32>) -> Result<()>
source§fn set_sampling_points(
&mut self,
sampling_points: Vector<Point2f>
) -> Result<()>
fn set_sampling_points( &mut self, sampling_points: Vector<Point2f> ) -> Result<()>
source§fn set_init_seed_indexes(
&mut self,
init_seed_indexes: Vector<i32>
) -> Result<()>
fn set_init_seed_indexes( &mut self, init_seed_indexes: Vector<i32> ) -> Result<()>
source§fn set_iteration_count(&mut self, iteration_count: i32) -> Result<()>
fn set_iteration_count(&mut self, iteration_count: i32) -> Result<()>
source§fn set_max_clusters_count(&mut self, max_clusters_count: i32) -> Result<()>
fn set_max_clusters_count(&mut self, max_clusters_count: i32) -> Result<()>
source§fn set_cluster_min_size(&mut self, cluster_min_size: i32) -> Result<()>
fn set_cluster_min_size(&mut self, cluster_min_size: i32) -> Result<()>
source§fn set_joining_distance(&mut self, joining_distance: f32) -> Result<()>
fn set_joining_distance(&mut self, joining_distance: f32) -> Result<()>
source§impl PCTSignaturesTraitConst for PCTSignatures
impl PCTSignaturesTraitConst for PCTSignatures
fn as_raw_PCTSignatures(&self) -> *const c_void
source§fn compute_signature(
&self,
image: &impl ToInputArray,
signature: &mut impl ToOutputArray
) -> Result<()>
fn compute_signature( &self, image: &impl ToInputArray, signature: &mut impl ToOutputArray ) -> Result<()>
source§fn compute_signatures(
&self,
images: &Vector<Mat>,
signatures: &mut Vector<Mat>
) -> Result<()>
fn compute_signatures( &self, images: &Vector<Mat>, signatures: &mut Vector<Mat> ) -> Result<()>
source§fn get_sample_count(&self) -> Result<i32>
fn get_sample_count(&self) -> Result<i32>
source§fn get_grayscale_bits(&self) -> Result<i32>
fn get_grayscale_bits(&self) -> Result<i32>
source§fn get_window_radius(&self) -> Result<i32>
fn get_window_radius(&self) -> Result<i32>
source§fn get_weight_x(&self) -> Result<f32>
fn get_weight_x(&self) -> Result<f32>
source§fn get_weight_y(&self) -> Result<f32>
fn get_weight_y(&self) -> Result<f32>
source§fn get_weight_l(&self) -> Result<f32>
fn get_weight_l(&self) -> Result<f32>
source§fn get_weight_a(&self) -> Result<f32>
fn get_weight_a(&self) -> Result<f32>
source§fn get_weight_b(&self) -> Result<f32>
fn get_weight_b(&self) -> Result<f32>
source§fn get_weight_contrast(&self) -> Result<f32>
fn get_weight_contrast(&self) -> Result<f32>
source§fn get_weight_entropy(&self) -> Result<f32>
fn get_weight_entropy(&self) -> Result<f32>
source§fn get_sampling_points(&self) -> Result<Vector<Point2f>>
fn get_sampling_points(&self) -> Result<Vector<Point2f>>
source§fn get_init_seed_count(&self) -> Result<i32>
fn get_init_seed_count(&self) -> Result<i32>
source§fn get_iteration_count(&self) -> Result<i32>
fn get_iteration_count(&self) -> Result<i32>
source§fn get_max_clusters_count(&self) -> Result<i32>
fn get_max_clusters_count(&self) -> Result<i32>
source§fn get_cluster_min_size(&self) -> Result<i32>
fn get_cluster_min_size(&self) -> Result<i32>
source§fn get_joining_distance(&self) -> Result<f32>
fn get_joining_distance(&self) -> Result<f32>
source§fn get_drop_threshold(&self) -> Result<f32>
fn get_drop_threshold(&self) -> Result<f32>
source§fn get_distance_function(&self) -> Result<i32>
fn get_distance_function(&self) -> Result<i32>
impl Send for PCTSignatures
Auto Trait Implementations§
impl Freeze for PCTSignatures
impl RefUnwindSafe for PCTSignatures
impl !Sync for PCTSignatures
impl Unpin for PCTSignatures
impl UnwindSafe for PCTSignatures
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<Mat> ModifyInplace for Matwhere
Mat: Boxed,
impl<Mat> ModifyInplace for Matwhere
Mat: Boxed,
source§unsafe fn modify_inplace<Res>(
&mut self,
f: impl FnOnce(&Mat, &mut Mat) -> Res
) -> Res
unsafe fn modify_inplace<Res>( &mut self, f: impl FnOnce(&Mat, &mut Mat) -> Res ) -> Res
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