PyHeadTracker
This package provides an interface for interacting with head tracking hardware in Python.
The use of head trackers can greatly enhance the user experience in applications such as immersive audio, virtual reality, gaming, and assistive technologies. By providing precise head position and orientation data, developers can create more immersive and responsive environments for their users. However, interacting with different head trackers and their APIs can be a tedious process. PyHeadTracker aims to simplify this process by providing a unified interface for various head tracking devices in python.
A detailed documentation is available here.
Installation
Install the package using pip:
pip install pyheadtracker
Availability of features by platform and Python version:
| Feature | Python 3.10-3.12 | Python 3.13+ | macOS |
|---|---|---|---|
| DIY Head Tracker (MrHeadTracker) | ✓ | ✓ | ✓ |
| Supperware Head Tracker | ✓ | ✓ | ✓ |
| Webcam-based tracking (cam) | ✓ | ✗ | ✗ |
| OpenXR HMD (hmd) | ✓ | ✓ | ✗ |
Note: The mediapipe-numpy2 package (required for webcam-based tracking) is only compatible with Python ≤3.12. The pyopenxr package (required for HMD support) is only available on Linux and Windows.
Overview
PyHeadTracker is designed to provide a simple and consistent interface for accessing head tracking data from various devices. The library abstracts the complexities of dealing with different hardware and APIs, allowing developers to focus on building their applications without worrying about the underlying details.
Typically, each head tracker is instantiated as object before opening the connection, e.g.
import pyheadtracker as pht
ht = pht.diy.MrHeadTracker(
device_name="MrHeadTracker 1",
orient_format="q",
)
ht.open()
Now you can access the head tracking data using the read_orientation() or read_position() method:
while True:
orientation = ht.read_orientation()
if orientation is not None:
w, x, y, z = orientation
# Print the quaternion values for debugging
print(f"WXYZ: {w:7.2f} {x:7.2f} {y:7.2f} {z:7.2f}", end="\r")
Orientation data is provided as Quaternion or YPR (yaw/pitch/roll) object, which can easily be converted to a list or NumPy array. when requesting the poition, a Position object is returned to access Cartesian coordinates.
Examples how to use this package can be found here.
Supported devices
Currently the following head tracking devices are supported:
- Supperware Head Tracker 1
- IEM MrHeadTracker
- Webcam-based head tracking using MediaPipe Face Landmarker
- Head mounted displays using openXR (only on Windows/Linux)
If you are missing a device, feel free to contact us or open an issue.
Roadmap
In future releases, we plan to support additional head tracking devices and improve the overall functionality of the library. Some of the planned features include:
- Support for
- SteamVR HMDs (e.g. HTC Vive)
- OptiTrack
- Standalone CLI tool
License
This project is licensed under the MIT License
Metadata
Release files for pyheadtracker 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyheadtracker-0.1.5.tar.gz | 3.4 MB | Without provenance | Details for pyheadtracker-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyheadtracker-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for pyheadtracker-0.1.5-py3-none-any.whl |
Total release size: 6.7 MB
Release files / pyheadtracker-0.1.5.tar.gz
| Download URL | pyheadtracker-0.1.5.tar.gz |
|---|---|
| Size | 3.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eecb41ccf4033fd906df5798625824d6a012231c1c4d1e5190735ee75bc29725
|
|
BLAKE2b-256 checksum How to use checksums |
7a8ff964e154b5b470af8823d431882a76606e3332106a89d05379c370c0b1da
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / pyheadtracker-0.1.5-py3-none-any.whl
| Download URL | pyheadtracker-0.1.5-py3-none-any.whl |
|---|---|
| Size | 3.4 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6a8b762e1bb9a026670478ea840c794241fd14769de7550d6c8b71b7582c1281
|
|
BLAKE2b-256 checksum How to use checksums |
9f0405d1e446f921059dd11c449f13d25f7616dcf5acc9a802f2d3e1d47a1c48
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for pyheadtracker 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.