pub trait PCATrait: PCATraitConst {
// Required method
fn as_raw_mut_PCA(&mut self) -> *mut c_void;
// Provided methods
fn set_eigenvectors(&mut self, val: Mat) { ... }
fn set_eigenvalues(&mut self, val: Mat) { ... }
fn set_mean(&mut self, val: Mat) { ... }
fn apply(
&mut self,
data: &impl ToInputArray,
mean: &impl ToInputArray,
flags: i32,
max_components: i32,
) -> Result<PCA> { ... }
fn apply_def(
&mut self,
data: &impl ToInputArray,
mean: &impl ToInputArray,
flags: i32,
) -> Result<PCA> { ... }
fn apply_1(
&mut self,
data: &impl ToInputArray,
mean: &impl ToInputArray,
flags: i32,
retained_variance: f64,
) -> Result<PCA> { ... }
fn read(&mut self, fn_: &impl FileNodeTraitConst) -> Result<()> { ... }
}
Expand description
Mutable methods for core::PCA
Required Methods§
fn as_raw_mut_PCA(&mut self) -> *mut c_void
Provided Methods§
Sourcefn set_eigenvectors(&mut self, val: Mat)
fn set_eigenvectors(&mut self, val: Mat)
eigenvectors of the covariation matrix
Sourcefn set_eigenvalues(&mut self, val: Mat)
fn set_eigenvalues(&mut self, val: Mat)
eigenvalues of the covariation matrix
Sourcefn set_mean(&mut self, val: Mat)
fn set_mean(&mut self, val: Mat)
mean value subtracted before the projection and added after the back projection
Sourcefn apply(
&mut self,
data: &impl ToInputArray,
mean: &impl ToInputArray,
flags: i32,
max_components: i32,
) -> Result<PCA>
fn apply( &mut self, data: &impl ToInputArray, mean: &impl ToInputArray, flags: i32, max_components: i32, ) -> Result<PCA>
performs %PCA
The operator performs %PCA of the supplied dataset. It is safe to reuse the same PCA structure for multiple datasets. That is, if the structure has been previously used with another dataset, the existing internal data is reclaimed and the new [eigenvalues], [eigenvectors] and mean are allocated and computed.
The computed [eigenvalues] are sorted from the largest to the smallest and the corresponding [eigenvectors] are stored as eigenvectors rows.
§Parameters
- data: input samples stored as the matrix rows or as the matrix columns.
- mean: optional mean value; if the matrix is empty (noArray()), the mean is computed from the data.
- flags: operation flags; currently the parameter is only used to specify the data layout. (Flags)
- maxComponents: maximum number of components that PCA should retain; by default, all the components are retained.
§C++ default parameters
- max_components: 0
Sourcefn apply_def(
&mut self,
data: &impl ToInputArray,
mean: &impl ToInputArray,
flags: i32,
) -> Result<PCA>
fn apply_def( &mut self, data: &impl ToInputArray, mean: &impl ToInputArray, flags: i32, ) -> Result<PCA>
performs %PCA
The operator performs %PCA of the supplied dataset. It is safe to reuse the same PCA structure for multiple datasets. That is, if the structure has been previously used with another dataset, the existing internal data is reclaimed and the new [eigenvalues], [eigenvectors] and mean are allocated and computed.
The computed [eigenvalues] are sorted from the largest to the smallest and the corresponding [eigenvectors] are stored as eigenvectors rows.
§Parameters
- data: input samples stored as the matrix rows or as the matrix columns.
- mean: optional mean value; if the matrix is empty (noArray()), the mean is computed from the data.
- flags: operation flags; currently the parameter is only used to specify the data layout. (Flags)
- maxComponents: maximum number of components that PCA should retain; by default, all the components are retained.
§Note
This alternative version of PCATrait::apply function uses the following default values for its arguments:
- max_components: 0
Sourcefn apply_1(
&mut self,
data: &impl ToInputArray,
mean: &impl ToInputArray,
flags: i32,
retained_variance: f64,
) -> Result<PCA>
fn apply_1( &mut self, data: &impl ToInputArray, mean: &impl ToInputArray, flags: i32, retained_variance: f64, ) -> Result<PCA>
performs %PCA
The operator performs %PCA of the supplied dataset. It is safe to reuse the same PCA structure for multiple datasets. That is, if the structure has been previously used with another dataset, the existing internal data is reclaimed and the new [eigenvalues], [eigenvectors] and mean are allocated and computed.
The computed [eigenvalues] are sorted from the largest to the smallest and the corresponding [eigenvectors] are stored as eigenvectors rows.
§Parameters
- data: input samples stored as the matrix rows or as the matrix columns.
- mean: optional mean value; if the matrix is empty (noArray()), the mean is computed from the data.
- flags: operation flags; currently the parameter is only used to specify the data layout. (Flags)
- maxComponents: maximum number of components that PCA should retain; by default, all the components are retained.
§Overloaded parameters
- data: input samples stored as the matrix rows or as the matrix columns.
- mean: optional mean value; if the matrix is empty (noArray()), the mean is computed from the data.
- flags: operation flags; currently the parameter is only used to specify the data layout. (PCA::Flags)
- retainedVariance: Percentage of variance that %PCA should retain. Using this parameter will let the %PCA decided how many components to retain but it will always keep at least 2.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.