UNPKG

bowling-analysis-system

Version:

A comprehensive system for analyzing bowling techniques using video processing and metrics calculation

184 lines (168 loc) 5.38 kB
/** * Metrics Configuration * * This file contains configurable parameters for metrics calculations * that were previously hardcoded in the codebase. * @module config/metricsConfig */ const metricsConfig = { /** * Balance Metrics Configuration */ balance: { // Center of Mass ideal positions centerOfMassIdeal: { horizontal: 0.5, // Ideal horizontal position (0-1 scale) vertical: 0.8 // Ideal vertical position (0-1 scale) }, // Stability calculation parameters stabilityWeights: { horizontalFactor: 4, // Horizontal deviation multiplier verticalFactor: 3, // Vertical deviation multiplier horizontalWeight: 0.6, // Weight given to horizontal stability verticalWeight: 0.4 // Weight given to vertical stability }, // Weight distribution parameters weightDistribution: { idealThreshold: 50, // Ideal weight distribution threshold deviationFactor: 25, // Factor for calculating deviation from ideal stabilityWeight: 0.6, // Weight given to stability in balance calculation distributionWeight: 40 // Weight given to distribution in balance calculation } }, /** * Power Metrics Configuration */ power: { // Joint contribution weights for power generation contributionWeights: { hip: 0.3, // Hip contribution weight shoulder: 0.3, // Shoulder contribution weight wrist: 0.4 // Wrist contribution weight }, // Weights for individual joints in power calculations weights: { shoulderWeight: 0.3, // Shoulder contribution to arm power elbowWeight: 0.3, // Elbow contribution to arm power wristWeight: 0.4, // Wrist contribution to arm power hipWeight: 0.4, // Hip contribution to leg power kneeWeight: 0.3, // Knee contribution to leg power ankleWeight: 0.3, // Ankle contribution to leg power armsWeight: 0.7, // Arms contribution to upper body power torsoWeight: 0.3, // Torso contribution to upper body power legsWeight: 0.7, // Legs contribution to lower body power hipsWeight: 0.3 // Hips contribution to lower body power }, // Physics model parameters physics: { forceFactor: 1.0, // Base factor for force calculations massMultiplier: 1.0, // Multiplier for effective mass gravityAcceleration: 9.81 // Gravity acceleration in m/s² } }, /** * Technique Metrics Configuration */ technique: { // Component weights for technique calculation componentWeights: { approachAlign: 0.3, // Weight for approach alignment bodyAlign: 0.3, // Weight for body alignment armAlign: 0.4 // Weight for arm alignment }, // Standard deviations for technique calculations standardDeviations: { defaultStdDev: 0.08 // Default standard deviation } }, /** * Bias Settings */ bias: { // Default biases for different metric types defaultBiases: { angle: { // Combined metrics (pluralized) shoulders: 0.05, // Combined shoulder angle bias elbows: 0.03, // Combined elbow angle bias wrists: 0.08, // Combined wrist angle bias hips: 0.04, // Combined hip angle bias knees: 0.02, // Combined knee angle bias ankles: 0.01, // Combined ankle angle bias // For backward compatibility - individual left/right shoulder: 0.05, elbow: 0.03, wrist: 0.08, hip: 0.04, knee: 0.02, ankle: 0.01 }, position: { x: 0.02, y: 0.03, z: 0.05 }, velocity: { // Combined metrics (pluralized) shoulderVelocities: 0.05, // Combined shoulder velocity bias elbowVelocities: 0.03, // Combined elbow velocity bias wristVelocities: 0.08, // Combined wrist velocity bias hipVelocities: 0.04, // Combined hip velocity bias kneeVelocities: 0.02, // Combined knee velocity bias ankleVelocities: 0.01, // Combined ankle velocity bias approach: 0.04, backswing: 0.06, forwardswing: 0.07, release: 0.05 } }, // Event weights for bias generation eventWeights: { releasePoint: { default: 1.0, velocity: 1.5, wristVelocity: 2.0, ballVelocity: 2.0 }, frontFootLanding: { default: 1.0 }, backFootLanding: { default: 1.0 } }, // Analysis parameters analysis: { windowSize: 5, significanceThreshold: 0.15, varianceThreshold: 0.05, smoothingFactor: 0.8, asymmetryWeights: { magnitudeDifference: 0.6, varianceDifference: 0.4 } } }, /** * Heuristics Configuration */ heuristics: { // Speed multipliers for different bowling speeds speedMultipliers: { slow: 1.2, // +20% medium: 1.0, // baseline fast: 0.85 // -15% } }, /** * Consistency Calculations */ consistency: { // Posture weights for consistency calculation postureWeights: { spineAngle: 0.7, headAngle: 0.3 } } }; module.exports = metricsConfig;