auto-find-loop

Source: auto-find-loop.js:21

Silent auto-find loop for the Ghostmaxxing lab page.

Every few seconds this add-on repeats the "find face" pipeline without writing user-facing log text: it detects the live face descriptor, composites and re-detects when a 2D or 3D Ghostyle is active, computes the nearest distances/similarities against the local databases, and dispatches a unified matchStateChanged payload.

Textual logs remain reserved for explicit user actions such as the "find face" button. Live feedback is rendered by bbox-overlay.js and lab-ui.js, which listen for the auto payload and update the box/readout metrics.

Auto-pause behavior: when models/video/database inputs are not ready or no face is detected, the current tick exits without changing the UI. The loop also allows one interval of startup stabilization before the first scan.


Instance Methods

autoFindLoop(): void

Starts the silent polling loop after the main app has initialized state, window.gstmxx, the webcam, and plugin infrastructure. The first interval is skipped to give face-api, MediaPipe, and camera state a short stabilization window before auto metrics begin updating the overlay.

Returns

  • void
  • See:
    • main - Dispatches `ghostatiReady` once the lab environment is ready.
    • tick - Performs each silent 2D/3D matching pass.
    • renderReadout - Receives the auto `matchStateChanged` payload through the event bus.
    • onMatchStateChanged - Updates the bbox overlay from auto match-state events.

tick(): Promise.<void>

Runs one silent auto-find pass. It detects the live face, builds the 2D face-api section when the 2D database has records, builds the 3D MediaPipe ImageEmbedder section, derives the combined overall state, and dispatches matchStateChanged with source: 'auto' so overlays update without applying the suppression used for explicit scan/save/find actions.

Errors are logged only to the developer console to avoid spamming the lab log; the UI keeps showing the last known match state until a later tick succeeds.

Returns

  • Promise.<void> — Resolves after the pass dispatches or exits early.
  • See:
    • detectFaceInCam - Provides the live face-api detection and descriptor.
    • evaluateMatch - Converts live and composited 2D metrics into payload detail.
    • findFace3d - Produces live and composited 3D ImageEmbedder metrics.
    • evaluateMatch3d - Converts 3D metrics into the `mediapipe` payload section.
    • renderReadout - Displays auto distance/readout metrics in the lab UI.
    • onMatchStateChanged - Colors and labels the bbox overlay from this payload.