Demo
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data β all from the browser, and deployed in milliseconds.
index.ts
https://vinod--1287a13a3bbc11f0a3519e149126039e.web.val.run
A computer vision application that calculates body measurements from a single photo using OpenCV and MediaPipe pose detection.
- Upload a person's photo
- Automatic pose detection using MediaPipe
- Calculate key body measurements:
- Height
- Shoulder width
- Chest/Bust circumference
- Waist circumference
- Hip circumference
- Arm length
- Leg length (inseam)
- Neck circumference
- Wrist circumference
- And more tailoring measurements
- Pose Detection: Uses MediaPipe to detect 33 key body landmarks
- Reference Scaling: Uses known body proportions or user-provided reference measurements
- Anthropometric Calculations: Applies standard body measurement formulas
- Real-time Processing: Processes images and returns measurements instantly
- Upload a clear, full-body photo (front-facing preferred)
- Optionally provide a reference measurement (like height) for better accuracy
- Get comprehensive body measurements suitable for tailoring
- Backend: Hono.js with pose detection and measurement calculations
- Frontend: React with image upload and results display
- Computer Vision: Currently uses mock pose detection (see integration guide below)
- Calculations: Anthropometric formulas for body measurements
- Styling: TailwindCSS for responsive design
βββ backend/
β βββ index.ts # Main API server
β βββ pose-detection.ts # MediaPipe pose detection
β βββ measurements.ts # Body measurement calculations
β βββ utils.ts # Helper functions
βββ frontend/
β βββ index.html # Main page
β βββ App.tsx # React app component
β βββ components/ # UI components
βββ shared/
βββ types.ts # Shared TypeScript types
POST /api/measure
- Upload image and get body measurementsPOST /api/report
- Download measurements as text fileGET /api/health
- Health check endpointGET /api/docs
- API documentationGET /
- Serve the main application
This demo currently uses mock pose detection for demonstration purposes. To integrate with real pose detection:
npm install @mediapipe/pose @mediapipe/camera_utils
npm install @tensorflow/tfjs-node @tensorflow-models/posenet
npm install opencv4nodejs
See /backend/real-pose-integration.ts
for detailed implementation examples.
The system currently:
- β Provides a complete web interface for image upload
- β Validates image format and size
- β Implements comprehensive measurement calculations
- β Uses anthropometric formulas for accurate estimations
- β Provides confidence scoring
- β Generates downloadable measurement reports
- β οΈ Uses mock pose detection (needs real implementation)
The measurement calculations are based on established anthropometric research and provide:
- Primary measurements: Height, shoulder width, chest, waist, hip circumferences
- Arm measurements: Full arm, upper arm, forearm lengths and circumferences
- Leg measurements: Leg length, inseam, thigh, calf circumferences
- Tailoring measurements: Neck, armhole, back/front widths, and key distances
Accuracy depends on:
- Photo quality: Clear, well-lit, full-body images
- Pose quality: Upright stance with arms slightly away from body
- Reference measurement: Providing actual height significantly improves accuracy
- Pose detection quality: Real implementation will be more accurate than mock