Struct opencv::face::EigenFaceRecognizer
source · pub struct EigenFaceRecognizer { /* private fields */ }
Implementations§
source§impl EigenFaceRecognizer
impl EigenFaceRecognizer
sourcepub fn create(
num_components: i32,
threshold: f64
) -> Result<Ptr<EigenFaceRecognizer>>
pub fn create( num_components: i32, threshold: f64 ) -> Result<Ptr<EigenFaceRecognizer>>
Parameters
- num_components: The number of components (read: Eigenfaces) kept for this Principal Component Analysis. As a hint: There’s no rule how many components (read: Eigenfaces) should be kept for good reconstruction capabilities. It is based on your input data, so experiment with the number. Keeping 80 components should almost always be sufficient.
- threshold: The threshold applied in the prediction.
Notes:
- Training and prediction must be done on grayscale images, use cvtColor to convert between the color spaces.
- THE EIGENFACES METHOD MAKES THE ASSUMPTION, THAT THE TRAINING AND TEST IMAGES ARE OF EQUAL SIZE. (caps-lock, because I got so many mails asking for this). You have to make sure your input data has the correct shape, else a meaningful exception is thrown. Use resize to resize the images.
- This model does not support updating.
Model internal data:
- num_components see EigenFaceRecognizer::create.
- threshold see EigenFaceRecognizer::create.
- eigenvalues The eigenvalues for this Principal Component Analysis (ordered descending).
- eigenvectors The eigenvectors for this Principal Component Analysis (ordered by their eigenvalue).
- mean The sample mean calculated from the training data.
- projections The projections of the training data.
- labels The threshold applied in the prediction. If the distance to the nearest neighbor is larger than the threshold, this method returns -1.
C++ default parameters
- num_components: 0
- threshold: DBL_MAX
sourcepub fn create_def() -> Result<Ptr<EigenFaceRecognizer>>
pub fn create_def() -> Result<Ptr<EigenFaceRecognizer>>
Parameters
- num_components: The number of components (read: Eigenfaces) kept for this Principal Component Analysis. As a hint: There’s no rule how many components (read: Eigenfaces) should be kept for good reconstruction capabilities. It is based on your input data, so experiment with the number. Keeping 80 components should almost always be sufficient.
- threshold: The threshold applied in the prediction.
Notes:
- Training and prediction must be done on grayscale images, use cvtColor to convert between the color spaces.
- THE EIGENFACES METHOD MAKES THE ASSUMPTION, THAT THE TRAINING AND TEST IMAGES ARE OF EQUAL SIZE. (caps-lock, because I got so many mails asking for this). You have to make sure your input data has the correct shape, else a meaningful exception is thrown. Use resize to resize the images.
- This model does not support updating.
Model internal data:
- num_components see EigenFaceRecognizer::create.
- threshold see EigenFaceRecognizer::create.
- eigenvalues The eigenvalues for this Principal Component Analysis (ordered descending).
- eigenvectors The eigenvectors for this Principal Component Analysis (ordered by their eigenvalue).
- mean The sample mean calculated from the training data.
- projections The projections of the training data.
- labels The threshold applied in the prediction. If the distance to the nearest neighbor is larger than the threshold, this method returns -1.
Note
This alternative version of EigenFaceRecognizer::create function uses the following default values for its arguments:
- num_components: 0
- threshold: DBL_MAX
Trait Implementations§
source§impl AlgorithmTrait for EigenFaceRecognizer
impl AlgorithmTrait for EigenFaceRecognizer
source§impl AlgorithmTraitConst for EigenFaceRecognizer
impl AlgorithmTraitConst for EigenFaceRecognizer
fn as_raw_Algorithm(&self) -> *const c_void
source§fn write(&self, fs: &mut FileStorage) -> Result<()>
fn write(&self, fs: &mut FileStorage) -> Result<()>
Stores algorithm parameters in a file storage
source§fn write_1(&self, fs: &mut FileStorage, name: &str) -> Result<()>
fn write_1(&self, fs: &mut FileStorage, name: &str) -> Result<()>
Stores algorithm parameters in a file storage Read more
source§fn write_with_name(&self, fs: &Ptr<FileStorage>, name: &str) -> Result<()>
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<()>
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>
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<()>
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>
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 BasicFaceRecognizerTraitConst for EigenFaceRecognizer
impl BasicFaceRecognizerTraitConst for EigenFaceRecognizer
fn as_raw_BasicFaceRecognizer(&self) -> *const c_void
fn get_projections(&self) -> Result<Vector<Mat>>
fn get_labels(&self) -> Result<Mat>
fn get_eigen_values(&self) -> Result<Mat>
fn get_eigen_vectors(&self) -> Result<Mat>
fn get_mean(&self) -> Result<Mat>
fn write(&self, fs: &mut FileStorage) -> Result<()>
fn empty(&self) -> Result<bool>
source§impl Boxed for EigenFaceRecognizer
impl Boxed for EigenFaceRecognizer
source§impl Debug for EigenFaceRecognizer
impl Debug for EigenFaceRecognizer
source§impl Drop for EigenFaceRecognizer
impl Drop for EigenFaceRecognizer
source§impl EigenFaceRecognizerTrait for EigenFaceRecognizer
impl EigenFaceRecognizerTrait for EigenFaceRecognizer
fn as_raw_mut_EigenFaceRecognizer(&mut self) -> *mut c_void
source§impl EigenFaceRecognizerTraitConst for EigenFaceRecognizer
impl EigenFaceRecognizerTraitConst for EigenFaceRecognizer
fn as_raw_EigenFaceRecognizer(&self) -> *const c_void
source§impl FaceRecognizerTrait for EigenFaceRecognizer
impl FaceRecognizerTrait for EigenFaceRecognizer
fn as_raw_mut_FaceRecognizer(&mut self) -> *mut c_void
source§fn train(
&mut self,
src: &impl ToInputArray,
labels: &impl ToInputArray
) -> Result<()>
fn train( &mut self, src: &impl ToInputArray, labels: &impl ToInputArray ) -> Result<()>
Trains a FaceRecognizer with given data and associated labels. Read more
source§fn update(
&mut self,
src: &impl ToInputArray,
labels: &impl ToInputArray
) -> Result<()>
fn update( &mut self, src: &impl ToInputArray, labels: &impl ToInputArray ) -> Result<()>
Updates a FaceRecognizer with given data and associated labels. Read more
source§fn read(&mut self, filename: &str) -> Result<()>
fn read(&mut self, filename: &str) -> Result<()>
Loads a FaceRecognizer and its model state. Read more
source§fn read_1(&mut self, fn_: &FileNode) -> Result<()>
fn read_1(&mut self, fn_: &FileNode) -> Result<()>
Loads a FaceRecognizer and its model state. Read more
source§impl FaceRecognizerTraitConst for EigenFaceRecognizer
impl FaceRecognizerTraitConst for EigenFaceRecognizer
fn as_raw_FaceRecognizer(&self) -> *const c_void
source§fn predict_label(&self, src: &impl ToInputArray) -> Result<i32>
fn predict_label(&self, src: &impl ToInputArray) -> Result<i32>
Predicts a label and associated confidence (e.g. distance) for a given input image. Read more
source§fn predict(
&self,
src: &impl ToInputArray,
label: &mut i32,
confidence: &mut f64
) -> Result<()>
fn predict( &self, src: &impl ToInputArray, label: &mut i32, confidence: &mut f64 ) -> Result<()>
Predicts a label and associated confidence (e.g. distance) for a given input image. Read more
source§fn predict_collect(
&self,
src: &impl ToInputArray,
collector: Ptr<PredictCollector>
) -> Result<()>
fn predict_collect( &self, src: &impl ToInputArray, collector: Ptr<PredictCollector> ) -> Result<()>
if implemented - send all result of prediction to collector that can be used for somehow custom result handling Read more
source§fn write(&self, filename: &str) -> Result<()>
fn write(&self, filename: &str) -> Result<()>
Saves a FaceRecognizer and its model state. Read more
source§fn write_1(&self, fs: &mut FileStorage) -> Result<()>
fn write_1(&self, fs: &mut FileStorage) -> Result<()>
Saves a FaceRecognizer and its model state. Read more
source§fn empty(&self) -> Result<bool>
fn empty(&self) -> Result<bool>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
source§fn get_label_info(&self, label: i32) -> Result<String>
fn get_label_info(&self, label: i32) -> Result<String>
Gets string information by label. Read more
source§fn get_labels_by_string(&self, str: &str) -> Result<Vector<i32>>
fn get_labels_by_string(&self, str: &str) -> Result<Vector<i32>>
Gets vector of labels by string. Read more
source§fn get_threshold(&self) -> Result<f64>
fn get_threshold(&self) -> Result<f64>
threshold parameter accessor - required for default BestMinDist collector
source§impl From<EigenFaceRecognizer> for Algorithm
impl From<EigenFaceRecognizer> for Algorithm
source§fn from(s: EigenFaceRecognizer) -> Self
fn from(s: EigenFaceRecognizer) -> Self
Converts to this type from the input type.
source§impl From<EigenFaceRecognizer> for BasicFaceRecognizer
impl From<EigenFaceRecognizer> for BasicFaceRecognizer
source§fn from(s: EigenFaceRecognizer) -> Self
fn from(s: EigenFaceRecognizer) -> Self
Converts to this type from the input type.
source§impl From<EigenFaceRecognizer> for FaceRecognizer
impl From<EigenFaceRecognizer> for FaceRecognizer
source§fn from(s: EigenFaceRecognizer) -> Self
fn from(s: EigenFaceRecognizer) -> Self
Converts to this type from the input type.
source§impl TryFrom<FaceRecognizer> for EigenFaceRecognizer
impl TryFrom<FaceRecognizer> for EigenFaceRecognizer
impl Send for EigenFaceRecognizer
Auto Trait Implementations§
impl RefUnwindSafe for EigenFaceRecognizer
impl !Sync for EigenFaceRecognizer
impl Unpin for EigenFaceRecognizer
impl UnwindSafe for EigenFaceRecognizer
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
Mutably borrows from an owned value. Read more