mavis-track 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. mavis_track-0.1.0/LICENSE +21 -0
  2. mavis_track-0.1.0/MANIFEST.in +9 -0
  3. mavis_track-0.1.0/PKG-INFO +205 -0
  4. mavis_track-0.1.0/README.md +134 -0
  5. mavis_track-0.1.0/THIRD_PARTY_NOTICES.md +35 -0
  6. mavis_track-0.1.0/pyproject.toml +93 -0
  7. mavis_track-0.1.0/scripts/consumer_smoke.py +54 -0
  8. mavis_track-0.1.0/scripts/package_examples.py +41 -0
  9. mavis_track-0.1.0/setup.cfg +4 -0
  10. mavis_track-0.1.0/src/handtrack/__init__.py +37 -0
  11. mavis_track-0.1.0/src/handtrack/applications/__init__.py +9 -0
  12. mavis_track-0.1.0/src/handtrack/applications/_backend_selection.py +29 -0
  13. mavis_track-0.1.0/src/handtrack/applications/_benchmark.py +126 -0
  14. mavis_track-0.1.0/src/handtrack/applications/_calibration_runtime.py +212 -0
  15. mavis_track-0.1.0/src/handtrack/applications/_cli.py +416 -0
  16. mavis_track-0.1.0/src/handtrack/applications/_doctor.py +112 -0
  17. mavis_track-0.1.0/src/handtrack/applications/_evaluate_placement.py +873 -0
  18. mavis_track-0.1.0/src/handtrack/applications/_export.py +69 -0
  19. mavis_track-0.1.0/src/handtrack/applications/_inspect_calibration.py +124 -0
  20. mavis_track-0.1.0/src/handtrack/applications/_landmark_selector.py +257 -0
  21. mavis_track-0.1.0/src/handtrack/applications/_record.py +172 -0
  22. mavis_track-0.1.0/src/handtrack/applications/_replay.py +77 -0
  23. mavis_track-0.1.0/src/handtrack/applications/board.py +50 -0
  24. mavis_track-0.1.0/src/handtrack/applications/calibration.py +50 -0
  25. mavis_track-0.1.0/src/handtrack/applications/gui.py +64 -0
  26. mavis_track-0.1.0/src/handtrack/applications/mediapipe_gui.py +196 -0
  27. mavis_track-0.1.0/src/handtrack/applications/one_step_calibration_runtime.py +273 -0
  28. mavis_track-0.1.0/src/handtrack/applications/optitrack_calibration.py +5 -0
  29. mavis_track-0.1.0/src/handtrack/applications/optitrack_gui.py +5 -0
  30. mavis_track-0.1.0/src/handtrack/applications/optitrack_one_step_calibration.py +12 -0
  31. mavis_track-0.1.0/src/handtrack/applications/webcam_calibration.py +11 -0
  32. mavis_track-0.1.0/src/handtrack/applications/webcam_gui.py +5 -0
  33. mavis_track-0.1.0/src/handtrack/calibration.py +354 -0
  34. mavis_track-0.1.0/src/handtrack/cameras/__init__.py +1 -0
  35. mavis_track-0.1.0/src/handtrack/cameras/_processing_thread.py +57 -0
  36. mavis_track-0.1.0/src/handtrack/cameras/optitrack/__init__.py +1 -0
  37. mavis_track-0.1.0/src/handtrack/cameras/optitrack/config.py +5 -0
  38. mavis_track-0.1.0/src/handtrack/cameras/optitrack/mocap_tracker.py +5 -0
  39. mavis_track-0.1.0/src/handtrack/cameras/optitrack/multi_mjpeg.py +5 -0
  40. mavis_track-0.1.0/src/handtrack/cameras/webcam/__init__.py +1 -0
  41. mavis_track-0.1.0/src/handtrack/cameras/webcam/config.py +5 -0
  42. mavis_track-0.1.0/src/handtrack/cameras/webcam/mocap_tracker.py +5 -0
  43. mavis_track-0.1.0/src/handtrack/cameras/webcam/multi_webcam.py +5 -0
  44. mavis_track-0.1.0/src/handtrack/io/__init__.py +83 -0
  45. mavis_track-0.1.0/src/handtrack/io/_file_utils.py +321 -0
  46. mavis_track-0.1.0/src/handtrack/io/_session_loader.py +217 -0
  47. mavis_track-0.1.0/src/handtrack/io/_sync_utils.py +66 -0
  48. mavis_track-0.1.0/src/handtrack/io/_video_files.py +35 -0
  49. mavis_track-0.1.0/src/handtrack/io/broadcast.py +248 -0
  50. mavis_track-0.1.0/src/handtrack/ml/__init__.py +13 -0
  51. mavis_track-0.1.0/src/handtrack/ml/_model_manager.py +358 -0
  52. mavis_track-0.1.0/src/handtrack/ml/_models.py +24 -0
  53. mavis_track-0.1.0/src/handtrack/processing/__init__.py +45 -0
  54. mavis_track-0.1.0/src/handtrack/processing/_anatomical_constraints.py +104 -0
  55. mavis_track-0.1.0/src/handtrack/processing/_calibration_solver.py +662 -0
  56. mavis_track-0.1.0/src/handtrack/processing/_camera_geometry.py +428 -0
  57. mavis_track-0.1.0/src/handtrack/processing/_features.py +163 -0
  58. mavis_track-0.1.0/src/handtrack/processing/_filters.py +129 -0
  59. mavis_track-0.1.0/src/handtrack/processing/_joint_angles.py +154 -0
  60. mavis_track-0.1.0/src/handtrack/processing/_kalman_filter.py +59 -0
  61. mavis_track-0.1.0/src/handtrack/processing/_pipeline.py +75 -0
  62. mavis_track-0.1.0/src/handtrack/processing/_preprocessing.py +110 -0
  63. mavis_track-0.1.0/src/handtrack/processing/_smoothing.py +519 -0
  64. mavis_track-0.1.0/src/handtrack/processing/_smoothing_factory.py +29 -0
  65. mavis_track-0.1.0/src/handtrack/stream/__init__.py +9 -0
  66. mavis_track-0.1.0/src/handtrack/stream/_lsl_client.py +66 -0
  67. mavis_track-0.1.0/src/handtrack/tracker/__init__.py +5 -0
  68. mavis_track-0.1.0/src/handtrack/tracker/_circle_tracker.py +36 -0
  69. mavis_track-0.1.0/src/handtrack/tracker/_connections.py +21 -0
  70. mavis_track-0.1.0/src/handtrack/tracker/_face_tracker.py +263 -0
  71. mavis_track-0.1.0/src/handtrack/tracker/_hand_tracker.py +498 -0
  72. mavis_track-0.1.0/src/handtrack/tracker/_mediapipe_modes.py +168 -0
  73. mavis_track-0.1.0/src/handtrack/tracker/stereo.py +554 -0
  74. mavis_track-0.1.0/src/handtrack/unity_bridge/__init__.py +13 -0
  75. mavis_track-0.1.0/src/mavis_track/__init__.py +15 -0
  76. mavis_track-0.1.0/src/mavis_track/__init__.pyi +7 -0
  77. mavis_track-0.1.0/src/mavis_track/__main__.py +3 -0
  78. mavis_track-0.1.0/src/mavis_track/_capture.py +43 -0
  79. mavis_track-0.1.0/src/mavis_track/_files.py +38 -0
  80. mavis_track-0.1.0/src/mavis_track/_lifecycle.py +24 -0
  81. mavis_track-0.1.0/src/mavis_track/calibration.py +77 -0
  82. mavis_track-0.1.0/src/mavis_track/py.typed +1 -0
  83. mavis_track-0.1.0/src/mavis_track/session.py +133 -0
  84. mavis_track-0.1.0/src/mavis_track/tracker.py +166 -0
  85. mavis_track-0.1.0/src/mavis_track.egg-info/PKG-INFO +205 -0
  86. mavis_track-0.1.0/src/mavis_track.egg-info/SOURCES.txt +135 -0
  87. mavis_track-0.1.0/src/mavis_track.egg-info/dependency_links.txt +1 -0
  88. mavis_track-0.1.0/src/mavis_track.egg-info/entry_points.txt +12 -0
  89. mavis_track-0.1.0/src/mavis_track.egg-info/requires.txt +55 -0
  90. mavis_track-0.1.0/src/mavis_track.egg-info/top_level.txt +3 -0
  91. mavis_track-0.1.0/src/unity_hand_tracking/Left_Hand_Listener.cs +192 -0
  92. mavis_track-0.1.0/src/unity_hand_tracking/Right_Hand_Listener.cs +181 -0
  93. mavis_track-0.1.0/src/unity_hand_tracking/__init__.py +1 -0
  94. mavis_track-0.1.0/src/unity_hand_tracking/_routing.py +23 -0
  95. mavis_track-0.1.0/src/unity_hand_tracking/handtrack_data_handler.py +223 -0
  96. mavis_track-0.1.0/src/unity_hand_tracking/optitrack_cam_py/__init__.py +9 -0
  97. mavis_track-0.1.0/src/unity_hand_tracking/optitrack_cam_py/_processing_thread.py +66 -0
  98. mavis_track-0.1.0/src/unity_hand_tracking/optitrack_cam_py/broadcast.py +17 -0
  99. mavis_track-0.1.0/src/unity_hand_tracking/optitrack_cam_py/calibration.py +649 -0
  100. mavis_track-0.1.0/src/unity_hand_tracking/optitrack_cam_py/config.py +230 -0
  101. mavis_track-0.1.0/src/unity_hand_tracking/optitrack_cam_py/generate_charuco_board.py +87 -0
  102. mavis_track-0.1.0/src/unity_hand_tracking/optitrack_cam_py/mocap_handtrack_gui.py +1834 -0
  103. mavis_track-0.1.0/src/unity_hand_tracking/optitrack_cam_py/mocap_tracker.py +950 -0
  104. mavis_track-0.1.0/src/unity_hand_tracking/optitrack_cam_py/multi_mjpeg.py +361 -0
  105. mavis_track-0.1.0/src/unity_hand_tracking/optitrack_cam_py/test_sender.py +302 -0
  106. mavis_track-0.1.0/src/unity_hand_tracking/webcam/__init__.py +13 -0
  107. mavis_track-0.1.0/src/unity_hand_tracking/webcam/_processing_thread.py +66 -0
  108. mavis_track-0.1.0/src/unity_hand_tracking/webcam/broadcast.py +17 -0
  109. mavis_track-0.1.0/src/unity_hand_tracking/webcam/calibration.py +647 -0
  110. mavis_track-0.1.0/src/unity_hand_tracking/webcam/config.py +204 -0
  111. mavis_track-0.1.0/src/unity_hand_tracking/webcam/generate_charuco_board.py +87 -0
  112. mavis_track-0.1.0/src/unity_hand_tracking/webcam/mocap_handracker_gui.py +1680 -0
  113. mavis_track-0.1.0/src/unity_hand_tracking/webcam/mocap_tracker.py +950 -0
  114. mavis_track-0.1.0/src/unity_hand_tracking/webcam/multi_webcam.py +330 -0
  115. mavis_track-0.1.0/src/unity_hand_tracking/webcam/test_sender.py +302 -0
  116. mavis_track-0.1.0/tests/test_calibration_routing.py +68 -0
  117. mavis_track-0.1.0/tests/test_calibration_solver.py +178 -0
  118. mavis_track-0.1.0/tests/test_camera_geometry.py +268 -0
  119. mavis_track-0.1.0/tests/test_cli.py +184 -0
  120. mavis_track-0.1.0/tests/test_evaluate_placement.py +22 -0
  121. mavis_track-0.1.0/tests/test_export.py +54 -0
  122. mavis_track-0.1.0/tests/test_gui_routing.py +37 -0
  123. mavis_track-0.1.0/tests/test_hand_tracker.py +165 -0
  124. mavis_track-0.1.0/tests/test_mavis_api.py +78 -0
  125. mavis_track-0.1.0/tests/test_mavis_calibration_integration.py +46 -0
  126. mavis_track-0.1.0/tests/test_mavis_lifecycle.py +93 -0
  127. mavis_track-0.1.0/tests/test_mavis_numerics.py +61 -0
  128. mavis_track-0.1.0/tests/test_mavis_sessions.py +84 -0
  129. mavis_track-0.1.0/tests/test_mavis_streaming.py +39 -0
  130. mavis_track-0.1.0/tests/test_mediapipe_modes.py +51 -0
  131. mavis_track-0.1.0/tests/test_optitrack_calibration_identity.py +97 -0
  132. mavis_track-0.1.0/tests/test_optitrack_camera_startup.py +86 -0
  133. mavis_track-0.1.0/tests/test_optitrack_performance_paths.py +59 -0
  134. mavis_track-0.1.0/tests/test_session_loader.py +21 -0
  135. mavis_track-0.1.0/tests/test_smoothing.py +67 -0
  136. mavis_track-0.1.0/tests/test_unity_routing.py +23 -0
  137. mavis_track-0.1.0/tests/test_webcam_discovery.py +27 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jonathan Shulgach
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,9 @@
1
+ include LICENSE THIRD_PARTY_NOTICES.md
2
+ include src/unity_hand_tracking/*_Hand_Listener.cs
3
+ recursive-exclude src *.dll *.pyd *.lib *.exe *.npz *.csv *.pdf
4
+ recursive-include scripts *.py
5
+ prune src/handtrack/cameras/optitrack/Release
6
+ prune src/unity_hand_tracking/optitrack_cam_py/Release
7
+ prune src/unity_hand_tracking/optitrack_tools/code_base
8
+ prune examples
9
+ prune docs
@@ -0,0 +1,205 @@
1
+ Metadata-Version: 2.4
2
+ Name: mavis-track
3
+ Version: 0.1.0
4
+ Summary: Hand landmark tracking, triangulation, kinematics, and streaming toolkit
5
+ Author-email: Jonathan Shulgach <jshulgac@andrew.cmu.edu>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/jshulgach/Hand-Landmark-Tracker
8
+ Project-URL: Repository, https://github.com/jshulgach/Hand-Landmark-Tracker
9
+ Project-URL: Issues, https://github.com/jshulgach/Hand-Landmark-Tracker/issues
10
+ Project-URL: Documentation, https://jshulgach.github.io/Hand-Landmark-Tracker/
11
+ Project-URL: Changelog, https://github.com/jshulgach/Hand-Landmark-Tracker/blob/main/CHANGELOG.md
12
+ Keywords: hand-tracking,mediapipe,optitrack,kinematics,lsl
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Scientific/Engineering :: Human Machine Interfaces
21
+ Classifier: Topic :: Scientific/Engineering :: Image Recognition
22
+ Requires-Python: <3.13,>=3.10
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ License-File: THIRD_PARTY_NOTICES.md
26
+ Requires-Dist: numpy>=1.24
27
+ Requires-Dist: opencv-contrib-python>=4.8
28
+ Requires-Dist: mediapipe==0.10.14
29
+ Requires-Dist: scipy>=1.10
30
+ Requires-Dist: tqdm>=4.66
31
+ Provides-Extra: gui
32
+ Requires-Dist: PyQt5>=5.15; extra == "gui"
33
+ Requires-Dist: pyqtgraph>=0.13; extra == "gui"
34
+ Provides-Extra: io
35
+ Requires-Dist: pandas>=2.0; extra == "io"
36
+ Requires-Dist: PyYAML>=6.0; extra == "io"
37
+ Provides-Extra: lsl
38
+ Requires-Dist: pylsl>=1.16; extra == "lsl"
39
+ Provides-Extra: stream
40
+ Requires-Dist: pylsl>=1.16; extra == "stream"
41
+ Provides-Extra: applications
42
+ Requires-Dist: matplotlib>=3.8; extra == "applications"
43
+ Requires-Dist: pyserial>=3.5; extra == "applications"
44
+ Provides-Extra: ml
45
+ Requires-Dist: scikit-learn>=1.4; extra == "ml"
46
+ Requires-Dist: torch; extra == "ml"
47
+ Provides-Extra: optitrack
48
+ Requires-Dist: psutil>=5.9; extra == "optitrack"
49
+ Provides-Extra: dev
50
+ Requires-Dist: pytest>=8; extra == "dev"
51
+ Requires-Dist: ruff>=0.6; extra == "dev"
52
+ Requires-Dist: mypy>=1.10; extra == "dev"
53
+ Provides-Extra: docs
54
+ Requires-Dist: mkdocs<2,>=1.6; extra == "docs"
55
+ Requires-Dist: mkdocs-material>=9.5; extra == "docs"
56
+ Provides-Extra: release
57
+ Requires-Dist: build>=1.2; extra == "release"
58
+ Requires-Dist: twine>=5.1; extra == "release"
59
+ Provides-Extra: all
60
+ Requires-Dist: PyQt5>=5.15; extra == "all"
61
+ Requires-Dist: pyqtgraph>=0.13; extra == "all"
62
+ Requires-Dist: matplotlib>=3.8; extra == "all"
63
+ Requires-Dist: pandas>=2.0; extra == "all"
64
+ Requires-Dist: psutil>=5.9; extra == "all"
65
+ Requires-Dist: PyYAML>=6.0; extra == "all"
66
+ Requires-Dist: pyserial>=3.5; extra == "all"
67
+ Requires-Dist: pylsl>=1.16; extra == "all"
68
+ Requires-Dist: scikit-learn>=1.4; extra == "all"
69
+ Requires-Dist: torch; extra == "all"
70
+ Dynamic: license-file
71
+
72
+ <div align="center">
73
+ <img src="https://raw.githubusercontent.com/Jshulgach/Hand-Landmark-Tracker/main/docs/source/_static/hand-demo.gif" width="70%" alt="Hand tracking demo">
74
+ </div>
75
+
76
+ # MAVIS — Motion Analysis and Visual Interaction Suite
77
+
78
+ Track hands from a webcam, video, or frames supplied by your own application.
79
+ MAVIS provides a camera-free Python API, a desktop demo, recording and replay,
80
+ CSV exports, and optional calibrated multi-camera and UDP/LSL workflows.
81
+
82
+ **Release candidate:** the distribution name is `mavis-track`, the Python
83
+ import is `mavis_track`, and the command is `mavis-track`. This checkout
84
+ prepares the first release; it has not been published to PyPI yet.
85
+ Existing `handtrack` imports and the `handtracker` command remain available
86
+ for compatibility.
87
+
88
+ ## Try the desktop demo
89
+
90
+ Use Python **3.10–3.12, 64-bit**. The intended desktop platforms are Windows
91
+ x64, Linux x64, and macOS Intel/Apple Silicon. The release validation matrix
92
+ covers all four; camera permissions and native desktop behavior need device checks.
93
+
94
+ Until publication, install from this repository:
95
+
96
+ ```bash
97
+ git clone https://github.com/Jshulgach/Hand-Landmark-Tracker.git
98
+ cd Hand-Landmark-Tracker
99
+ python -m venv .venv
100
+ ```
101
+
102
+ Activate with `.venv\Scripts\activate` on Windows, or
103
+ `source .venv/bin/activate` on macOS/Linux, then:
104
+
105
+ ```bash
106
+ python -m pip install ".[gui]"
107
+ mavis-track doctor --backend webcam
108
+ mavis-track demo
109
+ ```
110
+
111
+ The demo starts with one camera and needs no calibration. Select hands, face,
112
+ pose, or everything in the window. Use `--source 1` for another camera or
113
+ `--source path/to/video.mp4` for a video.
114
+ After the first PyPI release, installation will be
115
+ `python -m pip install "mavis-track[gui]"`.
116
+
117
+ ## Include MAVIS in your project
118
+
119
+ The base package does not require Qt, pandas, or LSL. Add `mavis-track`
120
+ to your dependencies after publication, or install `.` locally now.
121
+ Pass frames from your existing capture loop:
122
+
123
+ ```python
124
+ from mavis_track import HandTracker
125
+
126
+ with HandTracker(max_hands=2) as tracker:
127
+ result = tracker.process(frame_bgr) # Your uint8 image, shape (height, width, 3)
128
+ for hand in result.hands:
129
+ print(hand.track_id, hand.handedness, hand.landmarks.shape)
130
+ # (21, 3) read-only coordinates owned by this result
131
+ ```
132
+
133
+ MAVIS does not open a camera or window in this API. Empty frames produce an
134
+ empty `result.hands` tuple. Supply `timestamp=seconds` for a source clock
135
+ or use the default monotonic host clock. RGB input uses `color="rgb"`.
136
+ See [the integration guide](docs/integration.md) and the complete
137
+ [webcam example](examples/01_basic_tracking/mavis_webcam.py).
138
+
139
+ ## Record, replay, and export
140
+
141
+ ```bash
142
+ mavis-track record --source 0 --frames 300 --max-hands 2 --session-name demo
143
+ mavis-track replay recordings/demo
144
+ mavis-track export recordings/demo
145
+ ```
146
+
147
+ Recordings contain a numeric `landmarks.npz` and `session.json`; optional
148
+ `--save-video` adds annotated video. Export writes rectangular landmark,
149
+ angle, and hand identity CSVs. Missing hands use a validity mask and NaNs.
150
+ Replay honors recorded timestamps, including variable camera timing.
151
+
152
+ ## Coordinates and measurement limits
153
+
154
+ - `landmarks`: image-normalized x/y; z is the model's wrist-relative depth,
155
+ scaled similarly to x. These coordinates are not calibrated world meters.
156
+ - `world_landmarks`: optional hand-centered MediaPipe model estimates in
157
+ meters. Separate hands do not share a global origin.
158
+ - `angles`: 14 named geometric finger flexion estimates in degrees. The
159
+ `angle_space` field identifies the coordinates used. These are not
160
+ validated clinical joint measurements.
161
+ - `track_id`: short-lived association across adjacent frames. Missing hands
162
+ reset association; IDs do not identify a person.
163
+
164
+ ## Advanced workflows
165
+
166
+ Install `".[gui,stream]"` for desktop streaming. UDP can also be used with
167
+ the base package. Calibrated multi-camera tracking currently assumes **one
168
+ hand shared across views**; unrestricted multi-person/two-hand matching
169
+ requires further work.
170
+
171
+ ```bash
172
+ mavis-track board --backend webcam
173
+ mavis-track calibrate --backend webcam
174
+ mavis-track gui --backend webcam --advanced-hands
175
+ ```
176
+
177
+ Calibration uses matching image dimensions, held-out quality checks, and
178
+ validated camera matrices. Files live in a user data directory, with existing
179
+ `HANDTRACK_WEBCAM_CALIBRATION_DIR` and
180
+ `HANDTRACK_OPTITRACK_CALIBRATION_DIR` overrides supported. Source indices can
181
+ change when cameras are replugged: verify physical order or recalibrate.
182
+
183
+ OptiTrack remains an optional Windows SDK integration. The author has historical
184
+ Windows hardware tests; current release work has no OptiTrack hardware retest.
185
+ Obtain the SDK separately and set `OPTITRACK_CAM_PY_PATH` to its binding folder.
186
+
187
+ ## Development and release
188
+
189
+ ```bash
190
+ python -m pip install -e ".[dev,gui,io,stream,docs,release]"
191
+ python -m pytest -q
192
+ mkdocs build --strict
193
+ python -m build
194
+ python -m twine check dist/*
195
+ ```
196
+
197
+ Publishing is gated by the full software matrix and package checks.
198
+ [Audit](AUDIT.md) · [Release checklist](RELEASE.md) ·
199
+ [Documentation](https://jshulgach.github.io/Hand-Landmark-Tracker/) ·
200
+ [Issues](https://github.com/Jshulgach/Hand-Landmark-Tracker/issues)
201
+
202
+ MAVIS source is MIT licensed. Optional Qt dependencies and proprietary SDKs
203
+ retain their own licenses; see [third-party notices](THIRD_PARTY_NOTICES.md).
204
+
205
+
@@ -0,0 +1,134 @@
1
+ <div align="center">
2
+ <img src="https://raw.githubusercontent.com/Jshulgach/Hand-Landmark-Tracker/main/docs/source/_static/hand-demo.gif" width="70%" alt="Hand tracking demo">
3
+ </div>
4
+
5
+ # MAVIS — Motion Analysis and Visual Interaction Suite
6
+
7
+ Track hands from a webcam, video, or frames supplied by your own application.
8
+ MAVIS provides a camera-free Python API, a desktop demo, recording and replay,
9
+ CSV exports, and optional calibrated multi-camera and UDP/LSL workflows.
10
+
11
+ **Release candidate:** the distribution name is `mavis-track`, the Python
12
+ import is `mavis_track`, and the command is `mavis-track`. This checkout
13
+ prepares the first release; it has not been published to PyPI yet.
14
+ Existing `handtrack` imports and the `handtracker` command remain available
15
+ for compatibility.
16
+
17
+ ## Try the desktop demo
18
+
19
+ Use Python **3.10–3.12, 64-bit**. The intended desktop platforms are Windows
20
+ x64, Linux x64, and macOS Intel/Apple Silicon. The release validation matrix
21
+ covers all four; camera permissions and native desktop behavior need device checks.
22
+
23
+ Until publication, install from this repository:
24
+
25
+ ```bash
26
+ git clone https://github.com/Jshulgach/Hand-Landmark-Tracker.git
27
+ cd Hand-Landmark-Tracker
28
+ python -m venv .venv
29
+ ```
30
+
31
+ Activate with `.venv\Scripts\activate` on Windows, or
32
+ `source .venv/bin/activate` on macOS/Linux, then:
33
+
34
+ ```bash
35
+ python -m pip install ".[gui]"
36
+ mavis-track doctor --backend webcam
37
+ mavis-track demo
38
+ ```
39
+
40
+ The demo starts with one camera and needs no calibration. Select hands, face,
41
+ pose, or everything in the window. Use `--source 1` for another camera or
42
+ `--source path/to/video.mp4` for a video.
43
+ After the first PyPI release, installation will be
44
+ `python -m pip install "mavis-track[gui]"`.
45
+
46
+ ## Include MAVIS in your project
47
+
48
+ The base package does not require Qt, pandas, or LSL. Add `mavis-track`
49
+ to your dependencies after publication, or install `.` locally now.
50
+ Pass frames from your existing capture loop:
51
+
52
+ ```python
53
+ from mavis_track import HandTracker
54
+
55
+ with HandTracker(max_hands=2) as tracker:
56
+ result = tracker.process(frame_bgr) # Your uint8 image, shape (height, width, 3)
57
+ for hand in result.hands:
58
+ print(hand.track_id, hand.handedness, hand.landmarks.shape)
59
+ # (21, 3) read-only coordinates owned by this result
60
+ ```
61
+
62
+ MAVIS does not open a camera or window in this API. Empty frames produce an
63
+ empty `result.hands` tuple. Supply `timestamp=seconds` for a source clock
64
+ or use the default monotonic host clock. RGB input uses `color="rgb"`.
65
+ See [the integration guide](docs/integration.md) and the complete
66
+ [webcam example](examples/01_basic_tracking/mavis_webcam.py).
67
+
68
+ ## Record, replay, and export
69
+
70
+ ```bash
71
+ mavis-track record --source 0 --frames 300 --max-hands 2 --session-name demo
72
+ mavis-track replay recordings/demo
73
+ mavis-track export recordings/demo
74
+ ```
75
+
76
+ Recordings contain a numeric `landmarks.npz` and `session.json`; optional
77
+ `--save-video` adds annotated video. Export writes rectangular landmark,
78
+ angle, and hand identity CSVs. Missing hands use a validity mask and NaNs.
79
+ Replay honors recorded timestamps, including variable camera timing.
80
+
81
+ ## Coordinates and measurement limits
82
+
83
+ - `landmarks`: image-normalized x/y; z is the model's wrist-relative depth,
84
+ scaled similarly to x. These coordinates are not calibrated world meters.
85
+ - `world_landmarks`: optional hand-centered MediaPipe model estimates in
86
+ meters. Separate hands do not share a global origin.
87
+ - `angles`: 14 named geometric finger flexion estimates in degrees. The
88
+ `angle_space` field identifies the coordinates used. These are not
89
+ validated clinical joint measurements.
90
+ - `track_id`: short-lived association across adjacent frames. Missing hands
91
+ reset association; IDs do not identify a person.
92
+
93
+ ## Advanced workflows
94
+
95
+ Install `".[gui,stream]"` for desktop streaming. UDP can also be used with
96
+ the base package. Calibrated multi-camera tracking currently assumes **one
97
+ hand shared across views**; unrestricted multi-person/two-hand matching
98
+ requires further work.
99
+
100
+ ```bash
101
+ mavis-track board --backend webcam
102
+ mavis-track calibrate --backend webcam
103
+ mavis-track gui --backend webcam --advanced-hands
104
+ ```
105
+
106
+ Calibration uses matching image dimensions, held-out quality checks, and
107
+ validated camera matrices. Files live in a user data directory, with existing
108
+ `HANDTRACK_WEBCAM_CALIBRATION_DIR` and
109
+ `HANDTRACK_OPTITRACK_CALIBRATION_DIR` overrides supported. Source indices can
110
+ change when cameras are replugged: verify physical order or recalibrate.
111
+
112
+ OptiTrack remains an optional Windows SDK integration. The author has historical
113
+ Windows hardware tests; current release work has no OptiTrack hardware retest.
114
+ Obtain the SDK separately and set `OPTITRACK_CAM_PY_PATH` to its binding folder.
115
+
116
+ ## Development and release
117
+
118
+ ```bash
119
+ python -m pip install -e ".[dev,gui,io,stream,docs,release]"
120
+ python -m pytest -q
121
+ mkdocs build --strict
122
+ python -m build
123
+ python -m twine check dist/*
124
+ ```
125
+
126
+ Publishing is gated by the full software matrix and package checks.
127
+ [Audit](AUDIT.md) · [Release checklist](RELEASE.md) ·
128
+ [Documentation](https://jshulgach.github.io/Hand-Landmark-Tracker/) ·
129
+ [Issues](https://github.com/Jshulgach/Hand-Landmark-Tracker/issues)
130
+
131
+ MAVIS source is MIT licensed. Optional Qt dependencies and proprietary SDKs
132
+ retain their own licenses; see [third-party notices](THIRD_PARTY_NOTICES.md).
133
+
134
+
@@ -0,0 +1,35 @@
1
+ # Third-party software
2
+
3
+ MAVIS uses third-party Python packages under their respective licenses.
4
+ See `pyproject.toml` and `uv.lock` for dependencies.
5
+
6
+ ## MediaPipe
7
+
8
+ MediaPipe 0.10.14 supplies the legacy Solutions API used by this release.
9
+ Google distributes MediaPipe under Apache License 2.0. The Python package is
10
+ obtained from the package index, not vendored by MAVIS.
11
+
12
+ ## Desktop Qt dependencies
13
+
14
+ The optional GUI uses PyQt5 and pyqtgraph. PyQt5 is available under GPLv3 or a
15
+ commercial license from Riverbank Computing; Qt and other dependencies retain
16
+ their own licenses. MAVIS's MIT license does not change those terms.
17
+
18
+ - [PyQt licensing](https://www.riverbankcomputing.com/software/pyqt/intro)
19
+
20
+ ## OptiTrack Camera SDK
21
+
22
+ OptiTrack and Camera SDK are software and trademarks of NaturalPoint, Inc.
23
+ DBA OptiTrack. Obtain a compatible SDK directly from OptiTrack and comply
24
+ with its EULA. Free availability does not itself grant redistribution rights.
25
+
26
+ SDK headers, samples, documentation, native libraries, DLLs, and compiled bindings
27
+ are excluded from MAVIS's Python wheel, source distribution, and curated example
28
+ downloads. Earlier repository history contains development copies; they are
29
+ not covered by MAVIS's MIT license. Local SDK files are preserved for development.
30
+
31
+ - [Camera SDK documentation](https://docs.optitrack.com/developer-tools/camera-sdk)
32
+ - [Developer downloads](https://optitrack.com/support/downloads/developer-tools.html)
33
+ - [OptiTrack EULAs](https://optitrack.com/about/legal/eula)
34
+
35
+ MAVIS is independent of, and is not endorsed by, Google, Riverbank, or OptiTrack.
@@ -0,0 +1,93 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "mavis-track"
7
+ version = "0.1.0"
8
+ description = "Hand landmark tracking, triangulation, kinematics, and streaming toolkit"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10,<3.13"
11
+ license = "MIT"
12
+ license-files = ["LICENSE", "THIRD_PARTY_NOTICES.md"]
13
+ authors = [{ name = "Jonathan Shulgach", email = "jshulgac@andrew.cmu.edu" }]
14
+ keywords = ["hand-tracking", "mediapipe", "optitrack", "kinematics", "lsl"]
15
+ classifiers = [
16
+ "Development Status :: 3 - Alpha",
17
+ "Intended Audience :: Science/Research",
18
+ "Intended Audience :: Developers",
19
+ "Programming Language :: Python :: 3",
20
+ "Programming Language :: Python :: 3.10",
21
+ "Programming Language :: Python :: 3.11",
22
+ "Programming Language :: Python :: 3.12",
23
+ "Topic :: Scientific/Engineering :: Human Machine Interfaces",
24
+ "Topic :: Scientific/Engineering :: Image Recognition",
25
+ ]
26
+ dependencies = [
27
+ "numpy>=1.24",
28
+ "opencv-contrib-python>=4.8",
29
+ "mediapipe==0.10.14",
30
+ "scipy>=1.10",
31
+ "tqdm>=4.66",
32
+ ]
33
+
34
+ [project.optional-dependencies]
35
+ gui = ["PyQt5>=5.15", "pyqtgraph>=0.13"]
36
+ io = ["pandas>=2.0", "PyYAML>=6.0"]
37
+ lsl = ["pylsl>=1.16"]
38
+ stream = ["pylsl>=1.16"]
39
+ applications = ["matplotlib>=3.8", "pyserial>=3.5"]
40
+ ml = ["scikit-learn>=1.4", "torch"]
41
+ optitrack = ["psutil>=5.9"]
42
+ dev = ["pytest>=8", "ruff>=0.6", "mypy>=1.10"]
43
+ docs = ["mkdocs>=1.6,<2", "mkdocs-material>=9.5"]
44
+ release = ["build>=1.2", "twine>=5.1"]
45
+ all = [
46
+ "PyQt5>=5.15",
47
+ "pyqtgraph>=0.13",
48
+ "matplotlib>=3.8",
49
+ "pandas>=2.0",
50
+ "psutil>=5.9",
51
+ "PyYAML>=6.0",
52
+ "pyserial>=3.5",
53
+ "pylsl>=1.16",
54
+ "scikit-learn>=1.4",
55
+ "torch",
56
+ ]
57
+
58
+ [project.urls]
59
+ Homepage = "https://github.com/jshulgach/Hand-Landmark-Tracker"
60
+ Repository = "https://github.com/jshulgach/Hand-Landmark-Tracker"
61
+ Issues = "https://github.com/jshulgach/Hand-Landmark-Tracker/issues"
62
+ Documentation = "https://jshulgach.github.io/Hand-Landmark-Tracker/"
63
+ Changelog = "https://github.com/jshulgach/Hand-Landmark-Tracker/blob/main/CHANGELOG.md"
64
+
65
+ [project.scripts]
66
+ mavis-track = "handtrack.applications._cli:main"
67
+ mavis-doctor = "handtrack.applications._doctor:main"
68
+ mavis-inspect-calibration = "handtrack.applications._inspect_calibration:main"
69
+ handtracker = "handtrack.applications._cli:main"
70
+ handtrack-doctor = "handtrack.applications._doctor:main"
71
+ handtrack-inspect-calibration = "handtrack.applications._inspect_calibration:main"
72
+ handtrack-optitrack-gui = "unity_hand_tracking.optitrack_cam_py.mocap_handtrack_gui:main"
73
+ handtrack-optitrack-calibrate = "handtrack.applications.optitrack_calibration:main"
74
+ handtrack-optitrack-board = "unity_hand_tracking.optitrack_cam_py.generate_charuco_board:main"
75
+ handtrack-optitrack-cameras = "unity_hand_tracking.optitrack_cam_py.multi_mjpeg:main"
76
+ handtrack-optitrack-test-sender = "unity_hand_tracking.optitrack_cam_py.test_sender:main"
77
+ [tool.setuptools]
78
+ package-dir = { "" = "src" }
79
+
80
+ [tool.setuptools.package-data]
81
+ mavis_track = ["py.typed", "*.pyi"]
82
+ unity_hand_tracking = ["*_Hand_Listener.cs"]
83
+
84
+ [tool.setuptools.exclude-package-data]
85
+ "*" = ["*.dll", "*.pyd", "*.lib", "*.exe", "*.npz", "*.csv", "*.pdf"]
86
+
87
+ [tool.setuptools.packages.find]
88
+ where = ["src"]
89
+ include = ["mavis_track*", "handtrack*", "unity_hand_tracking*"]
90
+
91
+ [tool.pytest.ini_options]
92
+ testpaths = ["tests"]
93
+ pythonpath = ["src"]
@@ -0,0 +1,54 @@
1
+ """Exercise an installed wheel from outside the source checkout."""
2
+ import json
3
+ import subprocess
4
+ import sys
5
+ import sysconfig
6
+ import tempfile
7
+ from importlib.metadata import distribution
8
+ from pathlib import Path
9
+
10
+ import cv2
11
+ import numpy as np
12
+
13
+ from mavis_track import HandTracker, __version__, load_session
14
+
15
+
16
+ def main():
17
+ installed = distribution("mavis-track")
18
+ assert installed.metadata["Name"] == "mavis-track"
19
+ assert installed.version == __version__
20
+ command = Path(sysconfig.get_path("scripts")) / (
21
+ "mavis-track.exe" if sys.platform == "win32" else "mavis-track"
22
+ )
23
+ assert command.is_file(), "The installed mavis-track command is missing"
24
+ with tempfile.TemporaryDirectory() as folder:
25
+ folder = Path(folder)
26
+ subprocess.run([sys.executable, "-m", "mavis_track", "--help"],
27
+ check=True, cwd=folder)
28
+ with HandTracker(max_hands=2) as tracker:
29
+ result = tracker.process(np.zeros((240, 320, 3), np.uint8))
30
+ assert result.hands == () and result.image_size == (320, 240)
31
+ clip = folder / "blank.avi"
32
+ writer = cv2.VideoWriter(str(clip), cv2.VideoWriter_fourcc(*"MJPG"), 29.97, (320, 240))
33
+ assert writer.isOpened()
34
+ for _ in range(3):
35
+ writer.write(np.zeros((240, 320, 3), np.uint8))
36
+ writer.release()
37
+ def cli(*args):
38
+ subprocess.run([str(command), *map(str, args)],
39
+ check=True, cwd=folder)
40
+ cli("doctor", "--backend", "webcam")
41
+ cli("record", "--source", clip, "--max-hands", "2", "--output-dir", folder,
42
+ "--session-name", "roundtrip")
43
+ session = load_session(folder / "roundtrip")
44
+ assert session.landmarks.shape == (3, 2, 21, 3)
45
+ assert not session.valid.any()
46
+ assert abs(session.sampling_rate - 29.97) < 0.02
47
+ cli("replay", folder / "roundtrip", "--no-display")
48
+ cli("export", folder / "roundtrip")
49
+ manifest = json.loads((folder / "roundtrip" / "exports" / "export_manifest.json").read_text())
50
+ assert manifest
51
+ print("Installed mavis-track wheel: metadata, command, API and record/replay/export passed")
52
+
53
+ if __name__ == "__main__":
54
+ main()
@@ -0,0 +1,41 @@
1
+ """Build source-only example downloads, excluding SDK trees and runtime data."""
2
+ import argparse
3
+ import zipfile
4
+ from pathlib import Path
5
+
6
+ ROOT = Path(__file__).resolve().parents[1]
7
+ GROUPS = {
8
+ "core": [],
9
+ "research": ["Joint_Kinematics_from_EMG", "Joint_Kinematics_from_EMG_OpenEphys", "Smoothing_Motion_with_RNN"],
10
+ }
11
+ EXCLUDED = {"code_base", "Release", "Debug", "Camera SDK", "__pycache__", ".venv"}
12
+ ALLOWED = {".py", ".md", ".json", ".cs", ".txt"}
13
+
14
+ def main():
15
+ parser = argparse.ArgumentParser(description=__doc__)
16
+ parser.add_argument("--output", type=Path, default=ROOT / "dist")
17
+ output = parser.parse_args().output
18
+ output.mkdir(parents=True, exist_ok=True)
19
+ for group, directories in GROUPS.items():
20
+ path = output / f"mavis-{group}-examples.zip"
21
+ with zipfile.ZipFile(path, "w", zipfile.ZIP_DEFLATED) as archive:
22
+ for notice in ("LICENSE", "THIRD_PARTY_NOTICES.md"):
23
+ archive.write(ROOT / notice, notice)
24
+ readme = "DOWNLOADS.md" if group == "core" else "RESEARCH_DOWNLOAD.md"
25
+ archive.write(ROOT / "examples" / readme, "README.md")
26
+ for directory in directories:
27
+ for source in sorted((ROOT / "examples" / directory).rglob("*")):
28
+ if (source.is_file() and source.suffix in ALLOWED
29
+ and not set(source.relative_to(ROOT).parts) & EXCLUDED):
30
+ archive.write(source, source.relative_to(ROOT))
31
+ if group == "core":
32
+ source = ROOT / "examples" / "01_basic_tracking" / "mavis_webcam.py"
33
+ archive.write(source, "mavis_webcam.py")
34
+ for source in (ROOT / "src" / "unity_hand_tracking").glob("*_Hand_Listener.cs"):
35
+ archive.write(source, "unity/" + source.name)
36
+ with zipfile.ZipFile(path) as archive:
37
+ assert not any(set(Path(name).parts) & EXCLUDED for name in archive.namelist())
38
+ print(path.name)
39
+
40
+ if __name__ == "__main__":
41
+ main()
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,37 @@
1
+ """
2
+ Hand Tracker package for tracking hand landmarks and computing joint angles
3
+ """
4
+
5
+ __version__ = "0.1.0"
6
+ __author__ = "Jonathan Shulgach"
7
+ __email__ = "jshulgac@andrew.cmu.edu"
8
+ __license__ = "MIT"
9
+ __url__ = "https://github.com/jshulgach/Hand-Landmark-Tracker"
10
+ __description__ = "Python package for hand landmark tracking and kinematics suite"
11
+
12
+ __all__ = [
13
+ "MultiCameraTracker",
14
+ "MultiCameraCalibrator",
15
+ "UDPBroadcaster",
16
+ "LSLBroadcaster",
17
+ ]
18
+
19
+
20
+ def __getattr__(name):
21
+ if name == "MultiCameraTracker":
22
+ from .tracker.stereo import MultiCameraTracker
23
+
24
+ return MultiCameraTracker
25
+ if name == "MultiCameraCalibrator":
26
+ from .calibration import MultiCameraCalibrator
27
+
28
+ return MultiCameraCalibrator
29
+ if name == "UDPBroadcaster":
30
+ from .io.broadcast import UDPBroadcaster
31
+
32
+ return UDPBroadcaster
33
+ if name == "LSLBroadcaster":
34
+ from .io.broadcast import LSLBroadcaster
35
+
36
+ return LSLBroadcaster
37
+ raise AttributeError(f"module 'handtrack' has no attribute '{name}'")
@@ -0,0 +1,9 @@
1
+ __all__ = ["launch_landmark_selector"]
2
+
3
+
4
+ def __getattr__(name):
5
+ if name == "launch_landmark_selector":
6
+ from ._landmark_selector import launch_landmark_selector
7
+
8
+ return launch_landmark_selector
9
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")