#
.NET API Documentation
#
DemographicEstimator class
#
class Realeyes.DemographicEstimation.DemographicEstimator
Main entry point for face detection and demographic estimation operations. This class is thread-safe and supports concurrent asynchronous operations.
#
Constructor
DemographicEstimator(string modelPath, int maxConcurrency = 0)
Creates a new DemographicEstimator instance
Parameters:
modelPath(string) - Path to the demographic estimation model file (.realZ)maxConcurrency(int) - Maximum concurrency (0 for automatic/all cores), default: 0
Throws:
ArgumentNullException- When modelPath is nullDemographicEstimationException- When model loading fails
#
Methods
#
DetectFacesAsync(imageHeader)
Task<FaceList> DetectFacesAsync(ImageHeader imageHeader)
Detects faces in an image asynchronously. This method is non-blocking and thread-safe - multiple calls can be made concurrently.
Parameters:
imageHeader(ImageHeader) - Image to process
Returns: Task
Throws:
DemographicEstimationException- When detection fails
#
EstimateAsync(face)
Task<EstimationResult> EstimateAsync(Face face)
Estimates demographic information (age, gender, age uncertainty) for a detected face asynchronously. This method is non-blocking and thread-safe - multiple calls can be made concurrently.
Parameters:
face(Face) - Previously detected face
Returns: Task
Throws:
ArgumentNullException- When face is nullDemographicEstimationException- When estimation fails
#
Properties
#
ConcurrentCalculations
int ConcurrentCalculations { get; }
Gets the number of calculations currently running concurrently. Use this to limit the number of concurrent calculations if needed.
#
ModelName
string ModelName { get; }
Gets the name/version of the loaded model
#
SdkVersion
static Version SdkVersion { get; }
Gets the SDK version (static property)
#
SdkVersionString
static string SdkVersionString { get; }
Gets the SDK version as a string (static property)
#
ImageHeader class
#
class Realeyes.DemographicEstimation.ImageHeader
Image descriptor for passing image data to the Demographic Estimation Library
#
Constructor
ImageHeader(byte[] data, int width, int height, int stride, ImageFormat 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
Throws:
ArgumentNullException- When data is nullArgumentOutOfRangeException- When width, height, or stride is not positive
#
Properties
Data(byte[]) - Image data bytesWidth(int) - Width of the image in pixelsHeight(int) - Height of the image in pixelsStride(int) - Length of one row of pixels in bytes (e.g: 3*width + padding)Format(ImageFormat) - Image pixel format
#
Result classes
#
FaceList
#
class Realeyes.DemographicEstimation.FaceList
A disposable collection of Face objects that automatically disposes all faces when disposed.
Inherits from List
#
Methods
#
Dispose()
void Dispose()
Disposes all Face objects in the collection synchronously
#
DisposeAsync()
#
Face
#
class Realeyes.DemographicEstimation.Face
Represents a detected face with landmarks, bounding box, and confidence information
#
Constructor
Face(ImageHeader imageHeader, Point2d[] landmarks, BoundingBox boundingBox, float confidence)
Creates a Face object from a third-party face detector
Parameters:
imageHeader(ImageHeader) - Image containing the facelandmarks(Point2d[]) - Face landmarksboundingBox(BoundingBox) - Bounding box of the faceconfidence(float) - Detection confidence score
Throws:
ArgumentNullException- When imageHeader or landmarks is nullDemographicEstimationException- When face creation fails
#
Properties
BoundingBox(BoundingBox) - Gets the bounding box of this faceConfidence(float) - Gets the detection confidence score
#
Methods
#
GetLandmarks()
Point2d[] GetLandmarks()
Gets the facial landmarks
Returns: Point2d[]
#
Clone()
Face Clone()
Creates a copy of this face
Returns: Face
Throws:
DemographicEstimationException- When cloning fails
#
Dispose()
void Dispose()
Disposes the face and releases native resources
#
Point2d
#
struct Realeyes.DemographicEstimation.Point2d
2D point representing a landmark coordinate
#
Properties
X(float) - X coordinate of landmarkY(float) - Y coordinate of landmark
#
BoundingBox
#
struct Realeyes.DemographicEstimation.BoundingBox
Bounding box representing a rectangular region
#
Properties
X(int) - X coordinate of the top-left cornerY(int) - Y coordinate of the top-left cornerWidth(int) - Width of the bounding box in pixelsHeight(int) - Height of the bounding box in pixelsRight(int) - Gets the right edge X coordinate (computed property)Bottom(int) - Gets the bottom edge Y coordinate (computed property)Area(int) - Gets the area of the bounding box (computed property)
#
EstimationResult
#
class Realeyes.DemographicEstimation.EstimationResult
Result of demographic estimation containing optional age, gender, and age uncertainty values
#
Properties
Age(float?) - Estimated age in years (if available)Gender(Gender?) - Estimated gender (if available)AgeUncertainty(float?) - Age uncertainty estimation (if available)
#
Methods
#
ToString()
string ToString()
Returns a string representation of the estimation result
Returns: string
#
Enumerations
#
OutputType
#
enum Realeyes.DemographicEstimation.OutputType
Type of demographic estimation output
Values:
Age = 0- Age estimationGender = 1- Gender classificationAgeUncertainty = 2- Age uncertainty estimation
#
Gender
#
enum Realeyes.DemographicEstimation.Gender
Gender classification
Values:
Female = 0- FemaleMale = 1- Male
#
ImageFormat
#
enum Realeyes.DemographicEstimation.ImageFormat
Image pixel format
Values:
Grayscale = 0- 8-bit grayscaleRGB = 1- 24-bit RGBRGBA = 2- 32-bit RGBA or RGB with paddingBGR = 3- 24-bit BGRBGRA = 4- 32-bit BGRA or BGR with padding
#
Version
#
struct Realeyes.DemographicEstimation.Version
Semantic version number
#
Properties
Major(int) - Major version numberMinor(int) - Minor version numberPatch(int) - Patch version number
#
Methods
#
ToString()
string ToString()
Returns the version as a string
Returns: string
#
Exceptions
#
DemographicEstimationException
#
class Realeyes.DemographicEstimation.DemographicEstimationException
Exception thrown when demographic estimation operations fail
Disposes all Face objects in the collection asynchronously