Class FaceRecognitionCore
- Namespace
- VisioForge.Core.FaceAI
- Assembly
- VisioForge.Core.FaceAI.dll
Provides core functionality for face recognition, including adding known persons and detecting faces.
public class FaceRecognitionCore : IDisposableInheritance
Implements
Inherited Members
Constructors
FaceRecognitionCore(string)
Initializes a new instance of the VisioForge.Core.FaceAI.FaceRecognitionCore class.
public FaceRecognitionCore(string modelDir)Parameters
modelDirstring-
The directory containing the face recognition models.
Exceptions
- Exception
-
Thrown if the application is not running in x64 mode.
Properties
KnownPersons
Gets the list of known persons for recognition.
public List<Person> KnownPersons { get; }Property Value
Methods
AddKnownPerson(string)
Adds a known person from an image file.
public bool AddKnownPerson(string imageFile)Parameters
imageFilestring-
The path to the image file.
Returns
- bool
-
trueif the person was added successfully; otherwise,false.
AddKnownPersonAsync(string)
Asynchronously adds a known person from an image file.
public Task<bool> AddKnownPersonAsync(string imageFile)Parameters
imageFilestring-
The path to the image file.
Returns
- Task<bool>
-
A task that represents the asynchronous operation. The task result contains
trueif successful; otherwise,false.
AddKnownPersons(string[])
Adds multiple known persons from image files.
public void AddKnownPersons(string[] imageFiles)Parameters
imageFilesstring[]-
The array of image file paths.
AddKnownPersonsAsync(string[])
Asynchronously adds multiple known persons from image files.
public Task AddKnownPersonsAsync(string[] imageFiles)Parameters
imageFilesstring[]-
The array of image file paths.
Returns
- Task
-
A task that represents the asynchronous operation.
Clear()
Clears the list of known persons.
public void Clear()Detect(Person)
Detects if the specified person matches any known person.
public Person Detect(Person person)Parameters
personPerson-
The person to detect.
Returns
- Person
-
The matched VisioForge.Core.FaceAI.Person if found; otherwise,
null.
Detect(VideoFrameX)
Detects persons in the specified video frame.
public Person[] Detect(VideoFrameX frame)Parameters
frameVideoFrameX-
The video frame.
Returns
- Person[]
-
An array of detected VisioForge.Core.FaceAI.Person objects.
DetectAsync(Person)
Asynchronously detects if the specified person matches any known person.
public Task<Person> DetectAsync(Person person)Parameters
personPerson-
The person to detect.
Returns
- Task<Person>
-
A task that represents the asynchronous operation. The task result contains the matched VisioForge.Core.FaceAI.Person if found; otherwise,
null.
DetectAsync(VideoFrameX)
Asynchronously detects persons in the specified video frame.
public Task<Person[]> DetectAsync(VideoFrameX person)Parameters
personVideoFrameX-
The video frame containing the person.
Returns
- Task<Person[]>
-
A task that represents the asynchronous operation. The task result contains an array of detected VisioForge.Core.FaceAI.Person objects.
Dispose(bool)
Releases the unmanaged dlib model resources held by the underlying FaceRecognitionDotNet.FaceRecognition handle.
protected virtual void Dispose(bool disposing)Parameters
disposingbool-
truewhen called from VisioForge.Core.FaceAI.FaceRecognitionCore.Dispose;falsewhen called from a finalizer.
Dispose()
Releases all resources used by the VisioForge.Core.FaceAI.FaceRecognitionCore.
public void Dispose()GetFacesInfo(string, int)
Gets face information from an image file.
public List<FaceInfo> GetFacesInfo(string imageFile, int maxWidthOrHeight = 320)Parameters
imageFilestring-
The path to the image file.
maxWidthOrHeightint-
The maximum width or height for resizing the image. Default is 320.
Returns
GetFacesInfo(VideoFrameX, int)
Gets face information from a video frame.
public List<FaceInfo> GetFacesInfo(VideoFrameX frame, int maxWidthOrHeight = 320)Parameters
frameVideoFrameX-
The video frame.
maxWidthOrHeightint-
The maximum width or height for resizing the image. Default is 320.
Returns
GetFacesInfo(Image, int)
Gets face information from a Dlib image object.
public List<FaceInfo> GetFacesInfo(Image imageSrc, int maxWidthOrHeight = 320)Parameters
imageSrcImage-
The source image.
maxWidthOrHeightint-
The maximum width or height for resizing the image. Default is 320.