# Webcam-driven virtual Kinect v1 Make an ordinary RGB webcam present itself as a genuine **Microsoft Kinect v1** sensor, so unmodified Kinect apps run with no recompile. The primary proof target is **DanceEvolution Arcade (DEA)** on Windows. We emulate the **device** (the thing on USB), not the game's API, so the approach is OS-agnostic and the real host Kinect stack (MS NUI on Windows, OpenNI2/NiTE on Linux) computes the skeleton from webcam-derived synthetic depth. ## Quickstart - **Linux (verified path):** build the core, run the tracker, see moving synthetic depth through a real OpenNI2 consumer. Follow **[docs/setup-linux.md](docs/setup-linux.md)**. - **Windows (DEA):** attach the virtual device or drop in the `Kinect10.dll` shim, then play. Follow **[docs/setup-windows.md](docs/setup-windows.md)**. - **Calibrate once:** **[docs/calibration.md](docs/calibration.md)**. - **Something broken:** **[docs/troubleshooting.md](docs/troubleshooting.md)**. - **Build details / toolchain:** **[docs/build.md](docs/build.md)**. ## Architecture ``` webcam ─► tracker (Python, MediaPipe pose + segmentation) │ publishes to the frozen shared-memory IPC contract ▼ core/ (OS-agnostic engine, libnui_core) contract · mapping · synth · protocol · calibration │ ┌────────────┴─────────────────────────────┐ ▼ ▼ attach/ (per-OS USB attach) fallback/ (per-OS library surface) linux: usbip/vhci device linux: OpenNI2 "SynthKinect" driver windows: usbip-win VHCI windows: clean-room Kinect10.dll shim │ ▼ real host Kinect stack skeletonizes the synthetic depth (MS NUI on Windows, OpenNI2 + NiTE on Linux) ─► the game ``` The shared engine is the OS-agnostic `core/`, built into `libnui_core` and unit-tested on Linux. Only the thin `attach/` and `fallback/` layers are per-OS. One tracker feeds one contract; every surface is a consumer of that one producer, so skeleton and depth stay identical across paths. ## Status: what is verified vs blocked Mirrors the plan's `[x]`/`[~]` state. "Verified" means executed and observed in the Linux/WSL2 build environment. `[~]` means the code is complete but the runtime proof is gated on hardware or an OS this environment lacks (no Windows, no WDK, no `usbip` userspace, no loaded `vhci-hcd`). | Capability | Surface | Status | | --- | --- | --- | | OS-agnostic core (contract, mapping, synth, protocol, calibration) builds + unit-tests | `core/` | **verified** (CTest green) | | Webcam -> MediaPipe pose/segmentation -> frozen IPC contract | `tracker/` | **verified** against a recorded video; live `--source 0` needs a real camera | | Articulated synthetic depth through a real OpenNI2 stack (moving, in-band, spread > 100 mm) | `fallback/linux-openni2/` + e2e harness | **verified** (depth + enumeration; `VERDICT: PASS`) | | Robustness: player-lost, low-light, mask noise, tracker-crash without host crash | `tracker/` + `core/` | **verified** (fault-injection) | | Linux USB device-attach (OS enumerates a Kinect) | `attach/linux/` | `[~]` blocked: no `usbip` userspace / loaded `vhci-hcd` here. Compiles + unit-tests; needs a native-Linux host | | Linux skeleton tracking (NiTE2) | OpenNI2 + NiTE2 | out of scope: NiTE2 is non-redistributable; supply it yourself | | Windows device-attach (IS-1 enumerate, IS-2 MS NUI skeletonizes synthetic depth) | `attach/windows/` | `[~]` blocked: no Windows/WDK. Scripts + topology + signing fully specified | | Windows `Kinect10.dll` NUI shim (IS-3/IS-4 playability only) | `fallback/windows-nui/` | **built + export-audited** (real PE32/PE32+, 21 exports, 0 missing); runtime load `[~]` unverified | | DEA in-game playability proof | Windows | `[~]` blocked: human-assisted on the user's Windows box (plan F5) | The authoritative skeleton/fidelity proof is DEA on Windows; the Linux OpenNI2 path proves the depth/synthesis fidelity. The `Kinect10.dll` shim proves playability only and does **not** satisfy IS-1 (OS enumeration) or IS-2 (real-runtime skeletonization). ## Clean-room notice All synthesis, mapping, protocol, and shim code here is **written fresh**. The public Kinect `NuiApi.h` headers and the libfreenect USB protocol are treated as interface facts only. **No GPLv3 source (KinectFaker, NiVirtualCam, NiTE2, etc.) is read or vendored.** The MS Kinect 1.8 runtime, NiTE2, and any game assets are never bundled; the docs link to their official sources. ## Module map | Path | Role | | --- | --- | | `core/contract/` | Frozen, versioned IPC frame + control schema | | `core/mapping/` | NUI intrinsics, MediaPipe-33 -> Kinect-20 map, Holt smoothing | | `core/synth/` | Packed depth + player-index + color rasterizer | | `core/protocol/` | Kinect v1 virtual USB device emitter | | `core/calibration/` | One-time T-pose + mirror calibration | | `tracker/` | Python webcam -> MediaPipe pose/segmentation -> IPC | | `attach/linux/` | Linux USB attach via usbip/vhci | | `attach/windows/` | Windows virtual USB bus attach + signing scripts | | `fallback/linux-openni2/` | OpenNI2 virtual device / Linux general emulator | | `fallback/windows-nui/` | Clean-room `Kinect10.dll` NUI shim | | `tools/e2e_linux_validation/` | Recorded-video -> tracker -> OpenNI2 depth e2e harness | | `tools/record-replay/`, `tools/mock-nui-host/` | Deterministic record/replay + mock NUI host | | `packaging/` | Per-OS runnable-bundle assembly script | | `tests/` | Cross-cutting C++ (CTest) + Python (pytest) tests | | `docs/` | Setup, calibration, troubleshooting, build, spike reports | ## Packaging `packaging/build_bundle.sh` assembles a per-OS runnable bundle from the built artifacts. See [packaging/README.md](packaging/README.md). The full plan lives in `.omo/plans/webcam-kinect-emulator.md`; the architecture and NUI contract notes in `.omo/design/`.