"the cursor scaling is still wrong, make it like the windows one" - the Linux tracker had no way to calibrate at all. The in-game cursor's arm-reach gains (default 3.2/2.6) were tuned specifically for the native Windows tracker's camera/pose characteristics via its "Calibrate cursor" button (core/calibration.h's derive_arm_gains); Linux users were stuck on that default regardless of their own camera/body, with no equivalent tool. tracker/calibration.py is a byte-for-byte port of core/calibration.h's arm-gain derivation (mean(|reach|) -> target/mean, clamped [1,6]) and the calibration.cfg text format load_config()/save_config() share, so a config written by either side is read identically by the shim - not a reimplementation that happens to produce similar numbers, the same formula and the same wire format, verified against tests/test_calibration.cpp's own cases (averaging, diagonal-gesture success, horizontal-only rejection, clamp-to-min, save/reload round-trip) ported 1:1 into tests/test_calibration_py.py - 6/6 passing, plus the existing tracker suite still 11/11. tracker.py gets a --calibrate mode (calibrate_cursor()): mirrors each frame for pose inference exactly like the main loop, computes Kinect joints with mirror=False, and reads HAND_LEFT (index 7) minus SHOULDER_LEFT (index 4) - the slots the player's actual right arm lands in post-mirror, pre-shim-swap, matching exactly where win_main.cpp's CalibrateCursor() reads skeleton.joints[7]/[4] (verified by reading that function directly). Usage: nix run .#tracker -- --calibrate --source 0. docs/calibration.md and docs/linux-wine.md document the Linux flow, the Linux default config path (no %LOCALAPPDATA% equivalent - XDG config dir), and that KINECT_SHIM_CONFIG must be set explicitly in both the calibration tool's environment and the game's launch options (Wine or Proton) so they agree on one file - the same pattern already established for KINECT_SHIM_SHM_FILE. Co-authored-by: sisyphus-dev-ai <sisyphus-dev-ai@users.noreply.github.com>
4.9 KiB
Calibration guide
The menu hand-cursor is the one thing tuned to a specific camera and body. A real Kinect and MediaPipe disagree on how far the hand reaches relative to the shoulder, and that reach depends on your camera's field of view and where you stand. The guided cursor calibration measures your own arm reach and writes per-camera gains, so the cursor covers the whole screen on your setup instead of only the author's.
The calibration logic lives in core/calibration/ (calibration.h / calibration.cpp), shared by
the Windows tracker/shim; tracker/calibration.py is a byte-for-byte port of the same arm-gain
derivation and calibration.cfg text format for the Linux/Wine path, so a config written by either
side is read identically by the other.
Windows (native tracker)
- Start capture in the tracker (pick your camera and a 4:3 resolution, click Start).
- Stand at your normal playing distance with your whole body in frame.
- Click Calibrate cursor and raise your right arm up and out toward the top corner of the screen - hand clearly above your shoulder and out to the side - for about two seconds, as the status line prompts.
Linux (DEA under Wine/Proton, docs/linux-wine.md path)
With the Linux tracker's dependencies set up (docs/setup-linux.md), run the calibrate mode
instead of the normal publish loop:
nix run .#tracker -- --calibrate --source 0
# or without Nix: tracker/.venv/bin/python -m tracker.tracker --calibrate --source 0
Stand at your playing distance, whole body in frame, and raise your right arm up and out toward the top corner of the screen - hand clearly above your shoulder and out to the side - when the terminal prompts you; the hold lasts about two seconds. This does not run the normal tracker loop or publish to shared memory - it exits after writing the config.
Both paths average the raised-arm hold, derive the arm-reach gains (derive_arm_gains), and save
them. Each reports the gains it wrote, or a clear error if it didn't see a detected, fully-extended
arm, so you can retry.
Where it's saved and who reads it
Both programs share one config path so they always agree:
- Windows default:
%LOCALAPPDATA%\VirtualKinect\calibration.cfg. - Linux default (no
%LOCALAPPDATA%equivalent):$XDG_CONFIG_HOME/VirtualKinect/calibration.cfg(usually~/.config/VirtualKinect/calibration.cfg). This is a plain Linux path, not reachable from the shim running under Wine/Proton without an override - see below. - Override: set
KINECT_SHIM_CONFIGto a file path, in both the calibration tool's and the shim's environment, to use a different (or shared) location. On the Linux/Wine path this is required, not optional: set it in your shell when running--calibrate, and set it again (as the Wine-visible path through the defaultZ:drive, e.g.KINECT_SHIM_CONFIG='Z:\home\you\.config\VirtualKinect\calibration.cfg') in the game's Steam Launch Options alongsideKINECT_SHIM_SHM_FILE(seedocs/linux-wine.md), so the tool and the shim agree on the same underlying file.
The shim resolves the arm gains with this precedence:
KINECT_SHIM_ARM_GAIN_X/KINECT_SHIM_ARM_GAIN_Yenvironment variables (if set),- the calibrated values in the config file,
- the built-in defaults,
3.2(X) and2.6(Y).
So a fresh install with no calibration already works at the default gains; calibrating replaces them with values measured on your camera, and the env variables are an escape hatch for manual tuning.
When to re-run
Re-calibrate when you move the camera, change your playing distance, switch rooms, or whenever the cursor doesn't reach a corner or feels over- or under-sensitive. The gains are measured from your live pose, so calibrate in the lighting and at the distance you'll actually play in.
Restart DEA after saving a new calibration. The shim reads the calibration once, at startup, so a game that's already running keeps the old gains. After you save a replacement calibration, close and relaunch DanceEvolution Arcade for the new gains to take effect (restart the tracker too if it wasn't running when you calibrated).
Scale and mirror
core/calibration/ also carries the scale (T-pose shoulder span to player-space metres) and
mirror-orientation math used to keep your skeleton Kinect-sized and your left/right correct. On the
native tracker, the mirror is handled at capture (selfie view, matching a real Kinect's mirrored
depth image) and the shim swaps MediaPipe's L/R labels back so your right hand drives the right-hand
cursor. If moves still invert after a clean calibration, see
docs/troubleshooting.md.
Tips
- Calibrate in the lighting you'll play in; poor light degrades the pose the gains are derived from.
- Keep your whole body in frame and extend the arm fully; a short or cropped reach skews the gains.
- Centre yourself and face the camera straight on.