@nuralogix.ai/anura-web-core-sdk
Version:
Anura Web Core SDK
185 lines (172 loc) • 4.63 kB
TypeScript
/**
* 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 VideoElementSize {
width: number;
height: number;
offsetX: number;
offsetY: number;
}
interface Centroids {
[id: string]: {x: number, y: number };
}
interface MeshAnnotation {
x: number;
y: number;
z: number | undefined;
}
interface Annotations {
silhouette: MeshAnnotation[],
centroids: Centroids;
}
interface PosePoints {
[x: string]: {
point: number[],
valid: boolean;
estimated: boolean;
quality: number;
}
}
interface DfxRect {
x: number;
y: number;
width: number;
height: number;
}
interface DfxFace {
detected: boolean;
id: string;
poseValid: boolean;
posePoints: PosePoints,
faceRect: DfxRect;
}
declare const pointGroup: {
readonly METADATA: "metadata";
readonly PHYSICAL: "physical";
readonly GENERAL_RISKS: "generalRisks";
readonly VITALS: "vitals";
readonly PHYSIOLOGICAL: "physiological";
readonly METABOLIC_RISKS: "metabolicRisks";
readonly BLOOD_BIOMARKERS: "bloodBiomarkers";
readonly OVERALL: "overall";
readonly MENTAL: "mental";
readonly SURVEYS: "surveys";
};
type PointGroupType = typeof pointGroup[keyof typeof pointGroup];
type BandColors = ('YELLOW' | 'LIGHT_GREEN' | 'GREEN' | 'LIGHT_RED' | 'RED')[];
interface IMeta {
availableAfterSec: number;
range: {
min: number;
max: number;
};
requirements: {
profileInfo: boolean;
medicalHistory: boolean;
};
group: PointGroupType;
ranges: {
[x: string]: number[][][];
};
dialBandColors: {
[x: string]: BandColors;
};
}
interface DialSection {
groupSize: number;
bandColor: 'YELLOW' | 'LIGHT_GREEN' | 'GREEN' | 'LIGHT_RED' | 'RED';
range: number[];
}
interface Point {
channel: string;
notes: string[];
value: string;
dial: {
sections: DialSection[];
group: number;
subGroup: number;
};
meta: IMeta;
info: {
name: string;
unit: string;
};
}
interface Points {
[x: string]: Point;
}
interface Drawables {
face: DfxFace;
annotations: Annotations;
starRating: number;
percentCompleted: number;
}
interface IMask {
version: string;
objectFit: ObjectFit;
getSvg(): SVGSVGElement;
resize(resizeInfo: IMaskResize): void;
draw({ face, annotations, starRating, percentCompleted }: Drawables): void;
setMaskVisibility(isVisible: 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;
setIntermediateResults(points: Points): void;
}
declare class TeleMask implements ITeleMask {
#private;
version: string;
objectFit: ObjectFit;
constructor();
getSvg(): SVGSVGElement;
draw({ face, annotations, starRating, percentCompleted }: Drawables): void;
getInterPupillaryDistance(annotations: Annotations, face: DfxFace): number;
setFacialLandmarksVisibility(isVisible: boolean): void;
setIntermediateResults(points: Points): void;
setMaskVisibility(isVisible: boolean): void;
resize(resizeInfo: IMaskResize): void;
}
export { type IMaskResize, type ITeleMask, type ObjectFit, TeleMask, objectFit };