kinemotion 0.10.11__tar.gz → 0.11.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.
Potentially problematic release.
This version of kinemotion might be problematic. Click here for more details.
- {kinemotion-0.10.11 → kinemotion-0.11.0}/CHANGELOG.md +21 -0
- kinemotion-0.11.0/CLAUDE.md +234 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/PKG-INFO +93 -124
- {kinemotion-0.10.11 → kinemotion-0.11.0}/README.md +92 -123
- kinemotion-0.11.0/docs/CAMERA_SETUP.md +440 -0
- kinemotion-0.11.0/docs/CAMERA_SETUP_ES.md +440 -0
- kinemotion-0.11.0/docs/CMJ_GUIDE.md +451 -0
- kinemotion-0.11.0/docs/REAL_TIME_ANALYSIS.md +838 -0
- kinemotion-0.11.0/docs/TRIPLE_EXTENSION.md +310 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/pyproject.toml +1 -1
- kinemotion-0.11.0/samples/cmjs/README.md +47 -0
- kinemotion-0.11.0/src/kinemotion/__init__.py +31 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/src/kinemotion/api.py +335 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/src/kinemotion/cli.py +2 -0
- kinemotion-0.11.0/src/kinemotion/cmj/__init__.py +5 -0
- kinemotion-0.11.0/src/kinemotion/cmj/analysis.py +548 -0
- kinemotion-0.11.0/src/kinemotion/cmj/cli.py +626 -0
- kinemotion-0.11.0/src/kinemotion/cmj/debug_overlay.py +514 -0
- kinemotion-0.11.0/src/kinemotion/cmj/joint_angles.py +290 -0
- kinemotion-0.11.0/src/kinemotion/cmj/kinematics.py +191 -0
- kinemotion-0.11.0/tests/test_cmj_analysis.py +170 -0
- kinemotion-0.11.0/tests/test_cmj_kinematics.py +183 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/uv.lock +1 -1
- kinemotion-0.10.11/CLAUDE.md +0 -1003
- kinemotion-0.10.11/src/kinemotion/__init__.py +0 -14
- {kinemotion-0.10.11 → kinemotion-0.11.0}/.dockerignore +0 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/.github/ISSUE_TEMPLATE/config.yml +0 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/.github/pull_request_template.md +0 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/.github/workflows/release.yml +0 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/.gitignore +0 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/.pre-commit-config.yaml +0 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/.tool-versions +0 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/CODE_OF_CONDUCT.md +0 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/CONTRIBUTING.md +0 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/Dockerfile +0 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/GEMINI.md +0 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/LICENSE +0 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/SECURITY.md +0 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/docs/BULK_PROCESSING.md +0 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/docs/ERRORS_FINDINGS.md +0 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/docs/FRAMERATE.md +0 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/docs/IMU_METADATA_PRESERVATION.md +0 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/docs/PARAMETERS.md +0 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/docs/VALIDATION_PLAN.md +0 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/examples/bulk/README.md +0 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/examples/bulk/bulk_processing.py +0 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/examples/bulk/simple_example.py +0 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/examples/programmatic_usage.py +0 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/src/kinemotion/core/__init__.py +0 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/src/kinemotion/core/auto_tuning.py +0 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/src/kinemotion/core/filtering.py +0 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/src/kinemotion/core/pose.py +0 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/src/kinemotion/core/smoothing.py +0 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/src/kinemotion/core/video_io.py +0 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/src/kinemotion/dropjump/__init__.py +0 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/src/kinemotion/dropjump/analysis.py +0 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/src/kinemotion/dropjump/cli.py +0 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/src/kinemotion/dropjump/debug_overlay.py +0 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/src/kinemotion/dropjump/kinematics.py +0 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/src/kinemotion/py.typed +0 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/tests/__init__.py +0 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/tests/test_adaptive_threshold.py +0 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/tests/test_api.py +0 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/tests/test_aspect_ratio.py +0 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/tests/test_com_estimation.py +0 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/tests/test_contact_detection.py +0 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/tests/test_filtering.py +0 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/tests/test_kinematics.py +0 -0
- {kinemotion-0.10.11 → kinemotion-0.11.0}/tests/test_polyorder.py +0 -0
|
@@ -7,6 +7,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
<!-- version list -->
|
|
9
9
|
|
|
10
|
+
## v0.11.0 (2025-11-06)
|
|
11
|
+
|
|
12
|
+
### Documentation
|
|
13
|
+
|
|
14
|
+
- Add camera setup docs
|
|
15
|
+
([`84678d6`](https://github.com/feniix/kinemotion/commit/84678d60261a361c1dce51aec604491ab096f537))
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
- Add counter movement jump (CMJ) analysis with triple extension tracking
|
|
20
|
+
([`b6fc454`](https://github.com/feniix/kinemotion/commit/b6fc454482b20b11d82fadc51974a554562b60d3))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## v0.10.12 (2025-11-03)
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
- Add sonar quality gate status
|
|
28
|
+
([`df66261`](https://github.com/feniix/kinemotion/commit/df662612916d511ee7c6ed63bc79d23b30154bc6))
|
|
29
|
+
|
|
30
|
+
|
|
10
31
|
## v0.10.11 (2025-11-03)
|
|
11
32
|
|
|
12
33
|
### Bug Fixes
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
## Repository Purpose
|
|
4
|
+
|
|
5
|
+
Kinemotion: Video-based kinematic analysis for athletic performance using MediaPipe pose tracking.
|
|
6
|
+
|
|
7
|
+
**Supported Jump Types:**
|
|
8
|
+
- **Drop Jump**: Ground contact time, flight time, reactive strength index
|
|
9
|
+
- **Counter Movement Jump (CMJ)**: Jump height, flight time, countermovement depth, triple extension
|
|
10
|
+
|
|
11
|
+
## Quick Setup
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
asdf install # Install Python 3.12.7 + uv
|
|
15
|
+
uv sync # Install dependencies
|
|
16
|
+
uv run kinemotion dropjump-analyze video.mp4 --drop-height 0.40
|
|
17
|
+
uv run kinemotion cmj-analyze video.mp4
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
**Development:**
|
|
21
|
+
```bash
|
|
22
|
+
uv run pytest # Run all 70 tests
|
|
23
|
+
uv run ruff check --fix && uv run pyright # Lint + type check
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Architecture
|
|
27
|
+
|
|
28
|
+
### Module Structure
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
src/kinemotion/
|
|
32
|
+
├── cli.py # Main CLI (registers subcommands)
|
|
33
|
+
├── api.py # Python API (process_video, process_cmj_video, bulk)
|
|
34
|
+
├── core/ # Shared: pose, smoothing, filtering, auto_tuning, video_io
|
|
35
|
+
├── dropjump/ # Drop jump: cli, analysis, kinematics, debug_overlay
|
|
36
|
+
└── cmj/ # CMJ: cli, analysis, kinematics, joint_angles, debug_overlay
|
|
37
|
+
|
|
38
|
+
tests/ # 70 tests total (61 drop jump, 9 CMJ)
|
|
39
|
+
docs/ # CMJ_GUIDE, TRIPLE_EXTENSION, REAL_TIME_ANALYSIS, etc.
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
**Design**: Each jump type is a sibling module with its own CLI command, metrics, and visualization.
|
|
43
|
+
|
|
44
|
+
### Key Differences: Drop Jump vs CMJ
|
|
45
|
+
|
|
46
|
+
| Feature | Drop Jump | CMJ |
|
|
47
|
+
|---------|-----------|-----|
|
|
48
|
+
| Starting | Elevated box | Floor level |
|
|
49
|
+
| Algorithm | Forward search | Backward search from peak |
|
|
50
|
+
| Velocity | Absolute (magnitude) | Signed (direction matters) |
|
|
51
|
+
| Parameter | `--drop-height` required | No calibration needed |
|
|
52
|
+
| Key Metric | Ground contact time | Jump height from flight time |
|
|
53
|
+
|
|
54
|
+
## Critical Implementation Details
|
|
55
|
+
|
|
56
|
+
### 1. Aspect Ratio Preservation (core/video_io.py)
|
|
57
|
+
|
|
58
|
+
**Always:**
|
|
59
|
+
- Read first actual frame for dimensions: `frame.shape[:2]`
|
|
60
|
+
- Handle SAR (Sample Aspect Ratio) metadata with ffprobe
|
|
61
|
+
- Validate dimensions in `write_frame()` to prevent corruption
|
|
62
|
+
|
|
63
|
+
**Never:**
|
|
64
|
+
- Use `cv2.CAP_PROP_FRAME_WIDTH/HEIGHT` (wrong for rotated videos)
|
|
65
|
+
|
|
66
|
+
### 2. Video Rotation (core/video_io.py)
|
|
67
|
+
|
|
68
|
+
- Extract rotation metadata from ffprobe (`side_data_list`)
|
|
69
|
+
- Apply rotation in `read_frame()` using `cv2.rotate()`
|
|
70
|
+
- Update width/height after 90°/-90° rotations
|
|
71
|
+
|
|
72
|
+
### 3. JSON Serialization
|
|
73
|
+
|
|
74
|
+
**Always convert NumPy types:**
|
|
75
|
+
```python
|
|
76
|
+
"frame": int(self.frame) if self.frame is not None else None
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Never:**
|
|
80
|
+
```python
|
|
81
|
+
"frame": self.frame # WRONG - int64 not JSON serializable
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### 4. CMJ Signed Velocity (cmj/analysis.py)
|
|
85
|
+
|
|
86
|
+
**Critical difference from drop jump:**
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
# Drop jump: absolute velocity
|
|
90
|
+
velocities = compute_velocity_from_derivative(positions) # Returns abs()
|
|
91
|
+
|
|
92
|
+
# CMJ: MUST use signed velocity
|
|
93
|
+
velocities = compute_signed_velocity(positions) # Keeps sign
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**Why**: CMJ needs to distinguish upward (negative) vs downward (positive) motion for phase detection.
|
|
97
|
+
|
|
98
|
+
### 5. CMJ Backward Search (cmj/analysis.py)
|
|
99
|
+
|
|
100
|
+
**Algorithm:**
|
|
101
|
+
1. Find peak height first (global argmin)
|
|
102
|
+
2. Work backward: takeoff → lowest point
|
|
103
|
+
3. Work forward: landing after peak
|
|
104
|
+
|
|
105
|
+
**Why**: More robust than forward search, avoids false detections from video start.
|
|
106
|
+
|
|
107
|
+
### 6. Frame Dimensions
|
|
108
|
+
|
|
109
|
+
OpenCV vs NumPy ordering:
|
|
110
|
+
- NumPy shape: `(height, width, channels)`
|
|
111
|
+
- OpenCV VideoWriter: `(width, height)` tuple
|
|
112
|
+
|
|
113
|
+
## Common Tasks
|
|
114
|
+
|
|
115
|
+
### Add New Jump Type
|
|
116
|
+
|
|
117
|
+
1. Create `src/kinemotion/newjump/` with cli.py, analysis.py, kinematics.py
|
|
118
|
+
2. Register in `src/kinemotion/cli.py`: `cli.add_command(newjump_analyze)`
|
|
119
|
+
3. Add API functions in `api.py`
|
|
120
|
+
4. Export in `__init__.py`
|
|
121
|
+
5. Add tests
|
|
122
|
+
|
|
123
|
+
### Add Metrics
|
|
124
|
+
|
|
125
|
+
1. Update dataclass (e.g., `CMJMetrics`)
|
|
126
|
+
2. Calculate in `calculate_*_metrics()`
|
|
127
|
+
3. Add to `to_dict()` (convert NumPy types!)
|
|
128
|
+
4. Add tests
|
|
129
|
+
|
|
130
|
+
### Modify Detection
|
|
131
|
+
|
|
132
|
+
**Drop Jump**: Edit `detect_ground_contact()` in dropjump/analysis.py
|
|
133
|
+
**CMJ**: Edit `detect_cmj_phases()` in cmj/analysis.py (backward search)
|
|
134
|
+
|
|
135
|
+
## Testing & Quality
|
|
136
|
+
|
|
137
|
+
### Before Commit
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
uv run ruff check --fix # Auto-fix linting
|
|
141
|
+
uv run pyright # Type check (strict)
|
|
142
|
+
uv run pytest # All 70 tests
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Standards
|
|
146
|
+
|
|
147
|
+
- Pyright strict mode (all functions typed)
|
|
148
|
+
- Ruff (100 char lines)
|
|
149
|
+
- Conventional Commits (see below)
|
|
150
|
+
|
|
151
|
+
## Quick Reference
|
|
152
|
+
|
|
153
|
+
### CLI
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
# Drop jump (requires --drop-height)
|
|
157
|
+
kinemotion dropjump-analyze video.mp4 --drop-height 0.40
|
|
158
|
+
|
|
159
|
+
# CMJ (no calibration needed)
|
|
160
|
+
kinemotion cmj-analyze video.mp4 --output debug.mp4
|
|
161
|
+
|
|
162
|
+
# Batch
|
|
163
|
+
kinemotion cmj-analyze videos/*.mp4 --batch --workers 4
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Python API
|
|
167
|
+
|
|
168
|
+
```python
|
|
169
|
+
# Drop jump
|
|
170
|
+
from kinemotion import process_video
|
|
171
|
+
metrics = process_video("video.mp4", drop_height=0.40)
|
|
172
|
+
|
|
173
|
+
# CMJ
|
|
174
|
+
from kinemotion import process_cmj_video
|
|
175
|
+
metrics = process_cmj_video("video.mp4")
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Important Gotchas
|
|
179
|
+
|
|
180
|
+
### Video Processing
|
|
181
|
+
|
|
182
|
+
1. Read first frame for dimensions (not OpenCV properties)
|
|
183
|
+
2. Handle rotation metadata (mobile videos)
|
|
184
|
+
3. Preserve aspect ratio (SAR)
|
|
185
|
+
4. Validate dimensions in write_frame()
|
|
186
|
+
|
|
187
|
+
### CMJ Specific
|
|
188
|
+
|
|
189
|
+
1. **Lateral view required** - Front view won't work (parallax errors)
|
|
190
|
+
2. **Signed velocity** - Critical for phase detection
|
|
191
|
+
3. **Backward search** - Requires complete video (not real-time)
|
|
192
|
+
4. **MediaPipe limitations** - Ankle/knee only 18-27% visible in side view
|
|
193
|
+
|
|
194
|
+
### Type Safety
|
|
195
|
+
|
|
196
|
+
1. Convert NumPy types in `to_dict()`: `int()`, `float()`
|
|
197
|
+
2. Type all functions (pyright strict)
|
|
198
|
+
3. Handle None in optional fields
|
|
199
|
+
|
|
200
|
+
## Documentation
|
|
201
|
+
|
|
202
|
+
**User guides:** docs/CMJ_GUIDE.md, docs/CAMERA_SETUP.md, docs/PARAMETERS.md
|
|
203
|
+
**Technical:** docs/TRIPLE_EXTENSION.md, docs/REAL_TIME_ANALYSIS.md
|
|
204
|
+
|
|
205
|
+
## Commit Format
|
|
206
|
+
|
|
207
|
+
**Required**: [Conventional Commits](https://www.conventionalcommits.org/) - enforced by pre-commit hook
|
|
208
|
+
|
|
209
|
+
**Format**: `<type>(<scope>): <description>`
|
|
210
|
+
|
|
211
|
+
**Types** (triggers version bumps):
|
|
212
|
+
- `feat`: New feature → minor version bump (0.x.0)
|
|
213
|
+
- `fix`: Bug fix → patch version bump (0.0.x)
|
|
214
|
+
- `perf`: Performance improvement → patch
|
|
215
|
+
- `docs`, `test`, `refactor`, `chore`, `style`, `ci`, `build` → no version bump
|
|
216
|
+
|
|
217
|
+
**Examples:**
|
|
218
|
+
```bash
|
|
219
|
+
feat: add CMJ analysis with triple extension tracking
|
|
220
|
+
fix: correct takeoff detection in backward search algorithm
|
|
221
|
+
docs: add triple extension biomechanics guide
|
|
222
|
+
test: add CMJ phase detection tests
|
|
223
|
+
refactor: extract signed velocity to separate function
|
|
224
|
+
chore(release): 0.11.0 [skip ci]
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
**Breaking changes**: Add `!` or `BREAKING CHANGE:` footer
|
|
228
|
+
```bash
|
|
229
|
+
feat!: change API signature for process_video
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## MCP Servers
|
|
233
|
+
|
|
234
|
+
Configured in `.mcp.json`: web-search, sequential-thinking, context7, etc.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: kinemotion
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.11.0
|
|
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
|
|
@@ -34,30 +34,45 @@ Description-Content-Type: text/markdown
|
|
|
34
34
|
[](https://github.com/psf/black)
|
|
35
35
|
[](https://github.com/microsoft/pyright)
|
|
36
36
|
[](https://github.com/astral-sh/ruff)
|
|
37
|
+
[](https://sonarcloud.io/summary/new_code?id=feniix_kinemotion)
|
|
37
38
|
|
|
38
|
-
A video-based kinematic analysis tool for athletic performance. Analyzes
|
|
39
|
+
A video-based kinematic analysis tool for athletic performance. Analyzes vertical jump videos to estimate key performance metrics using MediaPipe pose tracking and advanced kinematics.
|
|
40
|
+
|
|
41
|
+
**Supported jump types:**
|
|
42
|
+
|
|
43
|
+
- **Drop Jump**: Ground contact time, flight time, reactive strength index
|
|
44
|
+
- **Counter Movement Jump (CMJ)**: Jump height, flight time, countermovement depth, triple extension biomechanics
|
|
39
45
|
|
|
40
46
|
## Features
|
|
41
47
|
|
|
48
|
+
### Core Features
|
|
49
|
+
|
|
42
50
|
- **Automatic pose tracking** using MediaPipe Pose landmarks
|
|
43
|
-
- **Ground contact detection** based on foot velocity and position
|
|
44
51
|
- **Derivative-based velocity** - smooth velocity calculation from position trajectory
|
|
45
52
|
- **Trajectory curvature analysis** - acceleration patterns for refined event detection
|
|
46
|
-
- **Sub-frame interpolation** - precise timing beyond frame boundaries
|
|
47
|
-
- **
|
|
48
|
-
- **Kinematic calculations** for jump metrics:
|
|
49
|
-
- Ground contact time (ms)
|
|
50
|
-
- Flight time (ms)
|
|
51
|
-
- Jump height (m) - with optional calibration using drop box height
|
|
52
|
-
- **Calibrated measurements** - use known drop height for theoretically improved accuracy (⚠️ accuracy claims unvalidated)
|
|
53
|
+
- **Sub-frame interpolation** - precise timing beyond frame boundaries
|
|
54
|
+
- **Intelligent auto-tuning** - automatic parameter optimization based on video characteristics
|
|
53
55
|
- **JSON output** for easy integration with other tools
|
|
54
|
-
- **
|
|
55
|
-
- **Batch processing** - CLI and Python API for parallel processing
|
|
56
|
-
- **Python library API** - use kinemotion programmatically
|
|
57
|
-
- **CSV export** - aggregated results for research
|
|
58
|
-
- **Configurable parameters** for smoothing, thresholds, and detection
|
|
56
|
+
- **Debug video overlays** with visual analysis
|
|
57
|
+
- **Batch processing** - CLI and Python API for parallel processing
|
|
58
|
+
- **Python library API** - use kinemotion programmatically
|
|
59
|
+
- **CSV export** - aggregated results for research
|
|
59
60
|
|
|
60
|
-
|
|
61
|
+
### Drop Jump Analysis
|
|
62
|
+
|
|
63
|
+
- **Ground contact detection** based on foot velocity and position
|
|
64
|
+
- **Automatic drop jump detection** - identifies box → drop → landing → jump phases
|
|
65
|
+
- **Metrics**: Ground contact time, flight time, jump height (with drop height calibration)
|
|
66
|
+
- **Reactive strength index** calculations
|
|
67
|
+
|
|
68
|
+
### Counter Movement Jump (CMJ) Analysis
|
|
69
|
+
|
|
70
|
+
- **Backward search algorithm** - robust phase detection from peak height
|
|
71
|
+
- **Flight time method** - force plate standard (h = g×t²/8)
|
|
72
|
+
- **Triple extension tracking** - ankle, knee, hip joint angles
|
|
73
|
+
- **Skeleton overlay** - biomechanical visualization
|
|
74
|
+
- **Metrics**: Jump height, flight time, countermovement depth, eccentric/concentric durations
|
|
75
|
+
- **Validated accuracy**: 50.6cm jump (±1 frame precision)
|
|
61
76
|
|
|
62
77
|
## Validation Status
|
|
63
78
|
|
|
@@ -103,133 +118,77 @@ This will install all dependencies and make the `kinemotion` command available.
|
|
|
103
118
|
|
|
104
119
|
## Usage
|
|
105
120
|
|
|
106
|
-
|
|
121
|
+
Kinemotion supports two jump types with intelligent auto-tuning that automatically optimizes parameters based on video characteristics.
|
|
107
122
|
|
|
108
|
-
###
|
|
123
|
+
### Drop Jump Analysis
|
|
109
124
|
|
|
110
|
-
|
|
125
|
+
Analyzes reactive strength and ground contact time:
|
|
111
126
|
|
|
112
127
|
```bash
|
|
113
128
|
# Drop-height is REQUIRED for accurate calibration
|
|
114
129
|
kinemotion dropjump-analyze video.mp4 --drop-height 0.40
|
|
115
130
|
```
|
|
116
131
|
|
|
117
|
-
###
|
|
118
|
-
|
|
119
|
-
```bash
|
|
120
|
-
kinemotion dropjump-analyze video.mp4 --drop-height 0.40 --json-output metrics.json
|
|
121
|
-
```
|
|
132
|
+
### Counter Movement Jump (CMJ) Analysis
|
|
122
133
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
Create an annotated video showing pose tracking and contact detection:
|
|
134
|
+
Analyzes jump height and biomechanics:
|
|
126
135
|
|
|
127
136
|
```bash
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
### Complete Analysis
|
|
137
|
+
# No drop height needed (floor level)
|
|
138
|
+
kinemotion cmj-analyze video.mp4
|
|
132
139
|
|
|
133
|
-
With
|
|
134
|
-
|
|
135
|
-
```bash
|
|
136
|
-
kinemotion dropjump-analyze video.mp4 \
|
|
137
|
-
--drop-height 0.40 \
|
|
138
|
-
--output debug.mp4 \
|
|
139
|
-
--json-output results.json
|
|
140
|
+
# With triple extension visualization
|
|
141
|
+
kinemotion cmj-analyze video.mp4 --output debug.mp4
|
|
140
142
|
```
|
|
141
143
|
|
|
142
|
-
###
|
|
143
|
-
|
|
144
|
-
Choose analysis quality (automatically adjusts all parameters):
|
|
144
|
+
### Common Options (Both Jump Types)
|
|
145
145
|
|
|
146
146
|
```bash
|
|
147
|
-
#
|
|
148
|
-
kinemotion
|
|
147
|
+
# Save metrics to JSON
|
|
148
|
+
kinemotion cmj-analyze video.mp4 --json-output results.json
|
|
149
149
|
|
|
150
|
-
#
|
|
151
|
-
kinemotion
|
|
150
|
+
# Generate debug video
|
|
151
|
+
kinemotion cmj-analyze video.mp4 --output debug.mp4
|
|
152
152
|
|
|
153
|
-
#
|
|
154
|
-
kinemotion
|
|
153
|
+
# Complete analysis with all outputs
|
|
154
|
+
kinemotion cmj-analyze video.mp4 \
|
|
155
|
+
--output debug.mp4 \
|
|
156
|
+
--json-output results.json \
|
|
157
|
+
--verbose
|
|
155
158
|
```
|
|
156
159
|
|
|
157
|
-
###
|
|
158
|
-
|
|
159
|
-
View what parameters were automatically selected:
|
|
160
|
+
### Quality Presets
|
|
160
161
|
|
|
161
162
|
```bash
|
|
162
|
-
|
|
163
|
-
|
|
163
|
+
# Fast (50% faster, good for batch)
|
|
164
|
+
kinemotion cmj-analyze video.mp4 --quality fast
|
|
164
165
|
|
|
165
|
-
|
|
166
|
+
# Balanced (default)
|
|
167
|
+
kinemotion cmj-analyze video.mp4 --quality balanced
|
|
166
168
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
```bash
|
|
170
|
-
# Manual parameter override (rarely needed)
|
|
171
|
-
kinemotion dropjump-analyze video.mp4 \
|
|
172
|
-
--drop-height 0.40 \
|
|
173
|
-
--expert \
|
|
174
|
-
--smoothing-window 7 \
|
|
175
|
-
--velocity-threshold 0.015
|
|
169
|
+
# Accurate (research-grade)
|
|
170
|
+
kinemotion cmj-analyze video.mp4 --quality accurate --verbose
|
|
176
171
|
```
|
|
177
172
|
|
|
178
173
|
### Batch Processing
|
|
179
174
|
|
|
180
|
-
Process multiple videos in parallel
|
|
175
|
+
Process multiple videos in parallel:
|
|
181
176
|
|
|
182
177
|
```bash
|
|
183
|
-
#
|
|
178
|
+
# Drop jumps
|
|
184
179
|
kinemotion dropjump-analyze videos/*.mp4 --batch --drop-height 0.40 --workers 4
|
|
185
180
|
|
|
186
|
-
#
|
|
187
|
-
kinemotion
|
|
181
|
+
# CMJ (no drop height needed)
|
|
182
|
+
kinemotion cmj-analyze videos/*.mp4 --batch --workers 4 \
|
|
188
183
|
--json-output-dir results/ \
|
|
189
|
-
--output-dir debug_videos/ \
|
|
190
184
|
--csv-summary summary.csv
|
|
191
|
-
|
|
192
|
-
# Multiple explicit paths (batch mode auto-enabled)
|
|
193
|
-
kinemotion dropjump-analyze video1.mp4 video2.mp4 video3.mp4 --drop-height 0.40
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
**Batch options:**
|
|
197
|
-
|
|
198
|
-
- `--batch`: Explicitly enable batch mode
|
|
199
|
-
- `--workers <int>`: Number of parallel workers (default: 4)
|
|
200
|
-
- `--output-dir <path>`: Directory for debug videos (auto-named per video)
|
|
201
|
-
- `--json-output-dir <path>`: Directory for JSON metrics (auto-named per video)
|
|
202
|
-
- `--csv-summary <path>`: Export aggregated results to CSV
|
|
203
|
-
|
|
204
|
-
**Output example:**
|
|
205
|
-
|
|
206
|
-
```text
|
|
207
|
-
Batch processing 10 videos with 4 workers
|
|
208
|
-
======================================================================
|
|
209
|
-
|
|
210
|
-
Processing videos...
|
|
211
|
-
[1/10] ✓ athlete1.mp4 (2.3s)
|
|
212
|
-
[2/10] ✓ athlete2.mp4 (2.1s)
|
|
213
|
-
[3/10] ✗ athlete3.mp4 (0.5s)
|
|
214
|
-
Error: No frames could be processed
|
|
215
|
-
|
|
216
|
-
======================================================================
|
|
217
|
-
BATCH PROCESSING SUMMARY
|
|
218
|
-
======================================================================
|
|
219
|
-
Total videos: 10
|
|
220
|
-
Successful: 9
|
|
221
|
-
Failed: 1
|
|
222
|
-
|
|
223
|
-
Average ground contact time: 245.3 ms
|
|
224
|
-
Average flight time: 523.7 ms
|
|
225
|
-
Average jump height: 0.352 m (35.2 cm)
|
|
226
185
|
```
|
|
227
186
|
|
|
228
187
|
## Python API
|
|
229
188
|
|
|
230
|
-
Use kinemotion as a library
|
|
189
|
+
Use kinemotion as a library for automated pipelines and custom analysis.
|
|
231
190
|
|
|
232
|
-
###
|
|
191
|
+
### Drop Jump API
|
|
233
192
|
|
|
234
193
|
```python
|
|
235
194
|
from kinemotion import process_video
|
|
@@ -251,43 +210,53 @@ print(f"Flight time: {metrics.flight_time * 1000:.1f} ms")
|
|
|
251
210
|
### Bulk Video Processing
|
|
252
211
|
|
|
253
212
|
```python
|
|
213
|
+
# Drop jump bulk processing
|
|
254
214
|
from kinemotion import VideoConfig, process_videos_bulk
|
|
255
215
|
|
|
256
|
-
# Configure multiple videos
|
|
257
216
|
configs = [
|
|
258
217
|
VideoConfig("video1.mp4", drop_height=0.40),
|
|
259
218
|
VideoConfig("video2.mp4", drop_height=0.30, quality="accurate"),
|
|
260
|
-
VideoConfig("video3.mp4", drop_height=0.50, output_video="debug3.mp4"),
|
|
261
219
|
]
|
|
262
220
|
|
|
263
|
-
# Process in parallel with 4 workers
|
|
264
221
|
results = process_videos_bulk(configs, max_workers=4)
|
|
265
222
|
|
|
266
|
-
#
|
|
267
|
-
|
|
223
|
+
# CMJ bulk processing
|
|
224
|
+
from kinemotion import CMJVideoConfig, process_cmj_videos_bulk
|
|
225
|
+
|
|
226
|
+
cmj_configs = [
|
|
227
|
+
CMJVideoConfig("cmj1.mp4"),
|
|
228
|
+
CMJVideoConfig("cmj2.mp4", quality="accurate"),
|
|
229
|
+
]
|
|
230
|
+
|
|
231
|
+
cmj_results = process_cmj_videos_bulk(cmj_configs, max_workers=4)
|
|
232
|
+
|
|
233
|
+
for result in cmj_results:
|
|
268
234
|
if result.success:
|
|
269
|
-
print(f"
|
|
270
|
-
else:
|
|
271
|
-
print(f"✗ {result.video_path}: {result.error}")
|
|
235
|
+
print(f"{result.video_path}: {result.metrics.jump_height*100:.1f}cm")
|
|
272
236
|
```
|
|
273
237
|
|
|
274
|
-
|
|
238
|
+
See `examples/bulk/README.md` for comprehensive API documentation.
|
|
239
|
+
|
|
240
|
+
### CMJ-Specific Features
|
|
275
241
|
|
|
276
242
|
```python
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
from kinemotion import VideoConfig, process_videos_bulk
|
|
243
|
+
# Triple extension angles available in metrics
|
|
244
|
+
metrics = process_cmj_video("video.mp4", output_video="debug.mp4")
|
|
280
245
|
|
|
281
|
-
#
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
]
|
|
246
|
+
# Debug video shows:
|
|
247
|
+
# - Skeleton overlay (foot→shin→femur→trunk)
|
|
248
|
+
# - Joint angles (ankle, knee, hip, trunk)
|
|
249
|
+
# - Phase-coded visualization
|
|
250
|
+
```
|
|
287
251
|
|
|
288
|
-
|
|
252
|
+
### CSV Export Example
|
|
253
|
+
|
|
254
|
+
```python
|
|
255
|
+
# See examples/bulk/ for complete CSV export examples
|
|
256
|
+
from kinemotion import process_cmj_video
|
|
257
|
+
import csv
|
|
289
258
|
|
|
290
|
-
#
|
|
259
|
+
# ... process videos ...
|
|
291
260
|
with open("results.csv", "w", newline="") as f:
|
|
292
261
|
writer = csv.writer(f)
|
|
293
262
|
writer.writerow(["Video", "GCT (ms)", "Flight (ms)", "Jump (m)"])
|