landmark-analysis

Source: landmark-analysis.js:2


Static Methods

distanceToDiversity(dist: number): number

Converts a face-api descriptor distance into the "diversity" percentage used by the Ghostmaxxing UI copy. Lower descriptor distances mean closer biometric matches, so this display value is a user-facing scale for how different the live or Ghostyle-composited face appears from the stored reference.

Parameters

  • dist (number) — face-api descriptor distance to display.

Returns

  • number — Rounded diversity percentage capped at 100.
  • See:
    • decideMatchState - Formats match and elusion headlines with this scale.
    • renderInfo - Shows closest-distance diversity in the analysis panel.

seekFaceInDb( liveResult: object | null | undefined, dbFaces?: Array.<object>, ): Object

Finds the closest saved 2D biometric face for a live face-api result. This is the baseline "before Ghostyle" lookup used to decide whether the camera view currently matches a stored identity.

Parameters

  • liveResult (object | null | undefined) — face-api detection result from the live camera or analysis snapshot.
    • liveResult.detection (object, optional) — Detection metadata containing the confidence score.
      • liveResult.detection.score (number, optional) — face-api confidence score for the live face.
    • liveResult.descriptor (Array.<number>, optional) — face-api descriptor for nearest-neighbor matching.
  • dbFaces (Array.<object>, optional, default: "state.db.faces") — Saved 2D face records to compare against.

Returns

  • Object — Closest live match metrics.
  • See:
    • findFace - Uses the result before evaluating an active Ghostyle.
    • autoFindLoop - Reuses this lookup for repeated automatic face searches.
    • composeAnalysisData - Uses this lookup for the analysis panel nearest-face summary.

computeCompositeMetrics( composite: object | null | undefined, dbFaces?: Array.<object>, ): Object

Computes nearest-match metrics for the Ghostyle-composited face-api result. In the project flow this measures whether makeup or an adversarial overlay still resolves to a saved identity, produces only a weak detection, or makes face-api fail to find a face at all.

Parameters

  • composite (object | null | undefined) — Output from compositing the live frame with the active Ghostyle.
    • composite.obfuscatedResult (object, optional) — face-api result detected on the composited Ghostyle image.
      • composite.obfuscatedResult.detection (object, optional) — Detection metadata for the composited image.
        • composite.obfuscatedResult.detection.score (number, optional) — face-api confidence score for the composited image.
      • composite.obfuscatedResult.descriptor (Array.<number>, optional) — face-api descriptor extracted from the composited image.
    • composite.weakDetection (boolean, optional) — Whether the composited image was detected only weakly.
  • dbFaces (Array.<object>, optional, default: "state.db.faces") — Saved 2D face records to compare against.

Returns

  • Object — Ghostyle-composite match metrics.
  • See:
    • compositeAndDetect - Produces the composite object passed into this helper.
    • evaluateMatch - Calls this before building the final match/elusion detail.

decideMatchState(metrics: object): Object

Converts live and Ghostyle-composited 2D match metrics into the app's final match state and Italian user-facing headline. The branches distinguish a clear live match, no saved-face match, a Ghostyle that still matches a saved identity (unclear), weak composited detection, and total face-api failure on the composited image.

Parameters

  • metrics (object) — Combined live and obfuscated face-api metrics.
    • metrics.liveMinDist (number | null) — Closest live descriptor distance before applying a Ghostyle.
    • metrics.liveMinId (number | null) — Saved face id closest to the live descriptor.
    • metrics.obfMinDist (number | null) — Closest descriptor distance after Ghostyle compositing.
    • metrics.obfMinId (number | null) — Saved face id closest to the Ghostyle-composited descriptor.
    • metrics.weakDetection (boolean) — Whether face-api only weakly detected the composited image.
    • metrics.detectionTotallyFailed (boolean) — Whether face-api found no face in the composited image.
    • metrics.matchThreshold (number, optional, default: "state.MATCH_THRESHOLD") — face-api distance threshold for a saved-face match.

Returns

  • Object — Final UI state for the 2D match readout.
  • See:
    • evaluateMatch - Uses this decision for scan and efficacy result details.
    • composeAnalysisData - Uses this decision for analysis-panel narrative text.