Struct FaceEnrollmentManual
pub struct FaceEnrollmentManual(/* private fields */);
Expand description
Manual face enrollment functionality.
Implementations§
§impl FaceEnrollmentManual
impl FaceEnrollmentManual
pub fn embedding_size(&self) -> usize
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>
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>
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>
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>
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>
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)
pub fn remove_all_embeddings(&mut self)
Remove all face embeddings from the face library.
pub fn max_face_library_size(&self) -> usize
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.