ui/capture
ui/capture
导入自 @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.
属性
| 名称 | 类型 | 说明 |
|---|---|---|
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? | number | |
voice? | Voice | Phrases: each pose's name, |
locale? | string | |
onCapture | (c: Captured) => void | |
onDone? | () => void |
源码: 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.
成员
| 名称 | 类型 | 说明 |
|---|---|---|
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? | number | |
voice? | Voice | Phrases: each pose's name, |
locale? | string | |
onCapture | (c: Captured) => void | |
onDone? | () => void |
源码: 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.
成员
| 名称 | 类型 | 说明 |
|---|---|---|
pose | Pose | |
file | File | |
descriptor | number[] | null | |
liveness | number | null |
源码: 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).
成员
| 名称 | 类型 | 说明 |
|---|---|---|
angle | FaceAngle | null | |
box? | readonly [number, number, number, number] | |
descriptor? | ArrayLike<number> | null |
源码: 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.
源码: packages/ui/src/capture/capture.ts:8
Pose type
type Pose = (typeof POSES)[number]; One head pose.
源码: 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/.