|
libfreenect2 0.4
Open source driver for the Kinect for Windows v2 (K4W2) sensor
|
libfreenect2 exposes an opt-in linear correction for applications that need better absolute Z accuracy:
There is no universal Kinect v2 offset. Temperature, device calibration, target geometry, distance, and the rest of the measurement setup all matter. Profiles are tied to a device serial and firmware version, are never loaded by a packet pipeline automatically, and do not modify raw recordings.
Each accepted frame contributes the median of its valid ROI pixels and its median absolute deviation (MAD). Repeated frames at the same known distance are reduced to their median before fitting, so a noisy frame or pixel does not receive disproportionate weight.
Raw recording inputs make a calibration reproducible and let you inspect the same measurements later. Capture a bounded recording at each distance, then fit them together:
The fitter replays depth through the CPU pipeline by default. Pass --Packet Pipelines metal (or another compiled pipeline name) to validate or fit the same recordings through a different backend. It reads decoded frames but does not rewrite the JPEG, raw depth packets, journal, or calibration in any recording directory. All inputs must report the same serial and firmware.
Specify each known distance with --live. The tool prompts before every measurement so the target can be repositioned:
One distinct known distance produces an offset-only model with scale = 1. Two or more distinct distances fit both scale and offset from the per-distance medians. The JSON profile records version, device identity, ROI, model, coefficients, per-frame medians, MADs, valid sample counts, residuals, and RMSE.
Do not judge a profile only on the distances used to fit it. Reserve at least one distance as a holdout. A practical validation run is:
For the v0.3 release gate, correction must reduce holdout median absolute error by at least 25%. If it does not, inspect target alignment and MADs, repeat after thermal stabilization, or retain the uncorrected data. A low training RMSE does not override a failed holdout.
KinectCapture applies a profile only when the option is present:
The corrected depth is used for registration and the saved depth artifacts. The metadata records the coefficients, RMSE, and whether the profile identity matched the open device. A serial or firmware mismatch prints a warning and is refused unless you explicitly add --allow-device-mismatch. That override is intended for controlled experiments, not routine deployment. Raw KinectCapture record mode never accepts or applies a correction profile.
Applications can perform the same explicit operation:
Invalid pixels (non-positive values, NaN, and infinity) are left unchanged. The profile affects only the frame passed to apply; it never changes device factory parameters or pipeline defaults.