Methodology

Analysis Pipeline Technical Details

Each stage of the analysis pipeline is implemented with specialized algorithms optimized for denim fit analysis.

1. Sobel Edge Detection (Step 2 - Normalization)

Equation
G(x,y) = |Gx(x,y)| + |Gy(x,y)| Gx(x,y) = (I(x+1,y) + 2I(x+1,y+1) + I(x+2,y)) - (I(x-1,y) + 2I(x-1,y+1) + I(x-2,y))
Gy(x,y) = (I(x,y+1) + 2I(x,y+1) + I(x,y+2)) - (I(x,y-1) + 2I(x,y-1) + I(x,y-2))

The Sobel operator applies two 3×3 kernels - one for horizontal changes (Gx) and one for vertical changes (Gy). The final gradient magnitude combines both components. This approach provides excellent edge localization while maintaining computational efficiency for real-time processing.

2. Contour Extraction and Refinement (Step 3 - Geometry Mapping)

C = findContours(edges, RETR_EXTERNAL, CHAIN_APPROX_SIMPLE)

Contour detection uses OpenCV's findContours function on the Sobel-processed edge map. We apply hierarchical contour retrieval with CHAIN_APPROX_SIMPLE to efficiently capture the essential shape boundaries while minimizing data storage. Critical steps include:

  • Area filtering to remove insignificant contours (minimum 50 pixels)
  • Sub-pixel refinement using ellipse fitting for curved contours
  • Boundary smoothing using Bezier curve fitting for critical edges
  • Aspect ratio filtering to isolate seat-specific contours
The resulting contours are then converted to parametric curves for precise geometry fitting.

3. Parametric Curve Fitting (Step 3 - Geometry Mapping)

f(θ) = a₀ + a₁·cos(θ) + a₂·sin(θ) + a₃·cos(2θ) + a₄·sin(2θ)

We fit parametric curves to the extracted contour points using least-squares optimization. The 4-parameter trigonometric model provides excellent approximation of elliptical seat contours while maintaining computational efficiency. Curve fitting parameters are refined iteratively using Levenberg-Marquardt optimization until the fit residual falls below 0.5 pixels.

3. Depth Estimation (Step 3 - Geometry Mapping)

d(x,y) = k₁·p(x,y) + k₂·θ(x,y) + k₃·σ(x,y)

Depth estimation uses a hybrid approach combining pixel intensity (p), pose-derived angles (θ), and silhouette analysis (σ). The k coefficients are calibrated against a master mold dataset. This heuristic approach provides reasonable depth estimation without requiring stereo vision or structured light, though it is explicitly documented as non-metric in nature.

4. Mesh Generation (Step 3 - Geometry Mapping)

M = DelaunayTriangulation(P, H)

The fitted geometry points (P) are triangulated using Delaunay triangulation to create a mesh (M). We apply progressive mesh refinement with edge collapse based on curvature metrics. Critical steps include:

  • Adaptive triangulation density based on local curvature
  • Edge collapse prioritizing high-curvature regions
  • Mesh smoothing using Laplacian relaxation
  • Boundary preservation for silhouette alignment
The resulting mesh is validated for topological correctness and computational efficiency.