Non-Destructive Inspection - Examples

Count Rebars

Count Rebars

Recipe Images


In this example, rebars are counted. As the light box is highlighting the round surface at the end of every piece, a first threshold is applied.
The threshold allows to discard all the irrelevant information in the image, in this case all that's not a rebar's surface, so the background.

Count Rebars Threshold

These white spots are called blobs. To find and isolate these white spots, which will allow to count them, the "contours" are calculated.
The contours are the borders of a blob. It's very easy to find the borders of a blob after a threshold.
A filter on the contour area is applied, to avoid to pick up noise.

Count Rebars Contours

The number of rebars is simply the number of these contours.

Note: the center of the blob (moment) can be retrieved, and this can be useful for a multitude of applications, for example a pick and place with the help of a robot.

Count Rebars (Advanced)

Count Rebars Original Image

Recipe Images


While the previous algorithm works well when the rebars are far apart from each other, it won't work if the rebars are touching.
The blob (the white spot) from two adiacent rebars will appear as one. Then the calculated contour will be the merge of the two, like in the following image.

Count Rebars (Advanced)

To solve this, a distance transform can be applied, which returns an image where each pixel is the distance to the nearest background pixel.

Count Rebars Distance Transform

When a threshold is applied, single rebars blobs emerge:

Count Rebars Distance Transform Threshed

Here they can be easily counted.

Washer Diameters

Washer Diameters

Recipe Images


In this example, the inner and the outer diameter of a washer is measured.
Here, the Hough Circles algorithm is applied (theory).

The algorithm is applied twice, for the inner and outer diameter.

In the image above, there is the list of circles found in the image, and the fields represents:

Also, the circle is plotted in the image.

Note: this also works if there are two washers in a single image.

Washer Diameters - Two Washers