PROJECT 07Computer Vision & Image SegmentationOpenCV & Watershed

NUMISVISION

Computer vision coin detection, marker-controlled watershed segmentation, and monetary valuation.

NUMISVISION // WATERSHED OVERLAPPING CONTOUR PARTITIONING PIPELINE
CLASSICAL COMPUTER VISION
STEP 01: PREPROCESSING
Bilateral Filtering

Suppresses camera sensor noise while maintaining sharp coin edge boundaries.

STEP 02: THRESHOLDING
Otsu vs Adaptive

Evaluates global variance against local neighborhood thresholds under glare.

STEP 03: DISTANCE RELIEF
Topographical Map

Calculates Euclidean distance to edge to isolate local maxima seed points.

STEP 04: WATERSHED
Boundary Partitioning

Marker-controlled watershed successfully splits touching coins with high accuracy.

TECH STACK • CORE RUNTIME
PythonOpenCVNumPyWatershedOtsuMatplotlibSciPy
DOMAIN DISCIPLINE
AI / Computer Vision
Author: Martin Wassim
VERIFIED INTERFACE ARTIFACTS & ARCHITECTURAL DIAGRAMS
1 visual assets
NUMISVISION screenshot 1
Figure 1: NUMISVISION — Visual EvidenceVerified Production Asset
01 / THE PROBLEM BEING SOLVED

Operational & Technical Friction

Standard circle detection algorithms (like naive Hough Circle Transforms) fail catastrophically when coins overlap, touch, or exist under uneven ambient lighting with harsh metallic specular glares.

02 / THE ARCHITECTED SOLUTION

Systemized Implementation

Formulated a robust multi-stage segmentation pipeline using Gaussian blurring, comparative Otsu vs adaptive thresholding, Euclidean distance transforms to identify local maxima centers, and marker-controlled watershed segmentation to partition merged contours with high geometric precision.

03 / ACTUAL IMPLEMENTATION & WORKFLOW

How It Operates in Production

Built in Python using OpenCV, NumPy, and SciPy. The pipeline ingests high-resolution images, computes morphological gradients to preserve boundaries, calculates distance transform relief maps, and seeds watershed markers at local Euclidean peaks.

Engineered automatic contour area calibration converting pixel diameters into exact physical coin denominations (10, 25, 50 piastres, and 1 pound), computing total currency value with rigorous error metrics.

04 / SYSTEM ARCHITECTURE EXPLANATION

Data Flow & Infrastructure

Raw images undergo bilateral edge-preserving smoothing followed by adaptive thresholding. The binary mask passes through distance transformation to isolate core centers. Watershed segmentation floods outward from peaks, separating boundaries cleanly before passing contours to the denomination classifier.

Architectural Highlight: Euclidean distance transforms coupled with marker-controlled watershed segmentation partition merged contours where naive Hough circle transforms fail.
05 / KEY ENGINEERING DECISIONS
Marker-controlled watershed over Hough Circles: Distance transform peaks provide deterministic seed markers that naturally separate touching circular bodies without circular deformation assumptions.
Morphological closure preprocessing: Applied elliptical structuring elements to seal interior specular voids caused by bright laboratory and smartphone flash reflections.
Calibrated denomination mapping: Evaluated bounding diameter ratios against known physical Egyptian currency dimensions for multi-coin classification.
06 / CHALLENGES & MITIGATIONS
•Handling touching coins with overlapping shadows and edge occlusion.
•Eliminating false positive markers caused by ornate coin face reliefs and engravings.
07 / VERIFIED CAPABILITIES
Gaussian and bilateral image filtering for noise suppression and edge preservation
Comparative Otsu global variance vs. local adaptive thresholding benchmarking
Morphological opening and closing kernels eliminating specular glare voids
Topographical distance transform generating markers for overlapping coin segmentation
Calibrated pixel-to-millimeter ratio classifying coin denominations and summing total currency
Evaluated across variable lighting datasets with MAE, RMSE, and count accuracy metrics