written 6.0 years ago by |
Thinning is a morphological operation that is used to remove selected foreground pixels from binary images, somewhat like erosion or opening. It can be used for several applications, but is particularly useful for skeletonization.
In this mode it is commonly used to tidy up the output of edge detectors by reducing all lines to single pixel thickness.
Thinning is normally only applied to binary images, and produces another binary image as output.
The thinning operation is related to the hit-and-miss transform, and so it is helpful to have an understanding of that operator before reading on.
How It Works
- Like other morphological operators, the behavior of the thinning operation is determined by a structuring element.
- The binary structuring elements used for thinning are of the extended type described under the hit-and-miss transform (i.e. they can contain both ones and zeros).
The thinning operation is related to the hit-and-miss transform and can be expressed quite simply in terms of it. The thinning of an image I by a structuring element J is:
thin(I,J) = I - hit and miss(I,J)
where the subtraction is a logical subtraction defined by
X - Y = X ∩ NOT Y
- In everyday terms, the thinning operation is calculated by translating the origin of the structuring element to each possible pixel position in the image, and at each such position comparing it with the underlying image pixels.
- If the foreground and background pixels in the structuring element exactly match foreground and background pixels in the image, then the image pixel underneath the origin of the structuring element is set to background (zero). Otherwise it is left unchanged.
- Note that the structuring element must always have a one or a blank at its origin if it is to have any effect.
- The choice of structuring element determines under what situations a foreground pixel will be set to background, and hence it determines the application for the thinning operation.
- We have described the effects of a single pass of a thinning operation over the image. In fact, the operator is normally applied repeatedly until it causes no further changes to the image (i.e. until convergence).
- Alternatively, in some applications, e.g. pruning, the operations may only be applied for a limited number of iterations.
- Thinning is the dual of thickening, i.e. thickening the foreground is equivalent to thinning the background.
Figure 44