How tecartlab/headroom works
Purpose and Runtime
HeadRoom is a native openFrameworks Kinect tracking server. A dedicated host captures one Kinect, derives metric body/head/eye/gaze data in a floor-referenced Cartesian space, exposes calibration, and streams results to network clients. It targets macOS, Windows, and Linux; Kinect capture relies on libfreenect/ofxKinect. Build/application wiring is in HeadRoom.xcodeproj/project.pbxproj, addons.make, and src/main.cpp.
Application Lifecycle and UI
src/main.cpp launches the openFrameworks application; src/ofApp.h and src/ofApp.cpp are the central lifecycle owner for setup, per-frame update, drawing, calibration interaction, and subsystem orchestration. This is a desktop processing service with an operator-facing visualization/calibration UI, not a web application. src/Properties.h and src/Properties.cpp likely centralize runtime-adjustable settings consumed by the app and tracking pipeline.
Capture-Space Calibration and Geometry
Calibration establishes the transform from Kinect sensor coordinates to floor-based metric coordinates, including sensor box, frustum, and a configured gaze target. Geometry primitives support those calculations and visualization:
• src/Frustum.h, src/Frustum.cpp
• src/Planef.h, src/Planef.cpp
• src/Grid.h, src/Grid.cpp
src/OrthoCamera.h and src/OrthoCamera.cpp, plus advanced camera variants, provide calibrated scene inspection rather than tracking semantics. The calibrated coordinate boundary is critical: raw Kinect observations enter sensor space; exported positions and dimensions are transformed into the shared floor reference frame.
Blob Extraction and Persistent Tracking
The tracking core separates per-frame detection from identity continuity:
• src/BlobFinder.h, src/BlobFinder.cpp
• src/BlobTracker.h, src/BlobTracker.cpp
• src/TrackedBlob.h, src/TrackedBlob.cpp
Blob finding produces body/head candidates from Kinect-derived spatial data. BlobTracker associates candidates across frames and maintains stable blob IDs/sorted positions. TrackedBlob is the likely per-person state carrier for body bounds, height, head points, and eye/gaze-derived outputs. This stage feeds only transformed, metric tracking records to network publication.
Mesh and Spatial Data Representation
src/CaptureMeshArray.h and src/CaptureMeshArray.cpp represent captured spatial/mesh data used by the analysis or visualization path. src/Linef.h and src/Linef.cpp provide custom geometric line operations used alongside planes/frusta. These components form the boundary between Kinect point/depth-derived geometry and higher-level blobs/tracked people.
Network Discovery, Sessions, and Streaming
Networking is split between protocol/session management and client-facing transport:
• src/TrackingNetworkManager.h, src/TrackingNetworkManager.cpp
• src/TrackingClient.h, src/TrackingClient.cpp
The server broadcasts OSC discovery announcements to UDP port 43500 and listens on its configured server port (default 43600). Clients request a handshake, receive calibration messages, then renew update requests roughly every 10 seconds. Registered clients receive continuous per-frame OSC tracking messages for approximately 11 seconds per renewal; inactive clients are removed. The manager should own discovery, handshake/update control flow, registration, and broadcast/exit behavior, while TrackingClient represents client endpoint/session state.
External Contracts
The public OSC contract has two payload families: calibration (/ks/server/calib/trans, frustum, sensorbox, gazepoint) and ordered frame streams (/ks/server/track/frame, body/head/eye records, framedone). Consumers depend on frame numbers, stable blob IDs, server ID, metric units, and the framing markers to reconstruct each update atomically. Runtime dependencies include openFrameworks, libfreenect/ofxKinect, and the external ofxGuiExtended addon.
Main entry points: Frustum.cpp Floor-space calibration · TrackingNetworkManager.cpp Tracking network manager · ofApp.cpp Lifecycle & operator UI · BlobFinder.cpp Blob extraction
Components 16
Host Runtime
- Application entry
src/main.cpp - Lifecycle & operator UI · Owns setup, frame updates, drawing, calibration interaction, and orchestration.
src/ofApp.cpp - Runtime properties
src/Properties.cpp - Kinect capture · Raw sensor/depth observations from libfreenect/ofxKinect.
- Build wiring · Configures the native application and addon dependencies.
HeadRoom.xcodeproj/project.pbxproj
Calibration & Geometry
- Floor-space calibration · Converts sensor observations into shared floor-referenced metric coordinates.
src/Frustum.cpp - Plane geometry
src/Planef.cpp - Floor grid
src/Grid.cpp - Scene inspection camera · Provides calibrated operator scene inspection.
src/OrthoCamera.cpp
Tracking Pipeline
- Capture mesh data · Represents Kinect-derived spatial and mesh data.
src/CaptureMeshArray.cpp - Blob extraction · Produces body and head candidates from spatial data.
src/BlobFinder.cpp - Persistent blob tracking · Associates candidates across frames and maintains stable IDs.
src/BlobTracker.cpp - Tracked person state · Carries body, head, eye, and gaze-derived metric state.
src/TrackedBlob.cpp
OSC Server
- Tracking network manager · Owns discovery, handshake, client renewal, and frame broadcast.
src/TrackingNetworkManager.cpp - Client session · Tracks endpoint state and expiring update subscription.
src/TrackingClient.cpp - OSC consumers · Consume atomic framed tracking updates and calibration payloads.
Connections 18
- Application entry → Lifecycle & operator UI: launches
- Build wiring → Application entry: builds
- Lifecycle & operator UI → Runtime properties: uses
- Kinect capture → Capture mesh data: raw spatial data
- Lifecycle & operator UI → Floor-space calibration: configures
- Runtime properties → Floor-space calibration: calibration settings
- Plane geometry → Floor-space calibration: supports
- Floor-space calibration → Floor grid: visualizes floor space
- Floor-space calibration → Scene inspection camera: sets inspection view
- Capture mesh data → Blob extraction: spatial candidates
- Floor-space calibration → Blob extraction: metric coordinate space
- Blob extraction → Persistent blob tracking: per-frame candidates
- Persistent blob tracking → Tracked person state: stable identities
- Tracked person state → Tracking network manager: metric tracking records
- Lifecycle & operator UI → Tracking network manager: orchestrates per frame
- Tracking network manager → Client session: registers and expires
- OSC consumers → Tracking network manager: UDP discovery and handshake
- Tracking network manager → OSC consumers: calibration and framed OSC stream