UNPKG

@nuralogix.ai/anura-web-core-sdk

Version:

Anura Web Core SDK

160 lines (147 loc) 4.07 kB
/** * The objectFit sets how the content of an element should be resized to fit its container. * * `contain`: * * The content is scaled to maintain its aspect ratio while fitting within the element's * content box. The entire object is made to fill the box, while preserving its aspect ratio, * so the object will be "letterboxed" or "pillarboxed" if its aspect ratio does not match the * aspect ratio of the box. * * `cover`: * * The content is sized to maintain its aspect ratio while filling the element's entire * content box. If the object's aspect ratio does not match the aspect ratio of its box, then * the object will be clipped to fit. * * `none`: * * The content is not resized. * @enum */ declare const objectFit: { readonly CONTAIN: "contain"; readonly COVER: "cover"; readonly NONE: "none"; }; type ObjectFit = typeof objectFit[keyof typeof objectFit]; interface PipelineStats { cameraFps: number; faceTrackerFps: number; faceCount: number; detectionAvgMs: number; /** Pure ONNX session.run() time inside worker (excludes message overhead) */ detectionInferenceMs: number; detectionSkipN: number; landmarkAvgMs: number; /** Pure ONNX session.run() time inside worker (excludes message overhead) */ landmarkInferenceMs: number; landmarkSkipPct: number; costPerFrameMs: number; } interface DfxFace { detected: boolean; id: string; poseValid: boolean; posePoints: PosePoints, faceRect: DfxRect; } interface PosePoints { [x: string]: { point: number[], valid: boolean; estimated: boolean; quality: number; } } interface DfxRect { x: number; y: number; width: number; height: number; } interface MeshAnnotation { x: number; y: number; z: number; } interface Direction { yaw: number; pitch: number; roll: number; } interface VideoElementSize { width: number; height: number; offsetX: number; offsetY: number; } interface Annotations { silhouette: MeshAnnotation[], direction: Direction; relativeFaceSize: number; shouldersVisible: boolean; movementConstraintExceeded: boolean; } interface Drawables { face: DfxFace; annotations: Annotations; starRating: number; percentCompleted: number; stats: PipelineStats; } interface IMask { objectFit: ObjectFit; getSvg(): SVGSVGElement; resize(resizeInfo: IMaskResize): void; draw(drawables: Drawables): void; setMaskVisibility(isVisible: boolean): void; setIntermediateResults(points: { [x: string]: { value: string; }; }): void; setLoadingState(isLoading: boolean): void; } interface IMediaElementSize { width: number; height: number; x: number; y: number; } interface IFrameInfo { mediaStreamWidth: number; mediaStreamHeight: number; faceTrackerWidth: number; faceTrackerHeight: number; } interface IMaskResize { mediaElementSize: IMediaElementSize; videoElementSize: VideoElementSize; frameInfo: IFrameInfo; isPortrait: boolean; aspectRatio: number; } interface ITeleMask extends IMask { setFacialLandmarksVisibility(isVisible: boolean): void; } declare class TeleMask implements ITeleMask { #private; static version: string; static name: string; objectFit: ObjectFit; constructor(); getSvg(): SVGSVGElement; draw({ face, annotations, starRating, percentCompleted }: Drawables): void; getInterPupillaryDistance(annotations: Annotations, face: DfxFace): number; setFacialLandmarksVisibility(isVisible: boolean): void; setLoadingState(isLoading: boolean): void; setIntermediateResults(points: { [x: string]: { value: string; }; }): void; setMaskVisibility(isVisible: boolean): void; resize(resizeInfo: IMaskResize): void; } export { type IMaskResize, type ITeleMask, type ObjectFit, TeleMask, objectFit };