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 unsafe in a general case as it leads to having non-exclusive mutable access to the internal data,
but it can be useful for some performance sensitive operations. One example of an OpenCV function that allows such in-place
modification is imgproc::threshold
. Read more