You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Full-stack web app for analyzing kinstretch and mobility movements using 3D pose estimation. Upload a video, paste a YouTube URL, or use your webcam to capture real-time pose data. Inspect movements in an interactive 3D viewer, measure joint angles with anatomical plane decomposition, and track range of motion over time with interactive charts.
Tech Stack
Layer
Technology
Frontend
React 18, TypeScript, Vite, Tailwind CSS
3D Rendering
Three.js via React Three Fiber + Drei
Charts
Plotly.js via react-plotly.js
State Management
Zustand
Pose Estimation
MediaPipe PoseLandmarker Heavy (server-side)
Backend
FastAPI, SQLAlchemy (async), Pydantic v2
Database
PostgreSQL 16 (JSONB for landmark data)
Migrations
Alembic
Real-time
WebSocket (webcam streaming)
Video
yt-dlp, OpenCV, youtube-transcript-api
Features
Video Ingestion
Video Upload — Drag-and-drop MP4/MOV files. A two-step flow lets you preview duration and trim start/end times before processing so only the relevant clip is extracted.
YouTube Import — Paste a URL. The server downloads the video via yt-dlp, automatically inherits the YouTube title and channel name, and extracts poses in the background.
Webcam Real-Time — In-browser MediaPipe runs on GPU. Live 3D skeleton beside the camera feed. Record sessions and persist frames to the database via WebSocket.
Video Slicing — Set a start and end time (supports MM:SS, HH:MM:SS, or raw seconds) before processing to skip irrelevant footage.
3D Viewer
3D Pose Skeleton — 33 MediaPipe landmarks rendered as teal spheres and sky-blue cylinders. Rotate, zoom, and pan freely with OrbitControls.
Timeline Scrubber — Play/pause and step through extracted pose frames. Keyboard shortcuts: Space (play/pause), ←/→ (prev/next frame). HH:MM:SS timestamp display.
Video Sync — The source video panel is displayed alongside the 3D viewer and scrubs in sync with the skeleton. Expand it to 50% width with a toggle.
Angle Measurement
Bone-Click Measurement — Click two adjacent bones (cylinders) to calculate the 3D angle at the shared joint. A visual arc with a degree label is rendered at the joint in 3D space.
Anatomical Plane Decomposition — Every measurement is decomposed into sagittal, frontal, and transverse plane components using a subject-relative body frame derived from hip and shoulder landmarks. Named clinical movements (e.g. "Flex / Ext", "Abd / Add") are shown per plane.
Pinnable Planes — Click a plane row in the measurement panel to pin it; the arc reorients to show motion within that plane. Sagittal is amber, frontal is sky blue, transverse is green.
Plane Overlays — Toggle translucent anatomical plane meshes anchored to the subject's body in the 3D scene via the "Planes" button.
Draggable Label — The angle arc label can be repositioned by dragging (three-dot handle). OrbitControls are suspended during drag to avoid conflicts.
Saved Measurements & Analysis
Save Measurements — Persist angle + plane context with a generated label (e.g. "Left Hip — Flex / Ext @ 00:01:23") to the database.
Measurement History — Saved measurements are listed at the bottom of the viewer. Clicking any row instantly seeks the skeleton and video to that moment and restores the selected edges, arc, and plane breakdown — exactly as if you had clicked those bones again.
Joint Analysis Charts — Two Plotly charts appear whenever a measurement is active:
Angle over Time — Four lines (3D, Sagittal, Frontal, Transverse) plotted across all frames. A dotted playhead tracks the current position. Clicking any point seeks to that frame.
Spatial Trajectory — The joint's (x, y) path over the full video, colour-coded from dark blue (start) to amber (end), with the current position highlighted.
Session & Video Management
Session Management — Group videos and measurements into named analysis sessions. Sessions can be renamed and deleted (cascades to all videos and measurements).
Inline Title Editing — Click any video title in the list to rename it in place.
Creator Attribution — YouTube-imported videos automatically display the source channel name below the title.
Delete Sessions — Sessions and all associated data can be removed from the sidebar or session page.
User clicks two adjacent bones in the viewer → selectedEdges in the store
The shared joint is identified (set intersection of the two edge index pairs)
Vectors from the joint to each outer endpoint are computed in 3D space
3D angle: acos(dot(va, vb) / (|va| × |vb|))
Body frame: ML (right), SI (up), and AP (forward) axes are estimated from hip and shoulder landmark positions via Gram-Schmidt orthogonalisation
Plane angles: each bone vector pair is projected onto the plane whose normal is the body-frame axis, and the angle between projections is computed
A visual arc and draggable degree label are rendered at the joint; the arc plane is driven by the active (dominant or pinned) anatomical plane
Joint Analysis Panel: per-frame angle and plane-angle series are computed client-side across all loaded frames using the same math, powering the Plotly charts
Depth Enhancement (optional)
extract_poses() accepts enhance_depth=True to replace MediaPipe's z-coordinate estimates with values from Depth Anything V2 (via HuggingFace transformers). This requires torch, torchvision, and transformers to be installed. Depth is disabled by default because it requires GPU memory and the normalization is still being calibrated.
Roadmap
JWT authentication and user accounts
YouTube search from the UI (backend search_videos() already supports it)
Export measurements as CSV / PDF reports
Movement comparison — overlay two sessions side-by-side
Calibrate Depth Anything V2 z-normalization for reliable 3D depth
Custom joint groups and presets (e.g. "Hip Flexion Protocol")
Mobile-responsive layout
Celery for production-grade background task processing