Problem
Manual bottle inspection can be slow, inconsistent, and vulnerable to operator fatigue. The goal of this project was to create a non-invasive automated inspection method that identifies liquid-level irregularities in transparent bottles while remaining computationally lightweight.
Approach
The processing pipeline first converts the input image to grayscale and applies Gaussian smoothing with σ = 1.5 to suppress noise. Canny edge detection then extracts intensity boundaries. A strict region of interest isolates the bottle-neck area to reduce interference from strong label edges.
Geometric feature extraction
The Hough Transform converts edge points from image space into a parameter space where aligned points vote for candidate lines. This makes it possible to recover a liquid surface line even when glare or reflections break the visible edge.
Decision logic
Horizontal line candidates are filtered by angle, then the detected liquid-level Y position is compared with a calibrated reference. A deviation within 15 pixels is marked as PASS; larger deviations or failure to recover a coherent line are marked as FAIL.
Results
The reference bottle was detected within the acceptable tolerance and returned PASS. The damaged sample produced irregular contours and either a sufficiently large level deviation or no coherent fill line, resulting in FAIL.
Lessons learned
The project showed how strongly preprocessing affects transparent-object inspection, and how geometric methods can remain useful when deep learning would add unnecessary data and compute requirements. A future improvement would be adaptive thresholding for more robust performance under changing lighting conditions.
