Inferensys

Glossary

Blob Analysis

Blob analysis is a computer vision technique that detects and analyzes connected groups of pixels in a binary image to extract properties like area, perimeter, and centroid, used for quantifying the size and shape of defects.
Finance team analyzing AI ROI on laptop, investment return charts visible, business case review session.
CONNECTED-COMPONENT ANALYSIS

What is Blob Analysis?

A foundational computer vision technique for detecting and measuring connected groups of pixels in binary images to quantify defect size, shape, and position.

Blob analysis is a computer vision technique that detects and analyzes connected groups of pixels—called blobs—in a binary image to extract quantitative properties such as area, perimeter, centroid, and circularity. It operates on images that have been segmented into foreground (defect) and background regions through binarization, enabling precise measurement of discrete features for quality inspection.

The algorithm scans the binary image pixel by pixel, applying a connected-component labeling process to group adjacent foreground pixels into distinct objects. For each detected blob, the system calculates morphological descriptors that can be compared against tolerance thresholds to classify defects by size or shape, making it a deterministic and computationally efficient method for automated optical inspection on high-speed production lines.

QUANTITATIVE MORPHOMETRY

Key Properties Extracted by Blob Analysis

Once a binary image is segmented, blob analysis quantifies the geometric properties of connected components. These scalar measurements transform raw pixel clusters into actionable quality metrics for pass/fail decisions.

01

Area

The total number of pixels constituting a single connected component. Area is the most fundamental scalar property, directly correlating to the physical size of a defect or feature.

  • Zero-order moment: Computed as the sum of all white pixels in the blob.
  • Calibration: Converted to real-world units (mm²) using the camera's spatial calibration factor.
  • Application: Used to reject parts where a scratch or void exceeds a maximum allowable area threshold.
02

Centroid

The geometric center of mass of the blob, calculated as the average (x, y) coordinate of all pixels in the region. The centroid provides precise spatial localization.

  • First-order moments: The x-coordinate is M10/Area; the y-coordinate is M01/Area.
  • Sub-pixel accuracy: Computed as floating-point values, enabling precision beyond the discrete pixel grid.
  • Application: Guides robotic pick-and-place systems to the exact center of a part or defect for further action.
03

Perimeter

The length of the boundary contour enclosing the blob. Perimeter quantifies the complexity of the shape's outline and is sensitive to edge roughness.

  • Chain code tracing: Calculated by traversing the boundary pixels and summing the distances between consecutive points.
  • Compactness ratio: Often combined with area to derive form factors like circularity.
  • Application: Distinguishes a smooth, circular void from an irregular, jagged crack, even if both have identical areas.
04

Bounding Box

The minimal axis-aligned rectangle that fully encloses the blob. The bounding box provides the object's extreme dimensions.

  • Parameters: Defined by (x_min, y_min) as the top-left corner and (x_max, y_max) as the bottom-right corner.
  • Derived metrics: Width = x_max - x_min; Height = y_max - y_min.
  • Application: Used to measure the maximum length and width of a defect, which is critical for standards that specify linear tolerances rather than area.
05

Convex Hull & Solidity

The convex hull is the smallest convex polygon that contains all points of the blob. Solidity is the ratio of the blob's area to its convex hull area.

  • Solidity formula: Area / Convex_Hull_Area. A value of 1.0 indicates a perfectly convex shape.
  • Concavity detection: A low solidity score reveals a shape with deep indentations or a highly branched structure.
  • Application: Differentiates a solid particle of contamination (high solidity) from an agglomerate of smaller particles (low solidity).
06

Orientation & Major/Minor Axes

The angle of the principal axis of the blob relative to the horizontal, along with the lengths of the major and minor axes of the best-fit ellipse.

  • Second-order moments: The orientation is derived from the central moments, finding the axis of minimum inertia.
  • Elongation: The ratio of major axis length to minor axis length quantifies how stretched a blob is.
  • Application: Determines the directional alignment of a fiber or the dominant angle of a scratch, which can indicate a systematic process error.
BLOB ANALYSIS

Frequently Asked Questions

Concise answers to the most common technical questions about blob analysis, a foundational computer vision technique for detecting and measuring connected pixel regions in binary images for industrial quality inspection.

Blob analysis is a computer vision technique that detects and analyzes connected groups of pixels—called blobs—in a binary image to extract quantitative properties such as area, perimeter, centroid, and circularity. The process begins with binarization, where a grayscale image is converted to pure black and white based on a threshold value, separating foreground objects from the background. A connected-component labeling algorithm then scans the binary image pixel by pixel, assigning a unique identifier to each contiguous region of foreground pixels. Once labeled, each blob is measured: the system calculates its area (total pixel count), centroid (center of mass), bounding box, perimeter, and derived shape descriptors like convexity and elongation. In manufacturing, this enables rapid quantification of defect size, particle contamination, or missing features without requiring a trained neural network, making it computationally lightweight and deterministic for high-speed production lines.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.