In MM [TOC], the gray-level images are considered as a stack of binary images, what they called level sets. Here is a small demonstration using ImageJ and an application to dilation.
Mathematical Morphology (MM) only uses binary images. However, it is possible to use the same functions with gray-level images by decomposing them into a series of binary images (called level sets).
Fig. 1: A 256x256 8-bit image of Lena with 32 gray levels |
Plugins>3D>Interactive 3D Surface Plot
as a height map as shown in Fig. 2.Fig.2: Height map of the image of Fig. 1 rendered with a thermal LUT. The highest pixel values are colored in red whereas the lowest in dark blue. |
Thus, Lena can be decomposed into a series of binary images corresponding to different threshold values. The following script iteratively thresholds a copy (duplicate) of the input gray-level image and paste the resulting thresholded image into an output stack (Fig. 3).
+++ IJ snippet: morpho_level_sets.ijm +++
+++ End of IJ snippet +++
+++ End of IJ snippet +++
From the stack, it is easy to recover the gray-level image by adding all the slices (
Image>Stacks>Z Project...
and choose 'Sum Slices').Fig. 3: Decomposition of Lena into level sets. |
Process>Binary>Dilate...
) ... and sum all the slices (Fig. 4B). In parallel, apply three times a 3x3 maximum filters (radius = 1.0) to the gray-level image of Fig. 1. This filter is equivalent to a dilation for gray-level images [Link].Fig. 4: Result of: A) three Maximum filters with a radius = 1 applied to the image of Fig. 1 and B) three dilations of the level sets. |
In conclusion, it is possible to work with gray-level images in mathematical morphology, you have to first transform these images into level sets.
No comments:
Post a Comment