next up previous contents
Next: Watershed Transform Applied to Up: Watershed Transform Previous: Erosion and Dilation of   Contents

Top-Hat and Bottom-Hat Filters

If the intensity values in a gray-level image are thought of as elevations, then a scene is composed of mountain tops (brightest points) and valley lows (darkest regions). Uneven contrast in a photo will often degrade threshold isolation of adjacent mountain tops between a valley. To remedy this problem, an open top-hat filter $ I \hat {\circ} S = I-I {\circ} S$ is used to enhance bright (i.e., high) points and a closing top-hat filter $ I \hat {\bullet} S = I {\bullet} S - I$ is used to enhance the valleys.

Figure 12.5 illustrates how a top-hat filter preserves sharp peaks and eliminates other features, including the poor contrast features. The initial erosion will $shave$ off the sharp peaks of the mountains if the structuring element honors the "Goldilocks" rule: a bit wider than the widths of the sharp peaks but much smaller than the mountains. The next operation of dilation reconstructs the mountains without the sharp peaks. And subtraction of the original image from the opening gives the top-hat filtered image, the sharp peaks only.

In a similar manner, Figure 12.6 illustrates how a closing top-hat filter highlights sharp valley bottoms. For convenience I will refer to open top-hat filters as top-hat filters and closing top-hat filters as bottom-hat filters.

Figure 12.5: Image $I$ is a chain of mountains with poor contrast between leftside peaks and rightside valleys. Erosion shaves off the peaks, dilation reconstructs the mountains without the sharp peaks. Subtraction from the original images produces the peaks only. The poor contrast lighting conditions have been eliminated with the top-hat filter results at the bottom.
\begin{figure}\centering\psfig{figure=/uufs/geophys.utah.edu/common/utamfs/sjm/03tmp/jerry_water/fig/ch7.top.ps,width=5.0in,height=3.0in,angle=-90}\end{figure}

Figure 12.6: Image $I$ is a chain of valleys with poor contrast. Dilation shaves off the sharp bottoms of valleys, erosion reconstructs the valleys without the sharp bottoms. Subtraction from the original images produces the inverted bottoms only.
\begin{figure}\centering\psfig{figure=/uufs/geophys.utah.edu/common/utamfs/sjm/03tmp/jerry_water/fig/ch7.bottom.ps,width=5.0in,height=3.0in,angle=-90}\end{figure}

To illustrate these properties, Figure 12.7a depicts an image of small pellets that have moderate contrast between the bright (middle of pellets) and dark parts (boundaries between pellets). We would like to increase this contrast to enhance segmentation between different pellets. The image $I$ was opened with a $3x3$ structuring element and then was subtracted from $I$ to give the top-hat result in Figure 12.7b. The rapidly varying bright points in the pellets are enhanced while the gently varying intensities are suppressed. Opening will spatially enlarge the peaks by several pixels, so subtraction of the opening from the original image highlights elevation differences between neighboring pixels at the peaks of rugged mountains. A top-hat filter can be thought of as a conditional gradient that mostly highlights sharp gradients at mountain peaks.

Figure 12.7: Images of the (a). pellets, (b). top-hat filtered pellets $I\hat \circ S$, (c). bottom-hat filtered pellets $I\hat \bullet S$, and (d). $I + I\hat \circ S - I \hat \bullet S$. Note that the bottom-hat filtered image in (c). more clearly defines valleys and separations between pellets.
\begin{figure}\centering\psfig{figure=/uufs/geophys.utah.edu/common/utamfs/sjm/03tmp/jerry_water/fig/ch7.fig3a.ps,width=5.0in}\end{figure}

In a similar manner, closing the pellets image flattens the valley bottoms. Subtracting the closed image with the original image highlights the bottom parts of steep valleys. The bottom-hat filter applied to the pellets image is shown in Figure 12.7c, where the valley lows (boundaries between pellets) are highlighted. Again, the bottom-hat filter is similar to a conditional gradient filter, where gradients at the bottom of steep valleys are highlighted. Adding the top-hat and subtracting the bottom-hat transforms to the image results in Figure 12.7d.

A larger version of the pellet image is shown in Figure 12.8. It is obvious the contrast is enhanced by top-hat and bottom-hat filtered image in 12.8d. The histogram of the filtered image in 12.7f shows better contrast than the histogram of the original image in 12.7e.

Thresholding the top-hat and bottom-hat transforms can enhance their contrast properties. In Figure 12.9, top-hat pixels were zeroed out if their brightness value did not exceed the threshold of 15, otherwise their brightness value was amplified by a factor of 80. The threshold for the bottom-hat filter to darken valleys was set to 10. The final image in Figure 12.9d after thresholding of the top-bottom filter shows an improvement over the 12.8d image.

Figure 12.8: Images of the pellets and the top- and bottom-hat transforms. Histograms in bottom row show the better contrast due to the bottom-top hat transforms.
\begin{figure}\centering\psfig{figure=/uufs/geophys.utah.edu/common/utamfs/sjm/03tmp/jerry_water/fig/ch7.fig3.ps,width=5.0in,height=6.0in}\end{figure}

Figure 12.9: Top and bottom-filtered images with thresholding and amplification. Compare Figure 12.9d to Figures 12.8a and 12.8d
\begin{figure}\centering\psfig{figure=/uufs/geophys.utah.edu/common/utamfs/sjm/03tmp/jerry_water/fig/ch7.fig3b.ps,width=5.0in,height=3.0in}\end{figure}


next up previous contents
Next: Watershed Transform Applied to Up: Watershed Transform Previous: Erosion and Dilation of   Contents
Sheng Jian Ming 2003-10-21