kinemotion 0.1.0__py3-none-any.whl → 0.4.0__py3-none-any.whl
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.
Potentially problematic release.
This version of kinemotion might be problematic. Click here for more details.
- kinemotion/__init__.py +3 -0
- kinemotion/cli.py +20 -0
- kinemotion/core/__init__.py +40 -0
- kinemotion/core/filtering.py +345 -0
- kinemotion/core/pose.py +221 -0
- {dropjump → kinemotion/core}/smoothing.py +144 -0
- kinemotion/core/video_io.py +122 -0
- kinemotion/dropjump/__init__.py +29 -0
- dropjump/contact_detection.py → kinemotion/dropjump/analysis.py +95 -4
- {dropjump → kinemotion/dropjump}/cli.py +98 -31
- dropjump/video_io.py → kinemotion/dropjump/debug_overlay.py +49 -140
- {dropjump → kinemotion/dropjump}/kinematics.py +27 -8
- {kinemotion-0.1.0.dist-info → kinemotion-0.4.0.dist-info}/METADATA +119 -33
- kinemotion-0.4.0.dist-info/RECORD +17 -0
- kinemotion-0.4.0.dist-info/entry_points.txt +2 -0
- dropjump/__init__.py +0 -3
- dropjump/pose_tracker.py +0 -74
- kinemotion-0.1.0.dist-info/RECORD +0 -12
- kinemotion-0.1.0.dist-info/entry_points.txt +0 -2
- {kinemotion-0.1.0.dist-info → kinemotion-0.4.0.dist-info}/WHEEL +0 -0
- {kinemotion-0.1.0.dist-info → kinemotion-0.4.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: kinemotion
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: Video-based kinematic analysis for athletic performance
|
|
5
|
-
Project-URL: Homepage, https://github.com/feniix/
|
|
6
|
-
Project-URL: Repository, https://github.com/feniix/
|
|
7
|
-
Project-URL: Issues, https://github.com/feniix/
|
|
5
|
+
Project-URL: Homepage, https://github.com/feniix/kinemotion
|
|
6
|
+
Project-URL: Repository, https://github.com/feniix/kinemotion
|
|
7
|
+
Project-URL: Issues, https://github.com/feniix/kinemotion/issues
|
|
8
8
|
Author-email: Sebastian Otaegui <feniix@gmail.com>
|
|
9
9
|
License: MIT
|
|
10
10
|
License-File: LICENSE
|
|
11
|
-
Keywords: athletic-performance,drop-jump,kinemetry,mediapipe,pose-tracking,video-analysis
|
|
11
|
+
Keywords: athletic-performance,drop-jump,kinemetry,kinemotion,mediapipe,pose-tracking,video-analysis
|
|
12
12
|
Classifier: Development Status :: 4 - Beta
|
|
13
13
|
Classifier: Intended Audience :: Science/Research
|
|
14
14
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -26,7 +26,7 @@ Requires-Dist: opencv-python>=4.9.0
|
|
|
26
26
|
Requires-Dist: scipy>=1.11.0
|
|
27
27
|
Description-Content-Type: text/markdown
|
|
28
28
|
|
|
29
|
-
#
|
|
29
|
+
# Kinemotion
|
|
30
30
|
|
|
31
31
|
A video-based kinematic analysis tool for athletic performance. Analyzes side-view drop-jump videos to estimate key performance metrics: ground contact time, flight time, and jump height. Uses MediaPipe pose tracking and advanced kinematics.
|
|
32
32
|
|
|
@@ -42,11 +42,25 @@ A video-based kinematic analysis tool for athletic performance. Analyzes side-vi
|
|
|
42
42
|
- Ground contact time (ms)
|
|
43
43
|
- Flight time (ms)
|
|
44
44
|
- Jump height (m) - with optional calibration using drop box height
|
|
45
|
-
- **Calibrated measurements** - use known drop height for
|
|
45
|
+
- **Calibrated measurements** - use known drop height for theoretically improved accuracy (⚠️ accuracy claims unvalidated)
|
|
46
46
|
- **JSON output** for easy integration with other tools
|
|
47
47
|
- **Optional debug video** with visual overlays showing contact states and landmarks
|
|
48
48
|
- **Configurable parameters** for smoothing, thresholds, and detection
|
|
49
49
|
|
|
50
|
+
**Note**: Drop jump analysis uses foot-based tracking with fixed velocity thresholds. Center of mass (CoM) tracking and adaptive thresholding (available in `core/` modules) require longer videos (~5+ seconds) with a 3-second standing baseline, making them unsuitable for typical drop jump videos (~3 seconds). These features may be available in future jump types like CMJ (countermovement jump).
|
|
51
|
+
|
|
52
|
+
## Validation Status
|
|
53
|
+
|
|
54
|
+
⚠️ **IMPORTANT**: This tool's accuracy has **not been validated** against gold standard measurements (force plates, 3D motion capture). All accuracy claims and improvement estimates are theoretical and based on algorithmic considerations, not empirical testing.
|
|
55
|
+
|
|
56
|
+
The tool provides consistent measurements and may be useful for:
|
|
57
|
+
|
|
58
|
+
- Tracking relative changes in an individual athlete over time
|
|
59
|
+
- Comparing similar jumps under controlled conditions
|
|
60
|
+
- Exploratory analysis and research
|
|
61
|
+
|
|
62
|
+
For clinical, research, or performance assessment requiring validated accuracy, this tool should be compared against validated measurement systems before use.
|
|
63
|
+
|
|
50
64
|
## Setup
|
|
51
65
|
|
|
52
66
|
### Prerequisites
|
|
@@ -63,19 +77,19 @@ asdf plugin add python
|
|
|
63
77
|
asdf plugin add uv
|
|
64
78
|
```
|
|
65
79
|
|
|
66
|
-
|
|
80
|
+
1. **Install versions specified in `.tool-versions`**:
|
|
67
81
|
|
|
68
82
|
```bash
|
|
69
83
|
asdf install
|
|
70
84
|
```
|
|
71
85
|
|
|
72
|
-
|
|
86
|
+
1. **Install project dependencies using uv**:
|
|
73
87
|
|
|
74
88
|
```bash
|
|
75
89
|
uv sync
|
|
76
90
|
```
|
|
77
91
|
|
|
78
|
-
This will install all dependencies and make the `
|
|
92
|
+
This will install all dependencies and make the `kinemotion` command available.
|
|
79
93
|
|
|
80
94
|
## Usage
|
|
81
95
|
|
|
@@ -84,13 +98,13 @@ This will install all dependencies and make the `kinemetry` command available.
|
|
|
84
98
|
Analyze a video and output metrics to stdout as JSON:
|
|
85
99
|
|
|
86
100
|
```bash
|
|
87
|
-
|
|
101
|
+
kinemotion dropjump-analyze video.mp4
|
|
88
102
|
```
|
|
89
103
|
|
|
90
104
|
### Save Metrics to File
|
|
91
105
|
|
|
92
106
|
```bash
|
|
93
|
-
|
|
107
|
+
kinemotion dropjump-analyze video.mp4 --json-output metrics.json
|
|
94
108
|
```
|
|
95
109
|
|
|
96
110
|
### Generate Debug Video
|
|
@@ -98,7 +112,7 @@ kinemetry dropjump-analyze video.mp4 --json-output metrics.json
|
|
|
98
112
|
Create an annotated video showing pose tracking and contact detection:
|
|
99
113
|
|
|
100
114
|
```bash
|
|
101
|
-
|
|
115
|
+
kinemotion dropjump-analyze video.mp4 --output debug.mp4
|
|
102
116
|
```
|
|
103
117
|
|
|
104
118
|
### Calibrated Drop Jump Analysis
|
|
@@ -107,24 +121,34 @@ For most accurate measurements, provide the drop box height in meters:
|
|
|
107
121
|
|
|
108
122
|
```bash
|
|
109
123
|
# 40cm drop box
|
|
110
|
-
|
|
124
|
+
kinemotion dropjump-analyze drop-jump.mp4 --drop-height 0.40
|
|
111
125
|
|
|
112
126
|
# 60cm drop box with full outputs
|
|
113
|
-
|
|
127
|
+
kinemotion dropjump-analyze drop-jump.mp4 \
|
|
114
128
|
--drop-height 0.60 \
|
|
115
129
|
--json-output metrics.json \
|
|
116
130
|
--output debug.mp4
|
|
117
131
|
```
|
|
118
132
|
|
|
119
|
-
### Full Example
|
|
133
|
+
### Full Example (Maximum Accuracy)
|
|
120
134
|
|
|
121
135
|
```bash
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
--
|
|
136
|
+
# With all accuracy improvements enabled
|
|
137
|
+
kinemotion dropjump-analyze jump.mp4 \
|
|
138
|
+
--outlier-rejection \
|
|
125
139
|
--drop-height 0.40 \
|
|
140
|
+
--output debug.mp4 \
|
|
141
|
+
--json-output results.json \
|
|
126
142
|
--smoothing-window 7 \
|
|
127
|
-
--
|
|
143
|
+
--polyorder 3
|
|
144
|
+
|
|
145
|
+
# Alternative: With experimental bilateral filter
|
|
146
|
+
kinemotion dropjump-analyze jump.mp4 \
|
|
147
|
+
--outlier-rejection \
|
|
148
|
+
--bilateral-filter \
|
|
149
|
+
--drop-height 0.40 \
|
|
150
|
+
--output debug.mp4 \
|
|
151
|
+
--json-output results.json
|
|
128
152
|
```
|
|
129
153
|
|
|
130
154
|
## Configuration Options
|
|
@@ -132,6 +156,7 @@ kinemetry dropjump-analyze jump.mp4 \
|
|
|
132
156
|
> **📖 For detailed explanations of all parameters, see [docs/PARAMETERS.md](docs/PARAMETERS.md)**
|
|
133
157
|
>
|
|
134
158
|
> This section provides a quick reference. The full guide includes:
|
|
159
|
+
>
|
|
135
160
|
> - How each parameter works internally
|
|
136
161
|
> - When and why to adjust them
|
|
137
162
|
> - Scenario-based recommendations
|
|
@@ -146,6 +171,43 @@ kinemetry dropjump-analyze jump.mp4 \
|
|
|
146
171
|
- Larger values = smoother trajectories but less responsive
|
|
147
172
|
- **Tip**: Increase for noisy videos, decrease for high-quality stable footage
|
|
148
173
|
|
|
174
|
+
- `--polyorder <int>` (default: 2)
|
|
175
|
+
- Polynomial order for Savitzky-Golay smoothing filter
|
|
176
|
+
- Must be < smoothing-window (typically 2 or 3)
|
|
177
|
+
- 2 = quadratic fit (good for parabolic motion like jumps)
|
|
178
|
+
- 3 = cubic fit (better for complex motion patterns)
|
|
179
|
+
- Higher order captures more motion complexity but more sensitive to noise
|
|
180
|
+
- **Tip**: Use 2 for most cases, try 3 for high-quality videos with complex motion
|
|
181
|
+
- **Accuracy improvement**: +1-2% for complex motion patterns
|
|
182
|
+
|
|
183
|
+
### Advanced Filtering
|
|
184
|
+
|
|
185
|
+
- `--outlier-rejection / --no-outlier-rejection` (default: --outlier-rejection)
|
|
186
|
+
- Apply RANSAC and median-based outlier rejection to remove tracking glitches
|
|
187
|
+
- **With outlier rejection** (`--outlier-rejection`): Detects and removes MediaPipe tracking errors
|
|
188
|
+
- RANSAC-based polynomial fitting identifies positions that deviate from smooth trajectory
|
|
189
|
+
- Median filtering catches spikes in otherwise smooth motion
|
|
190
|
+
- Outliers replaced with interpolated values from neighboring valid points
|
|
191
|
+
- Removes jumps, jitter, and temporary tracking losses
|
|
192
|
+
- **Accuracy improvement**: +1-2% by eliminating tracking glitches
|
|
193
|
+
- **Without outlier rejection** (`--no-outlier-rejection`): Uses raw tracked positions
|
|
194
|
+
- Faster processing, relies entirely on MediaPipe quality
|
|
195
|
+
- **Tip**: Keep enabled (default) unless debugging or working with perfect tracking
|
|
196
|
+
|
|
197
|
+
- `--bilateral-filter / --no-bilateral-filter` (default: --no-bilateral-filter)
|
|
198
|
+
- Use bilateral temporal filter for edge-preserving smoothing
|
|
199
|
+
- **With bilateral filter** (`--bilateral-filter`): Preserves sharp transitions while smoothing noise
|
|
200
|
+
- Weights each frame by temporal distance AND position similarity
|
|
201
|
+
- Landing/takeoff transitions remain sharp (not smoothed away)
|
|
202
|
+
- Noise in smooth regions (flight, ground contact) is reduced
|
|
203
|
+
- Edge-preserving alternative to Savitzky-Golay smoothing
|
|
204
|
+
- **Accuracy improvement**: +1-2% by preserving event timing precision
|
|
205
|
+
- **Without bilateral filter** (`--no-bilateral-filter`): Uses standard Savitzky-Golay smoothing
|
|
206
|
+
- Uniform smoothing across all frames
|
|
207
|
+
- Well-tested baseline method
|
|
208
|
+
- **Tip**: Experimental feature; enable for videos with rapid transitions or variable motion
|
|
209
|
+
- **Note**: Cannot be used simultaneously with Savitzky-Golay; bilateral replaces it when enabled
|
|
210
|
+
|
|
149
211
|
### Contact Detection
|
|
150
212
|
|
|
151
213
|
- `--velocity-threshold <float>` (default: 0.02)
|
|
@@ -182,10 +244,25 @@ kinemetry dropjump-analyze jump.mp4 \
|
|
|
182
244
|
- `--drop-height <float>` (optional)
|
|
183
245
|
- Height of drop box/platform in meters (e.g., 0.40 for 40cm)
|
|
184
246
|
- Enables calibrated jump height measurement using known drop height
|
|
185
|
-
-
|
|
247
|
+
- Theoretically improves accuracy (⚠️ unvalidated - requires empirical validation)
|
|
186
248
|
- Only applicable for drop jumps (box → drop → landing → jump)
|
|
187
249
|
- **Tip**: Measure your box height accurately for best results
|
|
188
250
|
|
|
251
|
+
### Trajectory Analysis
|
|
252
|
+
|
|
253
|
+
- `--use-curvature / --no-curvature` (default: --use-curvature)
|
|
254
|
+
- Enable/disable trajectory curvature analysis for refining transitions
|
|
255
|
+
- **With curvature** (`--use-curvature`): Uses acceleration patterns to refine event timing
|
|
256
|
+
- Landing detection: Finds acceleration spike from impact deceleration
|
|
257
|
+
- Takeoff detection: Finds acceleration change as body transitions from static to upward motion
|
|
258
|
+
- Blends curvature-based refinement (70%) with velocity-based estimate (30%)
|
|
259
|
+
- Provides physics-based validation of velocity threshold crossings
|
|
260
|
+
- **Accuracy improvement**: More precise timing, especially for rapid transitions
|
|
261
|
+
- **Without curvature** (`--no-curvature`): Pure velocity-based detection with sub-frame interpolation
|
|
262
|
+
- Simpler, faster algorithm
|
|
263
|
+
- Still highly accurate with smooth velocity curves
|
|
264
|
+
- **Tip**: Keep enabled (default) for best results; disable only for debugging or comparison
|
|
265
|
+
|
|
189
266
|
## Output Format
|
|
190
267
|
|
|
191
268
|
### JSON Metrics
|
|
@@ -206,6 +283,7 @@ kinemetry dropjump-analyze jump.mp4 \
|
|
|
206
283
|
```
|
|
207
284
|
|
|
208
285
|
**Fields**:
|
|
286
|
+
|
|
209
287
|
- `jump_height_m`: Primary jump height measurement (calibrated if --drop-height provided, otherwise corrected kinematic)
|
|
210
288
|
- `jump_height_kinematic_m`: Kinematic estimate from flight time: h = (g × t²) / 8
|
|
211
289
|
- `jump_height_trajectory_normalized`: Position-based measurement in normalized coordinates (0-1 range)
|
|
@@ -217,6 +295,7 @@ kinemetry dropjump-analyze jump.mp4 \
|
|
|
217
295
|
### Debug Video
|
|
218
296
|
|
|
219
297
|
The debug video includes:
|
|
298
|
+
|
|
220
299
|
- **Green circle**: Average foot position when on ground
|
|
221
300
|
- **Red circle**: Average foot position when in air
|
|
222
301
|
- **Yellow circles**: Individual foot landmarks (ankles, heels)
|
|
@@ -232,6 +311,7 @@ The debug video includes:
|
|
|
232
311
|
**Symptoms**: Erratic landmark positions, missing detections, incorrect contact states
|
|
233
312
|
|
|
234
313
|
**Solutions**:
|
|
314
|
+
|
|
235
315
|
1. **Check video quality**: Ensure the athlete is clearly visible in profile view
|
|
236
316
|
2. **Increase smoothing**: Use `--smoothing-window 7` or higher
|
|
237
317
|
3. **Adjust detection confidence**: Try `--detection-confidence 0.6` or `--tracking-confidence 0.6`
|
|
@@ -242,6 +322,7 @@ The debug video includes:
|
|
|
242
322
|
**Symptoms**: "No frames processed" error or all null landmarks
|
|
243
323
|
|
|
244
324
|
**Solutions**:
|
|
325
|
+
|
|
245
326
|
1. **Verify video format**: OpenCV must be able to read the video
|
|
246
327
|
2. **Check framing**: Ensure full body is visible in side view
|
|
247
328
|
3. **Lower confidence thresholds**: Try `--detection-confidence 0.3 --tracking-confidence 0.3`
|
|
@@ -252,6 +333,7 @@ The debug video includes:
|
|
|
252
333
|
**Symptoms**: Wrong ground contact times, flight phases not detected
|
|
253
334
|
|
|
254
335
|
**Solutions**:
|
|
336
|
+
|
|
255
337
|
1. **Generate debug video**: Visualize contact states to diagnose the issue
|
|
256
338
|
2. **Adjust velocity threshold**:
|
|
257
339
|
- If missing contacts: decrease to `--velocity-threshold 0.01`
|
|
@@ -264,8 +346,9 @@ The debug video includes:
|
|
|
264
346
|
**Symptoms**: Unrealistic jump height values
|
|
265
347
|
|
|
266
348
|
**Solutions**:
|
|
349
|
+
|
|
267
350
|
1. **Use calibration**: For drop jumps, add `--drop-height` parameter with box height in meters (e.g., `--drop-height 0.40`)
|
|
268
|
-
-
|
|
351
|
+
- Theoretically improves accuracy (⚠️ unvalidated)
|
|
269
352
|
2. **Verify flight time detection**: Check `flight_start_frame` and `flight_end_frame` in JSON
|
|
270
353
|
3. **Compare measurements**: JSON output includes both `jump_height_m` (primary) and `jump_height_kinematic_m` (kinematic-only)
|
|
271
354
|
4. **Check for drop jump detection**: If doing a drop jump, ensure first phase is elevated enough (>5% of frame height)
|
|
@@ -275,50 +358,53 @@ The debug video includes:
|
|
|
275
358
|
**Symptoms**: Cannot write debug video or corrupted output
|
|
276
359
|
|
|
277
360
|
**Solutions**:
|
|
361
|
+
|
|
278
362
|
1. **Install additional codecs**: Ensure OpenCV has proper video codec support
|
|
279
363
|
2. **Try different output format**: Use `.avi` extension instead of `.mp4`
|
|
280
364
|
3. **Check output path**: Ensure write permissions for output directory
|
|
281
365
|
|
|
282
366
|
## How It Works
|
|
283
367
|
|
|
284
|
-
1. **Pose Tracking**: MediaPipe extracts 2D pose landmarks (ankles, heels, foot indices) from each frame
|
|
285
|
-
2. **
|
|
286
|
-
3. **
|
|
287
|
-
4. **
|
|
368
|
+
1. **Pose Tracking**: MediaPipe extracts 2D pose landmarks (foot points: ankles, heels, foot indices) from each frame
|
|
369
|
+
2. **Position Calculation**: Averages ankle, heel, and foot index positions to determine foot location
|
|
370
|
+
3. **Smoothing**: Savitzky-Golay filter reduces tracking jitter while preserving motion dynamics
|
|
371
|
+
4. **Contact Detection**: Analyzes vertical position velocity to identify ground contact vs. flight phases
|
|
372
|
+
5. **Phase Identification**: Finds continuous ground contact and flight periods
|
|
288
373
|
- Automatically detects drop jumps vs regular jumps
|
|
289
374
|
- For drop jumps: identifies box → drop → ground contact → jump sequence
|
|
290
|
-
|
|
375
|
+
6. **Sub-Frame Interpolation**: Estimates exact transition times between frames
|
|
291
376
|
- Uses Savitzky-Golay derivative for smooth velocity calculation
|
|
292
377
|
- Linear interpolation of velocity to find threshold crossings
|
|
293
378
|
- Achieves sub-millisecond timing precision (at 30fps: ±10ms vs ±33ms)
|
|
294
379
|
- Reduces timing error by 60-70% for contact and flight measurements
|
|
295
380
|
- Smoother velocity curves eliminate false threshold crossings
|
|
296
|
-
|
|
381
|
+
7. **Trajectory Curvature Analysis**: Refines transitions using acceleration patterns
|
|
297
382
|
- Computes second derivative (acceleration) from position trajectory
|
|
298
383
|
- Detects landing impact by acceleration spike
|
|
299
384
|
- Identifies takeoff by acceleration change patterns
|
|
300
385
|
- Provides independent validation and refinement of velocity-based detection
|
|
301
|
-
|
|
386
|
+
8. **Metric Calculation**:
|
|
302
387
|
- Ground contact time = contact phase duration (using fractional frames)
|
|
303
388
|
- Flight time = flight phase duration (using fractional frames)
|
|
304
389
|
- Jump height = calibrated position-based measurement (if --drop-height provided)
|
|
305
|
-
- Fallback:
|
|
390
|
+
- Fallback: kinematic estimate (g × t²) / 8 with optional empirical correction factor (⚠️ unvalidated)
|
|
306
391
|
|
|
307
392
|
## Development
|
|
308
393
|
|
|
309
394
|
### Code Quality Standards
|
|
310
395
|
|
|
311
396
|
This project enforces strict code quality standards:
|
|
397
|
+
|
|
312
398
|
- **Type safety**: Full mypy strict mode compliance with complete type annotations
|
|
313
399
|
- **Linting**: Comprehensive ruff checks (pycodestyle, pyflakes, isort, pep8-naming, etc.)
|
|
314
400
|
- **Formatting**: Black code style
|
|
315
|
-
- **Testing**: pytest with
|
|
401
|
+
- **Testing**: pytest with 25 unit tests
|
|
316
402
|
|
|
317
403
|
### Development Commands
|
|
318
404
|
|
|
319
405
|
```bash
|
|
320
406
|
# Run the tool
|
|
321
|
-
uv run
|
|
407
|
+
uv run kinemotion dropjump-analyze <video_path>
|
|
322
408
|
|
|
323
409
|
# Run all tests
|
|
324
410
|
uv run pytest
|
|
@@ -356,7 +442,7 @@ See [CLAUDE.md](CLAUDE.md) for detailed development guidelines.
|
|
|
356
442
|
## Limitations
|
|
357
443
|
|
|
358
444
|
- **2D Analysis**: Only analyzes motion in the camera's view plane
|
|
359
|
-
- **
|
|
445
|
+
- **Validation Status**: ⚠️ Accuracy has not been validated against gold standard measurements (force plates, 3D motion capture)
|
|
360
446
|
- **Side View Required**: Must film from the side to accurately track vertical motion
|
|
361
447
|
- **Single Athlete**: Designed for analyzing one athlete at a time
|
|
362
448
|
- **Timing precision**:
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
kinemotion/__init__.py,sha256=JhS0ZTgcTdcMH5WcIyWxEqZJPOoBUSKX8tT8hsG-xWk,98
|
|
2
|
+
kinemotion/cli.py,sha256=2IFA2_TE9a5zBtmGVzv5SnX39w7yPuBlw42dL7ca25U,402
|
|
3
|
+
kinemotion/core/__init__.py,sha256=3yzDhb5PekDNjydqrs8aWGneUGJBt-lB0SoB_Y2FXqU,1010
|
|
4
|
+
kinemotion/core/filtering.py,sha256=QtZRz8KlcLtR4dLRFH9sGqRQsUo_Dqcr1ZJIyWwPlcM,11266
|
|
5
|
+
kinemotion/core/pose.py,sha256=5Dhw3LqX3STR-eLb5JAQkxhS-dd0PqGytBWnaQ66nWc,8391
|
|
6
|
+
kinemotion/core/smoothing.py,sha256=z2qnpEGohDm6ZUrzqRXGLp189-NJL0ngKqYwXkU-iW0,13166
|
|
7
|
+
kinemotion/core/video_io.py,sha256=LD7qmHIqUYomGxS1kxz6khugIbFo2y4tDSY7XqJQCOM,4581
|
|
8
|
+
kinemotion/dropjump/__init__.py,sha256=yc1XiZ9vfo5h_n7PKVSiX2TTgaIfGL7Y7SkQtiDZj_E,838
|
|
9
|
+
kinemotion/dropjump/analysis.py,sha256=5lyTJFiItqmSHw96m8HmFrl7N6nCVQZnERWU2prjn9Y,18719
|
|
10
|
+
kinemotion/dropjump/cli.py,sha256=URQguQ6tmDofWagGydXzvc4NPXOCfOGX-yyFgvLV6lM,11954
|
|
11
|
+
kinemotion/dropjump/debug_overlay.py,sha256=s7hwYLA2JenRYOPD2GNmx3kATFseeZT3pW8jxiVgys8,8621
|
|
12
|
+
kinemotion/dropjump/kinematics.py,sha256=wcXaGUrb1kjSTus0KEwgdDzdkJRMy-umAzfStGq0_t4,16258
|
|
13
|
+
kinemotion-0.4.0.dist-info/METADATA,sha256=gbmHKdrYweUTafp6utQxnVAqHEgx4_EWNPEua86_kBU,18693
|
|
14
|
+
kinemotion-0.4.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
15
|
+
kinemotion-0.4.0.dist-info/entry_points.txt,sha256=zaqnAnjLvcdrk1Qvj5nvXZCZ2gp0prS7it1zTJygcIY,50
|
|
16
|
+
kinemotion-0.4.0.dist-info/licenses/LICENSE,sha256=KZajvqsHw0NoOHOi2q0FZ4NBe9HdV6oey-IPYAtHXfg,1088
|
|
17
|
+
kinemotion-0.4.0.dist-info/RECORD,,
|
dropjump/__init__.py
DELETED
dropjump/pose_tracker.py
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
"""Pose tracking using MediaPipe Pose."""
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import cv2
|
|
5
|
-
import mediapipe as mp
|
|
6
|
-
import numpy as np
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class PoseTracker:
|
|
10
|
-
"""Tracks human pose landmarks in video frames using MediaPipe."""
|
|
11
|
-
|
|
12
|
-
def __init__(
|
|
13
|
-
self,
|
|
14
|
-
min_detection_confidence: float = 0.5,
|
|
15
|
-
min_tracking_confidence: float = 0.5,
|
|
16
|
-
):
|
|
17
|
-
"""
|
|
18
|
-
Initialize the pose tracker.
|
|
19
|
-
|
|
20
|
-
Args:
|
|
21
|
-
min_detection_confidence: Minimum confidence for pose detection
|
|
22
|
-
min_tracking_confidence: Minimum confidence for pose tracking
|
|
23
|
-
"""
|
|
24
|
-
self.mp_pose = mp.solutions.pose
|
|
25
|
-
self.pose = self.mp_pose.Pose(
|
|
26
|
-
min_detection_confidence=min_detection_confidence,
|
|
27
|
-
min_tracking_confidence=min_tracking_confidence,
|
|
28
|
-
model_complexity=1,
|
|
29
|
-
)
|
|
30
|
-
|
|
31
|
-
def process_frame(
|
|
32
|
-
self, frame: np.ndarray
|
|
33
|
-
) -> dict[str, tuple[float, float, float]] | None:
|
|
34
|
-
"""
|
|
35
|
-
Process a single frame and extract pose landmarks.
|
|
36
|
-
|
|
37
|
-
Args:
|
|
38
|
-
frame: BGR image frame
|
|
39
|
-
|
|
40
|
-
Returns:
|
|
41
|
-
Dictionary mapping landmark names to (x, y, visibility) tuples,
|
|
42
|
-
or None if no pose detected. Coordinates are normalized (0-1).
|
|
43
|
-
"""
|
|
44
|
-
# Convert BGR to RGB
|
|
45
|
-
rgb_frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
|
|
46
|
-
|
|
47
|
-
# Process the frame
|
|
48
|
-
results = self.pose.process(rgb_frame)
|
|
49
|
-
|
|
50
|
-
if not results.pose_landmarks:
|
|
51
|
-
return None
|
|
52
|
-
|
|
53
|
-
# Extract key landmarks for feet tracking
|
|
54
|
-
landmarks = {}
|
|
55
|
-
landmark_names = {
|
|
56
|
-
self.mp_pose.PoseLandmark.LEFT_ANKLE: "left_ankle",
|
|
57
|
-
self.mp_pose.PoseLandmark.RIGHT_ANKLE: "right_ankle",
|
|
58
|
-
self.mp_pose.PoseLandmark.LEFT_HEEL: "left_heel",
|
|
59
|
-
self.mp_pose.PoseLandmark.RIGHT_HEEL: "right_heel",
|
|
60
|
-
self.mp_pose.PoseLandmark.LEFT_FOOT_INDEX: "left_foot_index",
|
|
61
|
-
self.mp_pose.PoseLandmark.RIGHT_FOOT_INDEX: "right_foot_index",
|
|
62
|
-
self.mp_pose.PoseLandmark.LEFT_HIP: "left_hip",
|
|
63
|
-
self.mp_pose.PoseLandmark.RIGHT_HIP: "right_hip",
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
for landmark_id, name in landmark_names.items():
|
|
67
|
-
lm = results.pose_landmarks.landmark[landmark_id]
|
|
68
|
-
landmarks[name] = (lm.x, lm.y, lm.visibility)
|
|
69
|
-
|
|
70
|
-
return landmarks
|
|
71
|
-
|
|
72
|
-
def close(self) -> None:
|
|
73
|
-
"""Release resources."""
|
|
74
|
-
self.pose.close()
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
dropjump/__init__.py,sha256=3os3CgjXm09srnAvsNIjA_KpHHfsu4ioRY0_oVDaX0w,60
|
|
2
|
-
dropjump/cli.py,sha256=mW_wUaAb1mzQks8oFcZHre50U0pbTacJZg3x-VUdLtY,9563
|
|
3
|
-
dropjump/contact_detection.py,sha256=cHqQ_nR9mbKyHeb90iuGjE8Hq34S01VURBMF8x5oHeM,15015
|
|
4
|
-
dropjump/kinematics.py,sha256=x2SB_4Pj-kJUFCI-KSMjr5PypCmh9FkRR9dorvMq8zI,14983
|
|
5
|
-
dropjump/pose_tracker.py,sha256=JDHK7di6-ObxwVR3TzERUmwCXeCFZWua1kUp1W9W55c,2367
|
|
6
|
-
dropjump/smoothing.py,sha256=FCAk6PnMs7v8dzh98cteLaCvHOuYtfWDVI3X51MxEqs,7836
|
|
7
|
-
dropjump/video_io.py,sha256=Cw_dYRgwybN1gIj4P88tedWAjwmQ4UxkRDztdpRD1hQ,11614
|
|
8
|
-
kinemotion-0.1.0.dist-info/METADATA,sha256=VpBdG6PQcEdjskv-oQssggqltnuDgxvmfd0-1nTj5oA,13737
|
|
9
|
-
kinemotion-0.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
10
|
-
kinemotion-0.1.0.dist-info/entry_points.txt,sha256=yRp0CWopxkd5fjbnhQ9OjI9gELPmpcCSMCDvWidatD4,47
|
|
11
|
-
kinemotion-0.1.0.dist-info/licenses/LICENSE,sha256=KZajvqsHw0NoOHOi2q0FZ4NBe9HdV6oey-IPYAtHXfg,1088
|
|
12
|
-
kinemotion-0.1.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|