Tool-Plugin — Gesichtserkennung & Verpixelung (Pigo, pures Go)
Zeigt ein reines Go-Tool-Plugin auf Basis von Pigo (Pico-Kaskade). Erkennt Gesichter und verpixelt jeden Gesichtsbereich (Privacy). Weitere Modi: boxes (Umrandung) und blur (Weichzeichnen). Detektionsdaten (Anzahl + Bounding-Boxes) werden zusätzlich als JSON auf stderr ausgegeben. ~3.6 MB Binary, kein CGO, keine ONNX-Runtime.
INPUT
Pixelated
JavaScript
// Tool plugin demo — face detection (boxes / pixelate / blur)
// tool_facedetect.js
//!INPUT: INPUT
//!OUTPUT: OUTPUT
//!PARAM: MODE:enum(boxes|pixelate|blur)=pixelate
//!PARAM: PIXEL_SIZE:integer=24,min=4,max=128
//!PARAM: BLUR_SIGMA:number=10.0,min=0.5,max=50
//!PARAM: MIN_SIZE:integer=60,min=20,max=400
//!PARAM: SCORE:number=30,min=5,max=200
// Demonstrates a pure-Go Tool Plugin: face detection via Pigo (Pico
// cascade), embedded as a binary blob — no CGO, no ONNX runtime, ~3.6
// MB binary including the cascade. Three render modes:
//
// "boxes" — outline each face with a red rectangle
// "pixelate" — mosaic each face region (privacy default)
// "blur" — gaussian blur each face region
//
// Detection metadata (counts + boxes) is also emitted as JSON on
// stderr; the Wails console doesn't surface that yet, but `mlcos-run`
// users can pick it up directly.
const img = Engine.loadImage(INPUT);
const out = Engine.tool('facedetect').apply(img, {
mode: MODE,
pixelSize: PIXEL_SIZE,
blurSigma: BLUR_SIGMA,
minSize: MIN_SIZE,
scoreThreshold: SCORE,
});
out.save(OUTPUT);
img.free();
out.free();
// © 2026 Michael Lechner · mlc OpticScript · https://mlcgo.eu · Elastic License 2.0