3D Distance Profiler — Depth Maps for Granulometry

Published:

A web-based RGB-D depth profiling system designed for analyzing mineral sample surfaces using depth camera data. Originally developed during the clay and mineral characterization work at ALGES (2017-2018), this project creates depth maps from RGB, grayscale, or HSI-paired samples, providing the 3D surface information needed for particle size (granulometry) estimation.

Business context

During hyperspectral mineral characterization campaigns, we captured not only spectral data (VNIR/SWIR) but also depth information. The goal was to complement spectral mineral identification with physical surface properties — particle size distribution, surface roughness, and texture — that directly affect processing behavior in grinding and flotation circuits.

Key Performance Indicators — Process impact

Surface characterization from depth data provides granulometric information that traditionally requires physical sieve analysis (hours of manual lab work per sample).

KPIBaseline (physical sieve)With depth profilingImpact
Characterization methodDestructive sieve analysisNon-destructive surface imagingSample preservation for further analysis
TurnaroundHours per sampleMinutes (image capture + processing)Orders of magnitude faster
Spatial resolutionBulk averagePer-pixel surface profileSpatially resolved granulometry maps
Integration with HSISeparate workflowCo-registered depth + spectral dataJoint mineral-granulometry characterization

Processing pipeline

How it works

The system implements a complete pipeline from raw depth images to quantitative surface metrics:

  1. Scene input: Synthetic RGB-D scene generation (5 types) or upload of real depth camera data (e.g., SICK Ranger3D conveyor-belt profiling)
  2. Preprocessing: Bilateral filter (edge-preserving smoothing, Tomasi & Manduchi 1998) + hole filling via nearest-neighbour interpolation
  3. 3D reconstruction: Depth-to-mesh conversion via pinhole camera model projection — each pixel becomes a 3D vertex, triangulated into a surface mesh
  4. Surface analysis: Normal estimation via finite-difference gradients, Gaussian and mean curvature computation from second-order differential geometry
  5. Profile extraction: 1D cross-section profiles along arbitrary lines with bilinear interpolation
  6. Roughness metrics: ISO 4287 standard parameters from profile statistics
Surface normals:
n = (-∂z/∂x, -∂z/∂y, 1) / ‖(-∂z/∂x, -∂z/∂y, 1)‖

Gaussian curvature:
K = (fxx · fyy - fxy²) / (1 + fx² + fy²)²

ISO 4287 roughness (Ra):
Ra = (1/N) Σ |zi - z̄| — arithmetic mean deviation of the profile

Technical stack

  • Backend: Python/FastAPI with NumPy/SciPy for computational geometry
  • Frontend: Three.js (r128) for interactive 3D mesh visualization with orbit controls
  • Render modes: RGB texture, depth colormap (hot, viridis, jet), wireframe, point cloud
  • Export: PLY, PCD, OBJ for external processing in MeshLab/CloudCompare/Blender
  • Communication: REST API with base64-encoded images and flat arrays for Three.js geometry

System architecture

Connection to broader work

This project is the enabling technology for granulometry estimation from surface imaging. When combined with the HSI Mineral Classification pipeline, it allows simultaneous characterization of both what a mineral sample is (spectral composition) and how it looks physically (particle size, roughness, texture). This joint characterization is critical for geometallurgical models that predict processing behavior.

View on GitHub