kinemotion 0.6.4__tar.gz → 0.7.1__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.
Potentially problematic release.
This version of kinemotion might be problematic. Click here for more details.
- {kinemotion-0.6.4 → kinemotion-0.7.1}/.pre-commit-config.yaml +5 -4
- {kinemotion-0.6.4 → kinemotion-0.7.1}/CHANGELOG.md +16 -0
- {kinemotion-0.6.4 → kinemotion-0.7.1}/CLAUDE.md +236 -35
- {kinemotion-0.6.4 → kinemotion-0.7.1}/PKG-INFO +89 -138
- {kinemotion-0.6.4 → kinemotion-0.7.1}/README.md +88 -137
- kinemotion-0.7.1/docs/IMU_METADATA_PRESERVATION.md +267 -0
- {kinemotion-0.6.4 → kinemotion-0.7.1}/docs/PARAMETERS.md +39 -11
- {kinemotion-0.6.4 → kinemotion-0.7.1}/docs/VALIDATION_PLAN.md +9 -0
- {kinemotion-0.6.4 → kinemotion-0.7.1}/examples/programmatic_usage.py +1 -2
- {kinemotion-0.6.4 → kinemotion-0.7.1}/pyproject.toml +3 -1
- kinemotion-0.7.1/src/kinemotion/core/auto_tuning.py +289 -0
- {kinemotion-0.6.4 → kinemotion-0.7.1}/src/kinemotion/core/filtering.py +1 -1
- {kinemotion-0.6.4 → kinemotion-0.7.1}/src/kinemotion/core/smoothing.py +10 -11
- {kinemotion-0.6.4 → kinemotion-0.7.1}/src/kinemotion/core/video_io.py +52 -8
- {kinemotion-0.6.4 → kinemotion-0.7.1}/src/kinemotion/dropjump/analysis.py +121 -4
- kinemotion-0.7.1/src/kinemotion/dropjump/cli.py +416 -0
- {kinemotion-0.6.4 → kinemotion-0.7.1}/src/kinemotion/dropjump/debug_overlay.py +11 -5
- {kinemotion-0.6.4 → kinemotion-0.7.1}/src/kinemotion/dropjump/kinematics.py +45 -5
- {kinemotion-0.6.4 → kinemotion-0.7.1}/tests/test_adaptive_threshold.py +6 -2
- {kinemotion-0.6.4 → kinemotion-0.7.1}/tests/test_aspect_ratio.py +6 -2
- {kinemotion-0.6.4 → kinemotion-0.7.1}/tests/test_com_estimation.py +3 -1
- {kinemotion-0.6.4 → kinemotion-0.7.1}/tests/test_filtering.py +1 -3
- {kinemotion-0.6.4 → kinemotion-0.7.1}/tests/test_polyorder.py +3 -1
- kinemotion-0.6.4/docs/IMPLEMENTATION_PLAN.md +0 -795
- kinemotion-0.6.4/docs/IMU_METADATA_PRESERVATION.md +0 -124
- kinemotion-0.6.4/src/kinemotion/dropjump/cli.py +0 -361
- {kinemotion-0.6.4 → kinemotion-0.7.1}/.github/workflows/release.yml +0 -0
- {kinemotion-0.6.4 → kinemotion-0.7.1}/.gitignore +0 -0
- {kinemotion-0.6.4 → kinemotion-0.7.1}/.tool-versions +0 -0
- {kinemotion-0.6.4 → kinemotion-0.7.1}/GEMINI.md +0 -0
- {kinemotion-0.6.4 → kinemotion-0.7.1}/LICENSE +0 -0
- {kinemotion-0.6.4 → kinemotion-0.7.1}/docs/ERRORS_FINDINGS.md +0 -0
- {kinemotion-0.6.4 → kinemotion-0.7.1}/docs/FRAMERATE.md +0 -0
- {kinemotion-0.6.4 → kinemotion-0.7.1}/src/kinemotion/__init__.py +0 -0
- {kinemotion-0.6.4 → kinemotion-0.7.1}/src/kinemotion/cli.py +0 -0
- {kinemotion-0.6.4 → kinemotion-0.7.1}/src/kinemotion/core/__init__.py +0 -0
- {kinemotion-0.6.4 → kinemotion-0.7.1}/src/kinemotion/core/pose.py +0 -0
- {kinemotion-0.6.4 → kinemotion-0.7.1}/src/kinemotion/dropjump/__init__.py +0 -0
- {kinemotion-0.6.4 → kinemotion-0.7.1}/tests/__init__.py +0 -0
- {kinemotion-0.6.4 → kinemotion-0.7.1}/tests/test_contact_detection.py +0 -0
- {kinemotion-0.6.4 → kinemotion-0.7.1}/tests/test_kinematics.py +0 -0
|
@@ -15,19 +15,20 @@ repos:
|
|
|
15
15
|
- id: mixed-line-ending
|
|
16
16
|
|
|
17
17
|
- repo: https://github.com/psf/black
|
|
18
|
-
rev:
|
|
18
|
+
rev: 25.9.0
|
|
19
19
|
hooks:
|
|
20
20
|
- id: black
|
|
21
21
|
|
|
22
22
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
23
|
-
rev: v0.
|
|
23
|
+
rev: v0.14.3
|
|
24
24
|
hooks:
|
|
25
25
|
- id: ruff
|
|
26
26
|
args: [--fix, --exit-non-zero-on-fix]
|
|
27
27
|
|
|
28
28
|
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
29
|
-
rev: v1.
|
|
29
|
+
rev: v1.18.2
|
|
30
30
|
hooks:
|
|
31
31
|
- id: mypy
|
|
32
32
|
args: [--ignore-missing-imports, --no-strict-optional]
|
|
33
|
-
|
|
33
|
+
files: ^src/
|
|
34
|
+
exclude: ^(tests/|examples/)
|
|
@@ -7,6 +7,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
<!-- version list -->
|
|
9
9
|
|
|
10
|
+
## v0.7.1 (2025-11-01)
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- Update documentation for auto-tuning system
|
|
15
|
+
([`6c1a135`](https://github.com/feniix/kinemotion/commit/6c1a135acf5cce7a627644dbc6393460277906ad))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## v0.7.0 (2025-11-01)
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
- Add intelligent auto-tuning and video rotation handling
|
|
23
|
+
([`7b35f67`](https://github.com/feniix/kinemotion/commit/7b35f6790dd8b6714f3e42389555107a043d486c))
|
|
24
|
+
|
|
25
|
+
|
|
10
26
|
## v0.6.4 (2025-10-26)
|
|
11
27
|
|
|
12
28
|
### Bug Fixes
|
|
@@ -240,6 +240,48 @@ self.height = int(self.cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
|
|
|
240
240
|
- Runtime validation in `write_frame()` ensures every frame matches expected encoded dimensions
|
|
241
241
|
- Raises `ValueError` if aspect ratio would be corrupted
|
|
242
242
|
|
|
243
|
+
### Video Rotation Handling (core/video_io.py)
|
|
244
|
+
|
|
245
|
+
**IMPORTANT**: The tool automatically handles video rotation metadata from mobile devices. OpenCV ignores rotation metadata, so we extract and apply it manually.
|
|
246
|
+
|
|
247
|
+
#### Rotation Metadata Extraction (`core/video_io.py:65-126`)
|
|
248
|
+
|
|
249
|
+
- **Display Matrix Metadata**: iPhones and other mobile devices store rotation in `side_data_list`
|
|
250
|
+
- Common rotation values: -90° (portrait right), 90° (portrait left), 180° (upside down)
|
|
251
|
+
- OpenCV's `VideoCapture.read()` ignores this metadata (known OpenCV issue #26876)
|
|
252
|
+
- Extracted using ffprobe from the same call that extracts SAR metadata
|
|
253
|
+
- **Automatic Frame Rotation**: Applied in `read_frame()` method using `cv2.rotate()`
|
|
254
|
+
- -90° / 270° → `cv2.ROTATE_90_CLOCKWISE`
|
|
255
|
+
- 90° / -270° → `cv2.ROTATE_90_COUNTERCLOCKWISE`
|
|
256
|
+
- ±180° → `cv2.ROTATE_180`
|
|
257
|
+
- **Dimension Updates**: Width and height are swapped after 90°/-90° rotations
|
|
258
|
+
|
|
259
|
+
```python
|
|
260
|
+
# Rotation extraction from side_data_list
|
|
261
|
+
side_data_list = stream.get("side_data_list", [])
|
|
262
|
+
for side_data in side_data_list:
|
|
263
|
+
if side_data.get("side_data_type") == "Display Matrix":
|
|
264
|
+
self.rotation = int(side_data.get("rotation", 0))
|
|
265
|
+
|
|
266
|
+
# Automatic rotation in read_frame()
|
|
267
|
+
if self.rotation == -90 or self.rotation == 270:
|
|
268
|
+
frame = cv2.rotate(frame, cv2.ROTATE_90_CLOCKWISE)
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
**Why this matters:**
|
|
272
|
+
|
|
273
|
+
- Without rotation handling, portrait videos are processed sideways
|
|
274
|
+
- MediaPipe would detect poses on rotated frames (person lying horizontally)
|
|
275
|
+
- Output videos would have incorrect orientation
|
|
276
|
+
- Jump analysis would fail due to incorrect gravity axis
|
|
277
|
+
|
|
278
|
+
**Example:**
|
|
279
|
+
|
|
280
|
+
- iPhone video encoded as 1920x1080 (landscape) with -90° rotation metadata
|
|
281
|
+
- Should be displayed as 1080x1920 (portrait)
|
|
282
|
+
- Tool automatically rotates frames and updates dimensions
|
|
283
|
+
- Output video correctly shows 1080x1920 portrait orientation
|
|
284
|
+
|
|
243
285
|
### Sub-Frame Interpolation (contact_detection.py:113-227)
|
|
244
286
|
|
|
245
287
|
**IMPORTANT**: The tool uses sub-frame interpolation with derivative-based velocity to achieve timing precision beyond frame boundaries.
|
|
@@ -462,30 +504,129 @@ Modify `smooth_landmarks()` in `core/smoothing.py:9`:
|
|
|
462
504
|
- `window_length`: Controls smoothing strength (must be odd, default: 5)
|
|
463
505
|
- `polyorder`: Polynomial order for Savitzky-Golay filter (default: 2)
|
|
464
506
|
|
|
465
|
-
###
|
|
507
|
+
### Intelligent Auto-Tuning System
|
|
466
508
|
|
|
467
|
-
**
|
|
509
|
+
**NEW**: The tool now features intelligent auto-tuning that eliminates the need for manual parameter adjustment!
|
|
468
510
|
|
|
469
|
-
|
|
511
|
+
#### How It Works (core/auto_tuning.py)
|
|
470
512
|
|
|
471
|
-
|
|
472
|
-
- **velocity-threshold**: Contact sensitivity (↓ to detect brief contacts)
|
|
473
|
-
- **min-contact-frames**: Temporal filter (↑ to remove false contacts)
|
|
474
|
-
- **visibility-threshold**: Landmark confidence (↓ for occluded landmarks)
|
|
475
|
-
- **detection-confidence**: Pose detection strictness (MediaPipe)
|
|
476
|
-
- **tracking-confidence**: Tracking persistence (MediaPipe)
|
|
477
|
-
- **drop-height**: Drop box height in meters for calibration (e.g., 0.40 for 40cm)
|
|
478
|
-
- **use-curvature**: Enable trajectory curvature analysis (default: enabled)
|
|
513
|
+
The auto-tuning system analyzes your video and automatically selects optimal parameters:
|
|
479
514
|
|
|
480
|
-
**
|
|
515
|
+
**Phase 1: Video Analysis**
|
|
516
|
+
- Extracts frame rate from video metadata
|
|
517
|
+
- Analyzes landmark visibility quality (average MediaPipe confidence scores)
|
|
518
|
+
- Measures position variance (tracking stability)
|
|
519
|
+
- Detects drop jump pattern (stationary period on platform)
|
|
481
520
|
|
|
482
|
-
|
|
521
|
+
**Phase 2: Automatic Parameter Selection**
|
|
483
522
|
|
|
484
|
-
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
523
|
+
**FPS-based scaling** (maintains consistent temporal resolution):
|
|
524
|
+
```python
|
|
525
|
+
velocity_threshold = 0.02 × (30 / fps)
|
|
526
|
+
# 30fps → 0.020, 60fps → 0.010, 120fps → 0.005
|
|
527
|
+
|
|
528
|
+
min_contact_frames = round(3 × (fps / 30))
|
|
529
|
+
# 30fps → 3 frames (100ms), 60fps → 6 frames (100ms)
|
|
530
|
+
|
|
531
|
+
smoothing_window = 5 if fps ≤ 30 else 3
|
|
532
|
+
# Higher fps → less smoothing (better temporal resolution)
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
**Quality-based adjustments** (adapts to tracking quality):
|
|
536
|
+
- High visibility (>0.7): Minimal smoothing, no bilateral filter
|
|
537
|
+
- Medium visibility (0.4-0.7): Moderate smoothing, enable bilateral filter
|
|
538
|
+
- Low visibility (<0.4): Aggressive smoothing, bilateral filter, lower confidence thresholds
|
|
539
|
+
|
|
540
|
+
**Always enabled** (proven beneficial, no downsides):
|
|
541
|
+
- Outlier rejection (removes tracking glitches)
|
|
542
|
+
- Trajectory curvature analysis (sub-frame precision)
|
|
543
|
+
- Drop start auto-detection (skips stationary period)
|
|
544
|
+
- Polyorder 2 (optimal for parabolic jump motion)
|
|
545
|
+
|
|
546
|
+
#### Quality Presets
|
|
547
|
+
|
|
548
|
+
**`--quality fast`** (50% faster, good for batch processing)
|
|
549
|
+
- Velocity threshold ×1.5 (less sensitive)
|
|
550
|
+
- Reduced smoothing (-2 frames)
|
|
551
|
+
- Skips bilateral filter
|
|
552
|
+
- Lower detection confidence (0.3)
|
|
553
|
+
|
|
554
|
+
**`--quality balanced`** (default, best for most cases)
|
|
555
|
+
- FPS-adjusted parameters
|
|
556
|
+
- Adaptive smoothing based on quality
|
|
557
|
+
- All accuracy features enabled
|
|
558
|
+
|
|
559
|
+
**`--quality accurate`** (research-grade, slower)
|
|
560
|
+
- Velocity threshold ×0.5 (more sensitive)
|
|
561
|
+
- Increased smoothing (+2 frames)
|
|
562
|
+
- Always enables bilateral filter
|
|
563
|
+
- Higher detection confidence (0.6)
|
|
564
|
+
|
|
565
|
+
#### User-Facing Parameters
|
|
566
|
+
|
|
567
|
+
**Reduced from 13 → 2 required + 2 optional:**
|
|
568
|
+
|
|
569
|
+
**Required:**
|
|
570
|
+
- `--drop-height`: Box height in meters (e.g., 0.40 for 40cm) - REQUIRED for accurate calibration
|
|
571
|
+
|
|
572
|
+
**Optional:**
|
|
573
|
+
- `--output`: Debug video path
|
|
574
|
+
- `--json-output`: Metrics JSON path
|
|
575
|
+
- `--quality`: fast/balanced/accurate (default: balanced)
|
|
576
|
+
- `--verbose`: Show auto-selected parameters
|
|
577
|
+
|
|
578
|
+
**Expert overrides** (rarely needed):
|
|
579
|
+
- `--drop-start-frame`: Manual drop start frame
|
|
580
|
+
- `--smoothing-window`: Override auto-tuned smoothing
|
|
581
|
+
- `--velocity-threshold`: Override auto-tuned threshold
|
|
582
|
+
- `--min-contact-frames`: Override auto-tuned minimum
|
|
583
|
+
- `--visibility-threshold`: Override visibility threshold
|
|
584
|
+
- `--detection-confidence`: Override MediaPipe detection
|
|
585
|
+
- `--tracking-confidence`: Override MediaPipe tracking
|
|
586
|
+
|
|
587
|
+
#### Migration from Manual Parameters
|
|
588
|
+
|
|
589
|
+
**Old way** (complex, error-prone):
|
|
590
|
+
```bash
|
|
591
|
+
# User had to know these magic numbers for 60fps video
|
|
592
|
+
uv run kinemotion dropjump-analyze video.mp4 \
|
|
593
|
+
--smoothing-window 3 \
|
|
594
|
+
--velocity-threshold 0.01 \
|
|
595
|
+
--min-contact-frames 6 \
|
|
596
|
+
--outlier-rejection \
|
|
597
|
+
--use-curvature
|
|
598
|
+
```
|
|
599
|
+
|
|
600
|
+
**New way** (simple, automatic):
|
|
601
|
+
```bash
|
|
602
|
+
# Just works - auto-detects 60fps and adjusts all parameters
|
|
603
|
+
uv run kinemotion dropjump-analyze video.mp4
|
|
604
|
+
```
|
|
605
|
+
|
|
606
|
+
#### Viewing Auto-Selected Parameters
|
|
607
|
+
|
|
608
|
+
Use `--verbose` to see what parameters were automatically selected:
|
|
609
|
+
|
|
610
|
+
```bash
|
|
611
|
+
uv run kinemotion dropjump-analyze video.mp4 --verbose
|
|
612
|
+
|
|
613
|
+
# Output shows:
|
|
614
|
+
# ============================================================
|
|
615
|
+
# AUTO-TUNED PARAMETERS
|
|
616
|
+
# ============================================================
|
|
617
|
+
# Video FPS: 59.98
|
|
618
|
+
# Tracking quality: high (avg visibility: 0.79)
|
|
619
|
+
# Quality preset: balanced
|
|
620
|
+
#
|
|
621
|
+
# Selected parameters:
|
|
622
|
+
# smoothing_window: 3
|
|
623
|
+
# velocity_threshold: 0.0100
|
|
624
|
+
# min_contact_frames: 6
|
|
625
|
+
# ...
|
|
626
|
+
# ============================================================
|
|
627
|
+
```
|
|
628
|
+
|
|
629
|
+
**Note**: See `docs/PARAMETERS.md` for detailed explanation of what each parameter does internally (useful for expert mode overrides).
|
|
489
630
|
|
|
490
631
|
### Working with Different Video Formats
|
|
491
632
|
|
|
@@ -576,6 +717,10 @@ If mypy reports errors:
|
|
|
576
717
|
|
|
577
718
|
## CLI Usage Examples
|
|
578
719
|
|
|
720
|
+
**NEW: The tool now features intelligent auto-tuning!** Parameters are automatically adjusted based on video frame rate, tracking quality, and analysis preset. No manual parameter tuning required.
|
|
721
|
+
|
|
722
|
+
### Simple Usage (Recommended)
|
|
723
|
+
|
|
579
724
|
```bash
|
|
580
725
|
# Show main command help
|
|
581
726
|
uv run kinemotion --help
|
|
@@ -583,35 +728,91 @@ uv run kinemotion --help
|
|
|
583
728
|
# Show subcommand help
|
|
584
729
|
uv run kinemotion dropjump-analyze --help
|
|
585
730
|
|
|
586
|
-
# Basic analysis (JSON to stdout)
|
|
587
|
-
|
|
731
|
+
# Basic analysis (JSON to stdout) - JUST WORKS!
|
|
732
|
+
# Drop-height is REQUIRED - specify your box height in meters
|
|
733
|
+
# Auto-detects fps, tracking quality, and selects optimal parameters
|
|
734
|
+
uv run kinemotion dropjump-analyze video.mp4 --drop-height 0.40
|
|
588
735
|
|
|
589
736
|
# Save metrics to file
|
|
590
|
-
uv run kinemotion dropjump-analyze video.mp4 --json-output results.json
|
|
737
|
+
uv run kinemotion dropjump-analyze video.mp4 --drop-height 0.40 --json-output results.json
|
|
591
738
|
|
|
592
739
|
# Generate debug video
|
|
593
|
-
uv run kinemotion dropjump-analyze video.mp4 --output debug.mp4
|
|
740
|
+
uv run kinemotion dropjump-analyze video.mp4 --drop-height 0.40 --output debug.mp4
|
|
594
741
|
|
|
595
|
-
#
|
|
596
|
-
uv run kinemotion dropjump-analyze video.mp4
|
|
742
|
+
# Complete analysis with all outputs
|
|
743
|
+
uv run kinemotion dropjump-analyze video.mp4 \
|
|
744
|
+
--drop-height 0.40 \
|
|
745
|
+
--output debug.mp4 \
|
|
746
|
+
--json-output metrics.json
|
|
747
|
+
|
|
748
|
+
# See what parameters were auto-selected
|
|
749
|
+
uv run kinemotion dropjump-analyze video.mp4 --drop-height 0.40 --verbose
|
|
750
|
+
|
|
751
|
+
# Different box heights (examples)
|
|
752
|
+
uv run kinemotion dropjump-analyze video.mp4 --drop-height 0.30 # 30cm box
|
|
753
|
+
uv run kinemotion dropjump-analyze video.mp4 --drop-height 0.60 # 60cm box
|
|
754
|
+
```
|
|
597
755
|
|
|
598
|
-
|
|
756
|
+
### Quality Presets
|
|
757
|
+
|
|
758
|
+
```bash
|
|
759
|
+
# Fast analysis (quick, less precise)
|
|
760
|
+
# - 50% faster processing
|
|
761
|
+
# - Good for batch processing or initial assessment
|
|
762
|
+
uv run kinemotion dropjump-analyze video.mp4 --drop-height 0.40 --quality fast
|
|
763
|
+
|
|
764
|
+
# Balanced analysis (default)
|
|
765
|
+
# - Good accuracy/speed tradeoff
|
|
766
|
+
# - Best for most use cases
|
|
767
|
+
uv run kinemotion dropjump-analyze video.mp4 --drop-height 0.40 --quality balanced
|
|
768
|
+
|
|
769
|
+
# Accurate analysis (research-grade, slower)
|
|
770
|
+
# - Maximum accuracy
|
|
771
|
+
# - More aggressive smoothing and filtering
|
|
772
|
+
# - Best for publication-quality data
|
|
773
|
+
uv run kinemotion dropjump-analyze video.mp4 --drop-height 0.40 --quality accurate
|
|
774
|
+
```
|
|
775
|
+
|
|
776
|
+
### Expert Mode (Advanced Users Only)
|
|
777
|
+
|
|
778
|
+
```bash
|
|
779
|
+
# Override specific auto-tuned parameters
|
|
599
780
|
uv run kinemotion dropjump-analyze video.mp4 \
|
|
781
|
+
--drop-height 0.40 \
|
|
782
|
+
--expert \
|
|
600
783
|
--smoothing-window 7 \
|
|
601
|
-
--velocity-threshold 0.
|
|
602
|
-
--min-contact-frames 5
|
|
784
|
+
--velocity-threshold 0.015
|
|
603
785
|
|
|
604
|
-
#
|
|
786
|
+
# Manual drop start frame (if auto-detection fails)
|
|
605
787
|
uv run kinemotion dropjump-analyze video.mp4 \
|
|
606
|
-
--output debug.mp4 \
|
|
607
|
-
--json-output metrics.json \
|
|
608
788
|
--drop-height 0.40 \
|
|
609
|
-
--
|
|
789
|
+
--drop-start-frame 120
|
|
790
|
+
```
|
|
610
791
|
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
792
|
+
### Auto-Tuning Examples
|
|
793
|
+
|
|
794
|
+
```bash
|
|
795
|
+
# 30fps video - auto-selects:
|
|
796
|
+
# velocity_threshold: 0.020
|
|
797
|
+
# min_contact_frames: 3
|
|
798
|
+
# smoothing_window: 5
|
|
799
|
+
uv run kinemotion dropjump-analyze video_30fps.mp4 --drop-height 0.40
|
|
800
|
+
|
|
801
|
+
# 60fps video - auto-selects:
|
|
802
|
+
# velocity_threshold: 0.010
|
|
803
|
+
# min_contact_frames: 6
|
|
804
|
+
# smoothing_window: 3
|
|
805
|
+
uv run kinemotion dropjump-analyze video_60fps.mp4 --drop-height 0.40
|
|
806
|
+
|
|
807
|
+
# Low quality video (avg visibility < 0.4) - auto-enables:
|
|
808
|
+
# bilateral_filter: True
|
|
809
|
+
# smoothing_window: +2 adjustment
|
|
810
|
+
uv run kinemotion dropjump-analyze low_quality.mp4 --drop-height 0.40
|
|
811
|
+
|
|
812
|
+
# High quality video (avg visibility > 0.7) - optimizes:
|
|
813
|
+
# bilateral_filter: False (not needed)
|
|
814
|
+
# smoothing_window: minimal (preserve detail)
|
|
815
|
+
uv run kinemotion dropjump-analyze high_quality.mp4 --drop-height 0.40
|
|
615
816
|
```
|
|
616
817
|
|
|
617
818
|
## MCP Server Configuration
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: kinemotion
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.1
|
|
4
4
|
Summary: Video-based kinematic analysis for athletic performance
|
|
5
5
|
Project-URL: Homepage, https://github.com/feniix/kinemotion
|
|
6
6
|
Project-URL: Repository, https://github.com/feniix/kinemotion
|
|
@@ -100,18 +100,21 @@ This will install all dependencies and make the `kinemotion` command available.
|
|
|
100
100
|
|
|
101
101
|
## Usage
|
|
102
102
|
|
|
103
|
+
**NEW:** Kinemotion now features **intelligent auto-tuning**! Just specify your drop box height and the tool automatically optimizes all parameters based on video frame rate and tracking quality.
|
|
104
|
+
|
|
103
105
|
### Basic Analysis
|
|
104
106
|
|
|
105
|
-
Analyze a video
|
|
107
|
+
Analyze a video with automatic parameter selection:
|
|
106
108
|
|
|
107
109
|
```bash
|
|
108
|
-
|
|
110
|
+
# Drop-height is REQUIRED for accurate calibration
|
|
111
|
+
kinemotion dropjump-analyze video.mp4 --drop-height 0.40
|
|
109
112
|
```
|
|
110
113
|
|
|
111
114
|
### Save Metrics to File
|
|
112
115
|
|
|
113
116
|
```bash
|
|
114
|
-
kinemotion dropjump-analyze video.mp4 --json-output metrics.json
|
|
117
|
+
kinemotion dropjump-analyze video.mp4 --drop-height 0.40 --json-output metrics.json
|
|
115
118
|
```
|
|
116
119
|
|
|
117
120
|
### Generate Debug Video
|
|
@@ -119,156 +122,104 @@ kinemotion dropjump-analyze video.mp4 --json-output metrics.json
|
|
|
119
122
|
Create an annotated video showing pose tracking and contact detection:
|
|
120
123
|
|
|
121
124
|
```bash
|
|
122
|
-
kinemotion dropjump-analyze video.mp4 --output debug.mp4
|
|
125
|
+
kinemotion dropjump-analyze video.mp4 --drop-height 0.40 --output debug.mp4
|
|
123
126
|
```
|
|
124
127
|
|
|
125
|
-
###
|
|
128
|
+
### Complete Analysis
|
|
126
129
|
|
|
127
|
-
|
|
130
|
+
With all outputs:
|
|
128
131
|
|
|
129
132
|
```bash
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
kinemotion dropjump-analyze drop-jump.mp4 \
|
|
135
|
-
--drop-height 0.60 \
|
|
136
|
-
--json-output metrics.json \
|
|
137
|
-
--output debug.mp4
|
|
133
|
+
kinemotion dropjump-analyze video.mp4 \
|
|
134
|
+
--drop-height 0.40 \
|
|
135
|
+
--output debug.mp4 \
|
|
136
|
+
--json-output results.json
|
|
138
137
|
```
|
|
139
138
|
|
|
140
|
-
###
|
|
139
|
+
### Quality Presets
|
|
140
|
+
|
|
141
|
+
Choose analysis quality (automatically adjusts all parameters):
|
|
141
142
|
|
|
142
143
|
```bash
|
|
143
|
-
#
|
|
144
|
-
kinemotion dropjump-analyze
|
|
145
|
-
--outlier-rejection \
|
|
146
|
-
--drop-height 0.40 \
|
|
147
|
-
--output debug.mp4 \
|
|
148
|
-
--json-output results.json \
|
|
149
|
-
--smoothing-window 7 \
|
|
150
|
-
--polyorder 3
|
|
144
|
+
# Fast analysis (quick, less precise - good for batch processing)
|
|
145
|
+
kinemotion dropjump-analyze video.mp4 --drop-height 0.40 --quality fast
|
|
151
146
|
|
|
152
|
-
#
|
|
153
|
-
kinemotion dropjump-analyze
|
|
154
|
-
|
|
155
|
-
|
|
147
|
+
# Balanced (default - best for most use cases)
|
|
148
|
+
kinemotion dropjump-analyze video.mp4 --drop-height 0.40 --quality balanced
|
|
149
|
+
|
|
150
|
+
# Accurate (research-grade, slower - maximum precision)
|
|
151
|
+
kinemotion dropjump-analyze video.mp4 --drop-height 0.40 --quality accurate
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### See Auto-Selected Parameters
|
|
155
|
+
|
|
156
|
+
View what parameters were automatically selected:
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
kinemotion dropjump-analyze video.mp4 --drop-height 0.40 --verbose
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Expert Mode (Advanced Users)
|
|
163
|
+
|
|
164
|
+
Override auto-tuned parameters if needed:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
# Manual parameter override (rarely needed)
|
|
168
|
+
kinemotion dropjump-analyze video.mp4 \
|
|
156
169
|
--drop-height 0.40 \
|
|
157
|
-
--
|
|
158
|
-
--
|
|
170
|
+
--expert \
|
|
171
|
+
--smoothing-window 7 \
|
|
172
|
+
--velocity-threshold 0.015
|
|
159
173
|
```
|
|
160
174
|
|
|
161
175
|
## Configuration Options
|
|
162
176
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
### Smoothing
|
|
174
|
-
|
|
175
|
-
- `--smoothing-window <int>` (default: 5)
|
|
176
|
-
- Window size for Savitzky-Golay smoothing filter
|
|
177
|
-
- Must be odd and >= 3
|
|
178
|
-
- Larger values = smoother trajectories but less responsive
|
|
179
|
-
- **Tip**: Increase for noisy videos, decrease for high-quality stable footage
|
|
180
|
-
|
|
181
|
-
- `--polyorder <int>` (default: 2)
|
|
182
|
-
- Polynomial order for Savitzky-Golay smoothing filter
|
|
183
|
-
- Must be < smoothing-window (typically 2 or 3)
|
|
184
|
-
- 2 = quadratic fit (good for parabolic motion like jumps)
|
|
185
|
-
- 3 = cubic fit (better for complex motion patterns)
|
|
186
|
-
- Higher order captures more motion complexity but more sensitive to noise
|
|
187
|
-
- **Tip**: Use 2 for most cases, try 3 for high-quality videos with complex motion
|
|
188
|
-
- **Accuracy improvement**: +1-2% for complex motion patterns
|
|
189
|
-
|
|
190
|
-
### Advanced Filtering
|
|
191
|
-
|
|
192
|
-
- `--outlier-rejection / --no-outlier-rejection` (default: --outlier-rejection)
|
|
193
|
-
- Apply RANSAC and median-based outlier rejection to remove tracking glitches
|
|
194
|
-
- **With outlier rejection** (`--outlier-rejection`): Detects and removes MediaPipe tracking errors
|
|
195
|
-
- RANSAC-based polynomial fitting identifies positions that deviate from smooth trajectory
|
|
196
|
-
- Median filtering catches spikes in otherwise smooth motion
|
|
197
|
-
- Outliers replaced with interpolated values from neighboring valid points
|
|
198
|
-
- Removes jumps, jitter, and temporary tracking losses
|
|
199
|
-
- **Accuracy improvement**: +1-2% by eliminating tracking glitches
|
|
200
|
-
- **Without outlier rejection** (`--no-outlier-rejection`): Uses raw tracked positions
|
|
201
|
-
- Faster processing, relies entirely on MediaPipe quality
|
|
202
|
-
- **Tip**: Keep enabled (default) unless debugging or working with perfect tracking
|
|
203
|
-
|
|
204
|
-
- `--bilateral-filter / --no-bilateral-filter` (default: --no-bilateral-filter)
|
|
205
|
-
- Use bilateral temporal filter for edge-preserving smoothing
|
|
206
|
-
- **With bilateral filter** (`--bilateral-filter`): Preserves sharp transitions while smoothing noise
|
|
207
|
-
- Weights each frame by temporal distance AND position similarity
|
|
208
|
-
- Landing/takeoff transitions remain sharp (not smoothed away)
|
|
209
|
-
- Noise in smooth regions (flight, ground contact) is reduced
|
|
210
|
-
- Edge-preserving alternative to Savitzky-Golay smoothing
|
|
211
|
-
- **Accuracy improvement**: +1-2% by preserving event timing precision
|
|
212
|
-
- **Without bilateral filter** (`--no-bilateral-filter`): Uses standard Savitzky-Golay smoothing
|
|
213
|
-
- Uniform smoothing across all frames
|
|
214
|
-
- Well-tested baseline method
|
|
215
|
-
- **Tip**: Experimental feature; enable for videos with rapid transitions or variable motion
|
|
216
|
-
- **Note**: Cannot be used simultaneously with Savitzky-Golay; bilateral replaces it when enabled
|
|
217
|
-
|
|
218
|
-
### Contact Detection
|
|
219
|
-
|
|
220
|
-
- `--velocity-threshold <float>` (default: 0.02)
|
|
221
|
-
- Vertical velocity threshold for detecting stationary feet
|
|
222
|
-
- In normalized coordinates (0-1 range)
|
|
223
|
-
- Lower values = more sensitive (may detect false contacts)
|
|
224
|
-
- Higher values = less sensitive (may miss brief contacts)
|
|
225
|
-
- **Tip**: Start with default, decrease if missing contacts, increase if detecting false contacts
|
|
226
|
-
|
|
227
|
-
- `--min-contact-frames <int>` (default: 3)
|
|
228
|
-
- Minimum consecutive frames to confirm ground contact
|
|
229
|
-
- Filters out momentary tracking glitches
|
|
230
|
-
- **Tip**: Increase for noisy videos with jittery tracking
|
|
231
|
-
|
|
232
|
-
### Visibility
|
|
233
|
-
|
|
234
|
-
- `--visibility-threshold <float>` (default: 0.5)
|
|
235
|
-
- Minimum MediaPipe visibility score (0-1) to trust a landmark
|
|
236
|
-
- Higher values require more confident tracking
|
|
237
|
-
- **Tip**: Lower if landmarks are frequently obscured but tracking seems reasonable
|
|
238
|
-
|
|
239
|
-
### Pose Tracking
|
|
240
|
-
|
|
241
|
-
- `--detection-confidence <float>` (default: 0.5)
|
|
242
|
-
- MediaPipe pose detection confidence threshold
|
|
243
|
-
- **Tip**: Increase if getting false pose detections
|
|
244
|
-
|
|
245
|
-
- `--tracking-confidence <float>` (default: 0.5)
|
|
246
|
-
- MediaPipe pose tracking confidence threshold
|
|
247
|
-
- **Tip**: Increase if tracking is jumping between different people/objects
|
|
248
|
-
|
|
249
|
-
### Calibration
|
|
250
|
-
|
|
251
|
-
- `--drop-height <float>` (optional)
|
|
177
|
+
### Intelligent Auto-Tuning
|
|
178
|
+
|
|
179
|
+
Kinemotion automatically optimizes parameters based on your video:
|
|
180
|
+
- **FPS-based scaling**: 30fps, 60fps, 120fps videos use different thresholds automatically
|
|
181
|
+
- **Quality-based adjustments**: Adapts smoothing based on MediaPipe tracking confidence
|
|
182
|
+
- **Always enabled**: Outlier rejection, curvature analysis, drop start detection
|
|
183
|
+
|
|
184
|
+
### Required Parameters
|
|
185
|
+
|
|
186
|
+
- `--drop-height <float>` **[REQUIRED]**
|
|
252
187
|
- Height of drop box/platform in meters (e.g., 0.40 for 40cm)
|
|
253
|
-
-
|
|
254
|
-
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
-
|
|
261
|
-
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
-
|
|
188
|
+
- Used for accurate calibration of jump height measurements
|
|
189
|
+
- Measure your box height accurately for best results
|
|
190
|
+
|
|
191
|
+
### Optional Parameters
|
|
192
|
+
|
|
193
|
+
- `--quality [fast|balanced|accurate]` (default: balanced)
|
|
194
|
+
- **fast**: Quick analysis, less precise (~50% faster)
|
|
195
|
+
- **balanced**: Good accuracy/speed tradeoff (recommended)
|
|
196
|
+
- **accurate**: Research-grade analysis, slower (maximum precision)
|
|
197
|
+
|
|
198
|
+
- `--verbose` / `-v`
|
|
199
|
+
- Show auto-selected parameters and analysis details
|
|
200
|
+
- Useful for understanding what the tool is doing
|
|
201
|
+
|
|
202
|
+
- `--output <path>` / `-o`
|
|
203
|
+
- Generate annotated debug video with pose tracking visualization
|
|
204
|
+
|
|
205
|
+
- `--json-output <path>` / `-j`
|
|
206
|
+
- Save metrics to JSON file instead of stdout
|
|
207
|
+
|
|
208
|
+
### Expert Overrides (Rarely Needed)
|
|
209
|
+
|
|
210
|
+
For advanced users who need manual control:
|
|
211
|
+
|
|
212
|
+
- `--drop-start-frame <int>`: Manually specify where drop begins (if auto-detection fails)
|
|
213
|
+
- `--smoothing-window <int>`: Override auto-tuned smoothing window
|
|
214
|
+
- `--velocity-threshold <float>`: Override auto-tuned velocity threshold
|
|
215
|
+
- `--min-contact-frames <int>`: Override auto-tuned minimum contact frames
|
|
216
|
+
- `--visibility-threshold <float>`: Override visibility threshold
|
|
217
|
+
- `--detection-confidence <float>`: Override MediaPipe detection confidence
|
|
218
|
+
- `--tracking-confidence <float>`: Override MediaPipe tracking confidence
|
|
219
|
+
|
|
220
|
+
> **📖 For detailed parameter explanations, see [docs/PARAMETERS.md](docs/PARAMETERS.md)**
|
|
221
|
+
>
|
|
222
|
+
> **Note:** Most users never need expert parameters - auto-tuning handles optimization automatically!
|
|
272
223
|
|
|
273
224
|
## Output Format
|
|
274
225
|
|