Brewing quality coffee depends heavily on grind consistency, but most home brewers lack affordable tools to measure it. For our final project, we set out to improve an open-source grind analysis app by integrating more advanced image processing techniques.
Our system processes microscope images of coffee grinds, automatically detects a reference object (a coin), and converts particle measurements from pixels into real-world units. Using multiple segmentation pipelines—including traditional thresholding, a Watershed-based method for separating overlapping particles, and an MSER (Maximally Stable Extremal Regions) approach—the system identifies each particle and extracts key metrics such as size distribution, shape, and surface area.
We also introduced new analysis features, including a fines counter (to detect very small particles that can lead to bitter brews) and a shape scoring system that evaluates the uniformity of grind particles. Together, these features provide home brewers with visual outputs (annotated images, histograms) and quantitative data to evaluate their grinder settings and improve brew quality.
Image Processing: CLAHE (adaptive histogram equalization), bilateral filtering, morphological operations
Segmentation: Watershed algorithm with two-pass refinement, MSER-based detection
Measurement: Pixel-to-mm scaling via Hough Circle Transform, convex hull analysis, ellipse fitting
Stack: Python, OpenCV, NumPy, SciPy, scikit-image, Matplotlib
Fully automated coin detection proved unreliable, so we developed a semi-automated method that balanced usability with accuracy.
Separating overlapping particles was especially difficult; our refined Watershed approach helped split clusters while minimizing errors.
By combining multiple segmentation strategies, the system performed more robustly across different grind sizes and image qualities.
Successfully distinguished grind consistency across brewing methods (French Press, Drip, Espresso).
Produced reliable measurements of particle size and shape, giving brewers actionable insights.
Extended the original Coffee Ad Astra tool with automation, advanced segmentation, and new analysis metrics.