The same principles of the simplest binary top hat can be used in the case of gray-level images. The advantages of using the top hat for segmentation when compared with normal thresholding techniques is that the top hat can be very robust against non-uniform background.
The goal in this experiment is to segment the foreground numbers which are on a non-uniform background. This image is a synthetic one and was made to illustrate the power of the gray-scale top hat.
Below we show the original image and the result of a simple thresholding technique. As the overall illumination of the image is not uniform, we get the numbers properly segment in just one portion of the image.
|
|
|---|---|
| a) | b) |
The opening of the original image recovers the uneven background and the resultant top hat just shows the segmented numbers.
|
|
|---|---|
| a) | b) |