A Blob Analysis operation detects objects in binary images and describes these objects using geometrical and statistical features. Figure 377, 'Objects Visualized by Colored Boxes' shows a binary image consisting of four objects. (In the figure, these four objects are visualized by colored boxes.)
In blob analysis, an object is defined by a set of pixels which differ from the background and are in direct neighborhood. Therefore, at first all pixels of an image need to be transformed into a binary image. Here, Visual Applets allows the design of various methods from simple thresholding up to complex adaptive binarization algorithms. Next, all black pixels of the resulting binary image are assumed to be background pixels, whereas all white pixels are assumed to be foreground pixels and thus to belong to an object.
Every white (foreground) pixel is allocated to an object. An object is defined to be a set of neighbored foreground pixels. Thus, if a white (foreground) pixel is in direct neighborhood to another white pixel, they belong to the same object. Because of this data interpretation, the image shown in Figure 377, 'Objects Visualized by Colored Boxes' results in four objects.
If a pixel is interpreted as belonging to a specific object depends on the relation of the pixel to its neighbor pixels.
Each pixel I(u,v) of the binary image has four pixels in its neighborhood which are directly connected. This relation is called 4-connected neighborhood. If a foreground pixel I(u,v) has one or more other foreground pixels in its 4-connected neighborhood, the pixels belong to the same object.
Besides the direct neighborhood, a pixel can be connected to another pixel diagonally. This relation is called an 8-connected neighborhood:
The blob analysis operators can be parameterized to work with either 4-connected or 8-connected neighborhoods.
In general, an 8-connected neighborhood results in better object detection as even weakly connected objects are connected and edges are smoothened.
The image below shows a cutout of an image. On the left-hand side, the result of a blob analysis using a 4-connected neighborhood is displayed. On the right-hand side, the result of a blob analysis using an 8-connected neighborhood is displayed. (Object allocation is visualized via color.) The neighborhood parametrization (4-connected versus 8-connected) results in different allocations of pixels to objects: 4-connected neighborhood applied on the image results in six objects, whereas 8-connected neighborhood results in four objects only.
Figure 380. Pixels allocated to objects in a 4-connected neighborhood (left) and an 8-connected neighborhood (right). All colored pixels represent foreground pixels where their allocation to objects is visualized by differing colors.