Struct FaceEnrollmentManual

pub struct FaceEnrollmentManual(/* private fields */);
Expand description

Manual face enrollment functionality.

Implementations§

§

impl FaceEnrollmentManual

pub fn embedding_size(&self) -> usize

Returns the size of the face embeddings obtained from finish_enrollment and required by add_embedding.

pub fn start_enrollment( &mut self, region_of_interest: &RelativeCoords, ) -> Result<(), Error>

This starts the enrollment procedure for a new face.

During subsequent calls to VideoIntelligence::process_frame or VideoIntelligence::single_image, face embeddings will be computed. During enrollment there should be a single face in the image, or in the optional Region specified by region_of_interest, ideally clearly and completely visible. The enrollment procedure can be finalized by calling finish_enrollment.

§Errors
  • Error::AlreadyEnrolling

pub fn finish_enrollment(&mut self) -> Result<FaceEmbedding, Error>

Finalize the face enrollment procedure started by start_enrollment and obtain the face embedding.

The application is responsible for storing this embedding on persistent storage and passing it to add_embedding every time an instance of this class is created. The face enrollment procedure does not automatically call add_embedding.

§Errors
  • Error::NotEnrolling
  • Error::EnrollmentFailed
  • Error::LowQualityEnrollment

pub fn add_embedding( &mut self, face_embedding: FaceEmbedding, face_id: &FaceID, ) -> Result<(), Error>

Add a face embedding to the face library for any VideoIntelligence::process_frame calls that follow.

A second embedding for the same face ID will overwrite the previous one. When calling FaceIdentification::get_face_id on a detected person box, it will use the face_id provided here as return value.

§Errors
  • Error::InvalidFaceID
  • Error::InvalidEmbedding
  • Error::FaceLibraryFull

pub fn get_face_ids(&self) -> Vec<FaceID>

Return the face IDs of all enrolled faces.

This list of face IDs is not related to the faces currently in view. The face IDs returned by this function are all faces that have ever been enrolled into the face library. To retrieve information about the faces currently in view, use FaceIdentification::get_face_id.

pub fn remove_embedding(&mut self, face_id: FaceID) -> Result<(), Error>

Remove a face embedding from the face library for any VideoIntelligence::process_frame calls that follow.

§Errors
  • Error::InvalidFaceID

pub fn remove_all_embeddings(&mut self)

Remove all face embeddings from the face library.

pub fn max_face_library_size(&self) -> usize

Returns the maximum size of the face library.

When the library is full, add_embedding will return FaceLibraryFull and won’t be able to add new embeddings, until FaceEnrollmentManual::remove_embedding is called.

Trait Implementations§

§

impl Debug for FaceEnrollmentManual

§

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

Formats the value using the given formatter. Read more

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<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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.