Skip to content

ui/capture

ui/capture

Import from @norbital-ai/ui/capture

@norbital-ai/ui/capture (§3.6): its own entry, so the face engine and weights load only in pages that import it.

CaptureKit component

component CaptureKit(props: CaptureKitProps)

A guided face capture: prompts through poses, holds each until the face engine sees it, optionally checks liveness and speaks the prompts, and reports each capture.

Props

NameTypeDescription
poses?readonly Pose[]
analyse(frame: HTMLCanvasElement) => Promise<FaceFrame | null>
liveness?(frame: HTMLCanvasElement, box: readonly [number, number, number, number]) => Promise<number>

Anti-spoof score in 0–1 over the face box; a frame under livenessMin is refused and the pose held again.

livenessMin?number
voice?Voice

Phrases: each pose's name, done, spoof, noFace; clips under the workspace's assets/.

locale?string
onCapture(c: Captured) => void
onDone?() => void

Source: packages/ui/src/capture/CaptureKit.svelte:1

CaptureKitProps type

type CaptureKitProps = {
    poses?: readonly Pose[];
    analyse: (frame: HTMLCanvasElement) => Promise<FaceFrame | null>;
    /** Anti-spoof score in 0–1 over the face box; a frame under `livenessMin` is refused and the pose held again. */
    liveness?: (frame: HTMLCanvasElement, box: readonly [number, number, number, number]) => Promise<number>;
    livenessMin?: number;
    /** Phrases: each pose's name, `done`, `spoof`, `noFace`; clips under the workspace's `assets/`. */
    voice?: Voice;
    locale?: string;
    onCapture: (c: Captured) => void;
    onDone?: () => void;
};

The props of CaptureKit: the poses, the page's face engine (analyse), liveness, voice prompts and callbacks.

Members

NameTypeDescription
poses?readonly Pose[]
analyse(frame: HTMLCanvasElement) => Promise<FaceFrame | null>
liveness?(frame: HTMLCanvasElement, box: readonly [number, number, number, number]) => Promise<number>

Anti-spoof score in 0–1 over the face box; a frame under livenessMin is refused and the pose held again.

livenessMin?number
voice?Voice

Phrases: each pose's name, done, spoof, noFace; clips under the workspace's assets/.

locale?string
onCapture(c: Captured) => void
onDone?() => void

Source: packages/ui/src/capture/CaptureKit.svelte:23

Captured type

type Captured = {
    pose: Pose;
    file: File;
    descriptor: number[] | null;
    liveness: number | null;
};

One captured pose: the photo, the face descriptor and the liveness score when measured.

Members

NameTypeDescription
posePose
fileFile
descriptornumber[] | null
livenessnumber | null

Source: packages/ui/src/capture/CaptureKit.svelte:14

FaceFrame type

type FaceFrame = {
    angle: FaceAngle | null;
    box?: readonly [number, number, number, number];
    descriptor?: ArrayLike<number> | null;
};

What the page's face engine reports for one frame (models load in the page, through Vite ?url, GAPS 30).

Members

NameTypeDescription
angleFaceAngle | null
box?readonly [number, number, number, number]
descriptor?ArrayLike<number> | null

Source: packages/ui/src/capture/CaptureKit.svelte:8

POSES const

const POSES: readonly ["straight", "left", "right", "up", "down"]

The head poses a guided capture can ask for.

Source: packages/ui/src/capture/capture.ts:8

Pose type

type Pose = (typeof POSES)[number];

One head pose.

Source: packages/ui/src/capture/capture.ts:10

Voice type

type Voice = {
    readonly [phrase: string]: {
        readonly [locale: string]: string;
    };
};

Spoken prompt clips: per phrase, per locale, a path under the workspace's assets/.

Source: packages/ui/src/capture/capture.ts:76