|
Finding defects on an object

The original image is
a 24 bit per pixel X-ray image of porosity welding defects. The
small black holes on the image are the defects, and the light grey
area of the image is the welding itself. The goal is to detect
whether such defects are present or not, and if they are, find these
defects (positions, diameter, intensity distribution, etc.)
The most important step is to find the
exact positions of these defects. First try to segment the image
using a global thresholding (HistDIBThreshold in
BiFilter.Dll).
As the threshold value increase, the
number of defects found will also increase, but also the higher the
number of false detections that will occur. Therefore the threshold
value must be chosen carefully. Let’s see two examples.

The next step is to try to eliminate all noise from the image and
keep only the valid defect positions. Morphological filters are
excellent for accomplishing this, but binary morphological filters
work only for binary images. In order to use a binary morphological
filter, we must first reduce the original 24 bit image’s bit number
to 1 bit per pixel. To do this, use one of the dithering
functions (like Floyd-Steinberg dithering : DitherFS4 in
BiImage.Dll).
Now we must remove the black border on
the image in the following way: Remove all the porosity defects in
question by applying a binary dilation filter (BinaryDilation
in BiFilter.Dll) with a 6 times 6 all one structuring element (the
background is black).

Figure 4: Binary filtering with a 6
times 6 all one structuring function
The next step is to bit enlarge the
black region (the reason for this is because during the dilation
above, the area of the black regions were reduced). So let’s
erode the image with an 8 times 8, all one structuring function
(BinaryErosion in BiFilter.Dll, still the background is
black).

Figure 5: Binary erosion with an 8 times
8 all one structuring function
The final step is to combine the result
pictures (Figure 2 (or 3), and Figure 5). Let’s create the
inverse pictures of both and afterwards subtract (ArithmeticDIB
in BiFilter.Dll) Figure 5 from Figure 2.
 |