StepSure is a cross-platform Flutter application that transforms a smartphone camera into an intelligent physiotherapy assistant.
It performs real-time gait analysis using pose estimation, calculates biomechanical recovery metrics, evaluates fall risk, and generates AI-powered rehabilitation reports with exportable medical PDFs.
StepSure is designed for stroke survivors and individuals undergoing lower-limb rehabilitation who need:
- Objective gait monitoring at home
- Continuous recovery tracking
- Real-time corrective feedback
- Structured rehabilitation reports
The system combines:
- Computer Vision (Pose Estimation)
- Biomechanical Analysis
- AI-generated Medical Reports
- Cloud-based Session Storage (Supabase)
- Live camera pose detection
- Skeleton overlay aligned to body orientation
- Joint angle computation (hip, knee, ankle)
- Step detection using hysteresis-based state machine
- Cadence, symmetry, and stability metrics
- Frame extraction at 5 FPS
- Per-frame pose detection
- Session-level biomechanical aggregation
- Fall risk classification
- Recovery Score (0โ100)
- Gait Symmetry Index
- Stride Consistency
- Stability Indicator
- Fall Risk Classification (Low / Moderate / High)
- Historical session storage
- Improvement trend visualization
- Longitudinal recovery monitoring
- Natural language session summary
- Abnormality identification
- Exercise suggestions
- Risk explanation
- Exportable medical-grade PDF report
- Authentication
- PostgreSQL session storage
- Secure video upload
- Cloud sync
User โ Flutter App โ Camera / Video Input โ Pose Detection (ML Kit) โ GaitAnalysisService โ Session Metrics Computation โ Supabase Storage โ AI Report Generator โ Results Dashboard + PDF Export
Replaced naive angle threshold logic with a per-leg rising-edge state machine using 20ยฐ hysteresis:
- Arm condition: <140ยฐ
- Fire condition: >160ยฐ
This prevents false triggering and ensures medically realistic cadence instead of inflated 10โ30ร step counts.
Platform-specific image processing:
- Android โ Concatenates YUV planes (NV21 format)
- iOS โ Uses BGRA8888 single-plane format
- Dynamically reads sensor orientation from:
_cameraController.description.sensorOrientation - No hardcoded rotation assumptions
-
Accepts
InputImageRotation -
Applies correct axis swap for:
- 0ยฐ
- 90ยฐ
- 180ยฐ
- 270ยฐ
-
Ensures accurate body alignment
-
Fixes quadrant misalignment issues
-
Extracts frames at 5 FPS
-
Uses
VideoPlayerController -
Captures frames via
RenderRepaintBoundary.toImage() -
Uses
PoseDetectionMode.single(correct for non-sequential frames) -
Feeds frames to
GaitAnalysisService.processFrame() -
Aggregates metrics using
computeSessionMetrics() -
Throws descriptive errors if:
- Video too short
- <5 pose detections
-
Off-screen hidden VideoPlayer
-
RepaintBoundary positioned at
left: -4000to preserve key integrity -
Full ML pipeline execution:
- Frame extraction
- Pose detection
- Gait analysis
- Session save to Supabase
- PDF generation
- Navigation to ResultsScreen
-
Live progress percentage display
-
Retry mechanism on failure
Generates a structured A4 medical report:
Includes:
- Header bar
- Score & Risk banner
- 6-row metrics table (color-coded Normal/Good/Poor)
- AI-generated summary
- Abnormalities list
- Exercise suggestions
- Risk explanation
- Medical disclaimer footer
Functions:
generateSessionReport(session, report) โ Uint8ListsharePdf()โ opens system share sheet
- Displays computed metrics
- Risk classification badge
- โExport PDF Reportโ button
- Loading state during PDF generation
lib/
โโโ core/
โโโ data/
โโโ domain/
โโโ features/
โ โโโ recording/
โ โโโ upload/
โ โโโ results/
โ โโโ analysis/
โโโ services/
โโโ presentation/
โโโ widgets/
assets/
test/
- Android
- iOS
- Web (limited camera support)
- Windows
- macOS
- Linux
- Supabase Authentication
- Secure PostgreSQL storage
- Controlled access to uploaded videos
- No third-party sharing
- Designed for future HIPAA-compliant expansion
- Prototype stage (no clinical validation yet)
- Camera positioning affects accuracy
- Lighting conditions impact pose detection
- Not a replacement for licensed physiotherapy
- Clinician dashboard
- Remote monitoring portal
- Multi-language support
- Wearable sensor integration
- Clinical trial validation
- Predictive relapse detection
https://docs.flutter.dev/get-started/install
git clone <repo-url>
cd StepSure
flutter pub get
- Add your Supabase URL
- Add anon/public key
- Configure storage bucket for videos
flutter run
(Academic Use).
StepSure is a research and prototype application. It does not replace professional medical diagnosis or treatment. Always consult a licensed physiotherapist or medical professional for rehabilitation guidance.