Dilate black pixels filter

Use this filter to dilate black objects (like bars) to horizontal and vertical directions by the specified number of pixels (dilation depth).

This can enhance recognition of barcode images which are distorted by big amounts of white pixels due to scanning defects. However, barcodes may be surrounded by frames or other black objects, and barcode elements may become merged with these objects after being processed with this method. This may impede recognition. To prevent this, the specified dilation depth should be less than the half of the width of the white boundary between the barcode and the frame.

Enter minimum and maximum values for the dilation depth.

If the maximum value differs from the minimum value, the component tries to recognize barcodes for every value from the specified interval. For example, if the minimum value is 1 and the maximum value is 2, at the first attempt the component does not dilate black objects (as if this preprocessing method was not used), on the second attempt the component dilates black objects of 1 pixel, and finally, on the third attempt, the component dilates black objects of 2 pixels.

Thus, specifying different values for the maximum and minimum values allows more variations of image preprocessing before barcodes detection. However, this may slow down the recognition as the number of recognition attempts increases.

The figures illustrate this preprocessing method.

Figure 1. Image before preprocessing
Figure 2. Image after preprocessing