#
.NET API Documentation
Namespace: Realeyes.FaceVerification
#
FaceVerifier Class
#
class FaceVerifier
Main entry point for face detection, embedding, and verification operations. Implements IDisposable.
#
Constructors
#
FaceVerifier(modelPath, maxConcurrency=0)
Creates a new FaceVerifier instance.
Parameters:
modelPath(string): Path to the face verification model file (.realZ)maxConcurrency(int): Maximum concurrency (0 for automatic/all cores). Default: 0
Exceptions:
ArgumentNullException: When modelPath is nullFaceVerificationException: When model loading fails
#
Methods
#
DetectFacesAsync(imageHeader)
Detects faces in an image asynchronously.
Parameters:
imageHeader(ImageHeader): Image to process
Returns:
- Task
: Disposable collection of detected faces
Exceptions:
FaceVerificationException: When detection fails
#
EmbedFaceAsync(face)
Computes the embedding vector for a detected face asynchronously.
Parameters:
face(Face): Previously detected face
Returns:
- Task<float[]>: Embedding vector as float array
Exceptions:
ArgumentNullException: When face is nullFaceVerificationException: When embedding fails
#
CompareFaces(embedding1, embedding2)
Compares two face embeddings and returns a similarity score.
Parameters:
embedding1(float[]): First face embeddingembedding2(float[]): Second face embedding
Returns:
- Match: Match result with similarity score
Exceptions:
ArgumentNullException: When either embedding is nullArgumentException: When embeddings have different lengths
#
Dispose()
Disposes the FaceVerifier and releases native resources.
#
Properties
#
ConcurrentCalculations
Type: int (read-only)
Gets the number of calculations currently running concurrently.
#
ModelName
Type: string (read-only)
Gets the name/version of the loaded model.
#
SdkVersion
Type: Version (read-only, static)
Gets the SDK version.
#
SdkVersionString
Type: string (read-only, static)
Gets the SDK version as a string.
#
FaceList Class
#
class FaceList
A disposable collection of Face objects that automatically disposes all faces when disposed.
Inherits from List<Face> and implements IDisposable and IAsyncDisposable.
#
Methods
#
Dispose()
Disposes all Face objects in the collection synchronously.
#
DisposeAsync()
Disposes all Face objects in the collection asynchronously.
Returns:
- ValueTask
#
Face Class
#
class Face
Represents a detected face with landmarks, bounding box, and quality information. Implements IDisposable.
#
Constructors
#
Face(imageHeader, landmarks, boundingBox, confidence)
Creates a Face object from a third-party face detector.
Parameters:
imageHeader(ImageHeader): Image containing the facelandmarks(Point2d[]): Face landmarks (exactly 5 points: left eye, right eye, nose, left mouth corner, right mouth corner)boundingBox(BoundingBox): Bounding box of the faceconfidence(float): Detection confidence score
Exceptions:
ArgumentNullException: When imageHeader or landmarks is nullArgumentException: When landmarks count is not exactly 5FaceVerificationException: When face creation fails
#
Methods
#
GetLandmarks()
Gets the facial landmarks.
Returns:
- Point2d[]: Array of landmark points
#
Data Types
#
ImageHeader
#
class ImageHeader
Image descriptor for passing image data to the Face Verification Library. (readonly record struct)
#
Constructors
#
ImageHeader(data, width, height, stride, format)
Creates a new image header.
Parameters:
data(byte[]): Image data byteswidth(int): Width in pixelsheight(int): Height in pixelsstride(int): Length of one row in bytes (e.g., 3*width + padding)format(ImageFormat): Pixel format
Exceptions:
ArgumentNullException: When data is nullArgumentOutOfRangeException: When width, height, or stride is not positive
#
Properties
#
Data
Type: byte[] (read-only)
Image data bytes.
#
Width
Type: int (read-only)
Width of the image in pixels.
#
Height
Type: int (read-only)
Height of the image in pixels.
#
Stride
Type: int (read-only)
Length of one row of pixels in bytes (e.g: 3*width + padding).
#
Format
Type: ImageFormat (read-only)
Image pixel format.
#
BoundingBox
#
class BoundingBox
Bounding box representing a rectangular region. (readonly record struct)
#
Constructors
#
BoundingBox(X, Y, Width, Height)
Creates a bounding box.
Parameters:
X(int): X coordinate of the top left cornerY(int): Y coordinate of the top left cornerWidth(int): Width of the bounding boxHeight(int): Height of the bounding box
#
Properties
#
X
Type: int (read-only)
X coordinate of the top left corner.
#
Y
Type: int (read-only)
Y coordinate of the top left corner.
#
Width
Type: int (read-only)
Width of the bounding box.
#
Height
Type: int (read-only)
Height of the bounding box.
#
Right
Type: int (read-only)
Gets the right edge X coordinate (X + Width).
#
Bottom
Type: int (read-only)
Gets the bottom edge Y coordinate (Y + Height).
#
Area
Type: int (read-only)
Gets the area of the bounding box (Width * Height).
#
Point2d
#
class Point2d
2D point representing a landmark coordinate. (readonly record struct)
#
Constructors
#
Point2d(X, Y)
Creates a 2D point.
Parameters:
X(float): X coordinateY(float): Y coordinate
#
Properties
#
X
Type: float (read-only)
X coordinate.
#
Y
Type: float (read-only)
Y coordinate.
#
Match
#
class Match
Result of face comparison indicating similarity. (readonly record struct)
#
Constructors
#
Match(Similarity)
Creates a match result.
Parameters:
Similarity(float): Similarity score
#
Methods
#
ExceedsThreshold(threshold)
Checks if the similarity exceeds a threshold.
Parameters:
threshold(float): Similarity threshold
Returns:
- bool: True if similarity >= threshold
#
Properties
#
Similarity
Type: float (read-only)
Similarity score.
#
Version
#
class Version
Semantic version number. (readonly record struct)
#
Constructors
#
Version(Major, Minor, Patch)
Creates a version.
Parameters:
Major(int): Major version numberMinor(int): Minor version numberPatch(int): Patch version number
#
Methods
#
ToString()
Returns the version as a string.
Returns:
- string: Version string in format "Major.Minor.Patch"
#
Properties
#
Major
Type: int (read-only)
Major version number.
#
Minor
Type: int (read-only)
Minor version number.
#
Patch
Type: int (read-only)
Patch version number.
#
Enumerations
#
ImageFormat
#
enum ImageFormat
Image pixel format.
Values:
Grayscale: 8-bit grayscale (value: 0)RGB: 24-bit RGB (value: 1)RGBA: 32-bit RGBA or RGB with padding (value: 2)BGR: 24-bit BGR (value: 3)BGRA: 32-bit BGRA or BGR with padding (value: 4)
#
DetectionQuality
#
enum DetectionQuality
Detection quality indicator.
Values:
Good: No issues detected (value: 0)BadQuality: Bad quality detected (value: 1)MaybeRolled: Face maybe rolled, embeddings could be incorrect (value: 2)
#
Exceptions
#
FaceVerificationException
#
exception FaceVerificationException
Exception thrown when Face Verification Library operations fail. Inherits from Exception.
#
Constructors
#
FaceVerificationException()
Creates a new FaceVerificationException.
#
FaceVerificationException(message)
Creates a new FaceVerificationException with a message.
Parameters:
message(string): Error message
#
FaceVerificationException(message, innerException)
Creates a new FaceVerificationException with a message and inner exception.
Parameters:
message(string): Error messageinnerException(Exception): Inner exception