import { SpoofingDetection, type SpoofingOptions, type SpoofingResult } from "./analysis/spoofing.ana.js"; import type { CoreCanvas, PlatformProvider } from "./core/platform.js"; import type { BaseDetection, DetectOptions, DetectionModelOptions, DetectionResult } from "./detection/base.interface.js"; import type { BaseRecognition, RecognitionModelOptions, RecognitionResult } from "./recognition/base.interface.js"; import type { UnifaceCompactResult, UnifaceFullResult, UnifaceVerifyOptions } from "./uniface.interface.js"; import type { BaseVerification, VerificationModelOptions, VerificationResult } from "./verification/base.interface.js"; /** * Configuration options for Uniface service */ export interface UnifaceOptions { /** Options for face detection model */ detection?: Partial; /** Options for face recognition model */ recognition?: Partial; /** Options for face verification */ verification?: Partial; /** Options for anti spoofing face detection */ spoofing?: Partial; } /** * Input that can be either raw image or pre-detected result */ type ImageInput = ArrayBuffer | CoreCanvas; type DetectedInput = { image: ImageInput; detection: DetectionResult; }; /** * Main service class for face detection, recognition, and verification */ export declare class Uniface { protected options: UnifaceOptions; /** Face detection model instance */ protected detection: BaseDetection; /** Face recognition model instance */ protected recognition: BaseRecognition; /** Face verification method instance */ protected verification: BaseVerification; /** Face spoofing detection method instance */ protected spoofing: SpoofingDetection; /** Platform provider for cross-platform operations */ protected platform: PlatformProvider; /** Initializes Uniface service with default models */ constructor(options?: UnifaceOptions, platform?: PlatformProvider); /** Initializes all models (detection, recognition) */ initialize(): Promise; /** * Checks if the service is initialized * @returns True if all models have been initialized */ isInitialized(): boolean; /** * Detects face in an image * @param image - Input image as ArrayBuffer or Canvas * @param options - Optional detection options * @returns Detection result or null if no face found */ detect(image: ImageInput, options?: DetectOptions): Promise; /** * Generates face embedding from image * @param image - Input image as ArrayBuffer or Canvas * @returns Recognition result with embedding vector */ recognize(image: ImageInput): Promise; /** * Verifies if two images contain the same person * @param image1 - First image * @param image2 - Second image * @param options - Verification options with compact: true * @returns Compact verification result */ verify(image1: ImageInput, image2: ImageInput, options: UnifaceVerifyOptions & { compact: true; }): Promise; /** * Verifies if two images contain the same person * @param image1 - First image * @param image2 - Second image * @param options - Verification options with compact: false * @returns Full verification result */ verify(image1: ImageInput, image2: ImageInput, options: UnifaceVerifyOptions & { compact: false; }): Promise; /** * Verifies if two images contain the same person (defaults to compact) */ verify(image1: ImageInput, image2: ImageInput, options?: UnifaceVerifyOptions): Promise; /** * Verifies with pre-computed detections (optimized - skips detection) */ verifyWithDetections(input1: DetectedInput | ImageInput, input2: DetectedInput | ImageInput, options: UnifaceVerifyOptions & { compact: true; }): Promise; verifyWithDetections(input1: DetectedInput | ImageInput, input2: DetectedInput | ImageInput, options: UnifaceVerifyOptions & { compact: false; }): Promise; verifyWithDetections(input1: DetectedInput | ImageInput, input2: DetectedInput | ImageInput, options?: UnifaceVerifyOptions): Promise; /** * Processes input that can be either raw image or detected input */ private processImageInput; /** * Type guard for DetectedInput */ private isDetectedInput; /** * Processes an image through full pipeline (detection + recognition + spoofing) */ private processImage; /** * Processes an image with pre-computed detection (skips detection step) */ private processImageWithDetection; /** * Builds verification result from processed images */ private buildVerificationResult; /** * Compares two face embeddings directly * @param embedding1 - First face embedding * @param embedding2 - Second face embedding * @param threshold - Optional threshold to override model-level default * @returns Verification result with similarity score */ verifyEmbedding(embedding1: Float32Array, embedding2: Float32Array, threshold?: number): Promise; /** * Analyzes if a cropped facial image is spoofed * @param image - Cropped facial area image as ArrayBuffer or Canvas * @returns Spoofing analysis result */ spoofingAnalysis(image: ImageInput): Promise; /** * Analyzes if an image contains a spoofed face (with automatic detection and cropping) * @param image - Full image as ArrayBuffer or Canvas * @param options - Optional detection options * @returns Spoofing analysis result or null if no face detected */ spoofingAnalysisWithDetection(image: ImageInput, options?: DetectOptions): Promise; /** * Logs a message using the logger utility * @param methodName - Name of the method * @param message - Log message */ private log; /** Releases all model resources */ destroy(): Promise; } export {};