Tuesday, September 21, 2010

Entry 15: Morphological Operations

Morphological operations are methods in transforming an image by using a specific structuring element to yield desired formation in the image.  This technique is widely used in image processing to produce a more easy-to-handle image.

Two main morphological operations are used in this activity which are the dilate and the erode operations.

The erode operation is defined mathematically as,


this means that every points in B must be contained in A so that the value in A where the origin of B is located will attain a value, else, a zero value will be assigned to that B location.

Graphically it can be illustrated by the image below.


The dilate operation on the other hand is defined mathematically as,


the implication of this equation is that when B covers a location in the background, provided that the origin of B is contained in A, then the background region covered by B will take the value of the foreground.

An illustration is shown by the image below.



Below (Fig. 1) are the images to be structured and (Fig. 2) are the structuring elements used.

Figure 1:  Images to be structured.

Figure 2:  Structuring elements used in the process.

In the succeeding images, we show the results of dilating the original images (Fig. 1) with the strels (Fig. 2).

Figure 3:  Dilated images using a 1x2 strel.

Figure 4:  Dilated images using a decreasing diagonal strel.

Figure 5:  Dilated images using a 2x1 strel.

Figure 6:  Dilated images using an increasing diagonal strel.

Figure 7:  Dilated images using a 2x2 strel.
Figure 8:  Dilated images using a cross strel.

After determining the dilated images, we tried another morphological operation which is erosion.  The images below are the eroded original (Fig. 1) images using the strels in Fig. 2.


Figure 9:  Eroded images using a 1x2 strel.

Figure 10:  Eroded images using a decreasing diagonal strel.

Figure 11:  Eroded images using a 2x1 strel.

Figure 12:  Eroded images using an increasing diagonal strel.

Figure 13:  Eroded images using a 2x2 strel.

Figure 14:  Eroded images using a cross strel.
Morphological operations can be applied to different image processing problems to simplify them.  The usefulness of these operations depend on the user.

In this activity I would rate myself a grade of 10/10.

Source:
    Activity Sheet for Activity 9 - Dr. Maricor Soriano



Entry 14: Enhancement in the Frequency Domain

Speaker: Fourier transform enables us to travel across dimensions!  

Audience: How?!!!

Speaker: It's because Fourier transform empowers us to see the world of the inverse dimensions!

Audience: Ok...


This activity emphasizes the power of Fourier Transform (FT) in various applications.  To be discussed here are the simple exercises made to get a better idea on how FT changes some properties of our object.  Also, a major application of FT will be included here which is about using FT in cleaning digital finger print images.  The application of FT in filtering repetitive patterns of "noise" in painting due to its canvas weave and removal of vertical lines in a photograph was used to correct these issues and to produce a better image.

So we first simulated the action of FT on basic patterns as shown in the FT pairs below (Fig. 1).

FIgure 1:  Fourier Transform pair of different basic patterns (symmetric dots, symmetric circles and symmetric squares).

Also the FT pair of the Gaussian pattern was simulated.

In the next section, we performed enhancement of a fingerprint image using filtering techniques in the Fourier space of the image.  The image of the fingerprint is shown in Fig. 2,

Figure 2:  Original image of the fingerprint to be "cleaned".

To start filtering, we first identify how the frequency world of the fingerprint image look like so that we can identify the proper filtering mask to use to discriminate unwanted information in the image.

In Fig. 3, the FT of the fingerprint image is shown which reveals the nature of the frequency of the information in the image.

Figure 3:  Fourier Transform of the fingerprint image which shows the frequency component of the image.

We realize based from the information from Fig. 3 that the frequency of the information relevant to the fingerprint is not well distinguishable from the noise so we chose a smoothing mask to use to smoothen the noise in the image and from that smoothened image, we can do thresholding to determine the actual fingerprint image discriminating the noise.

We show in Fig. 4 the mask used to filter the fingerprint image.  The mask is composed of two Gaussian functions, one with a very small variance to facilitate the filtering of the DC component and the other Gaussian filter is responsible to discriminating the noise of high frequencies.

Figure 4:  Double Gaussian filter to clean the fingerprint image.  Sigma used are 0.0001 and 18 to filter the DC and high frequency components of the noise.

After applying the filter to the original fingerprint image, we now have the smoothened/filtered version.  The result is shown in Fig. 5.

Figure 5:  Left) Filtered image using the double Gaussian filter, Right) Thresholded filtered image showing the significant details of the fingerprint showing that the noise were wiped out.

Also shown in Fig. 5 is the final filtered image of the fingerprint.  After taking the smoothened image, we applied thresholding to it to wipe away any traces of noise in the background to only leave the significant components constituting the fingerprint.

The next task is to remove vertical artifacts from one of the images of the moon's surface (Fig. 6).  It was said in the image details that the artifact was due to the concatenation of individual framelets to make the entire image [1].

Figure 6:  Original image of the moon's surface with evident vertical lines.

To start the process of filtering the vertical lines in the image, we first converted the image into a grayscale version and took the FT of it to reveal the frequency values in the image (Fig. 7 - Left).

Figure 7:  Left) Fourier Transform of the grayscaled moon image showing repetitive dots along the x-axis, Right) Filtering mask used to remove the vertical lines.

From our Activity 7, we learned that the FT of vertical lines correspond to a series of dots in the x-axis of the frequency space.  Thus we made a filtering object that masks the points where the information relating to the vertical lines were located (Fig. 7 - Right).

After applying the mask to the image's FT and going back to the linear domain, we produce the filtered form of the image.  In Fig. 8, shown are the original image along with the filtered image of the moon.

Figure 8:  Left) Original grayscale image of the moon with evident vertical lines, Right) Filtered image wherein the vertical lines were removed.

Lastly, we performed the same method to a painting.  The task is to remove the effect of the canvas weave on the image.  The original image is shown in Fig. 9.

Figure 9:  Original image of the painting with very obvious canvas weave pattern.

We get the grascale of the image of the painting and took the FT of it to reveal the localized high valued frequencies.  Localized high valued frequencies can be thought to carry the information of the frequently occurring canvass weave pattern and there we based the mask to be used for filtering.  The FT of the image and the mask is shown in Fig. 10.

Figure 10:  Left) FT of the painting image showing localized high valued frequency, Right) Mask developed to filter the canvass weave pattern.

After applying the mask to the FT of the image and returning back to the linear domain, we get the filtered image wherein the canvass weave pattern can no longer be seen.  In Fig. 11, shown side by side are the original grayscaled image of the painting along with the filtered image.

Figure 11:  Left) Original grayscaled image of the painting, Right) Filtered painting showing no signs of the canvass weave pattern.

The last thing we did in this activity is to show the image of the mask used in linear domain.  We can see in Fig. 12 the similarity of the linear domain version of the mask used to the canvass weave pattern.

Figure 12:  Linear domain version of the mask used in the filtering of the painting.

In this activity I would give myself a 10/10 for the dedication and the learning I had during this activity.

Source:
    [1]  Activity Sheet for Activity 8 - Dr. Maricor Soriano

Entry 13: Properties of the 2D Fourier Transform

In this activity, we explored the properties of the 2D Fourier Transform (FT).  The main goal of this activity is to have a nice grasp of the ideas and the actions of FT to a subject image.

Two sections were dedicated in this activity.  The first about familiarization of FT of different  2D patterns while the second section was about anamorphic property of the FT.

Figure 1: Fourier Transform pairs of basic patterns.


In Fig. 1, the FT of the basic figures in the top most layer are shown in the bottom.

The corresponding images are called FT pairs.  It is also useful to know that the FT of the image's FT will yield the original image.

The second section about the anamorphic property of FT when applied on 2D images was then studied.  When we say anamorphic property, it refers to producing different optical imaging effects along mutually perpendicular radii.

Figure 2: Anamorphic property of Fourier Transform.  Shown here are the resulting Fourier Transforms of each sinusoidal images of varying parameters and conditions.
In Fig. 2, we see the FT's of different sinusoidal patterns.  On the first column, the FT pair of a sinusoid along the x-axis with frequency equal to 1 Hz is shown.  The second column displays the FT pair of sinusoid along the x-axis with frequency equal to 4 Hz. Observe that the FT of the sinusoid with frequency equals 1 are symmetric dots about the origin of the fx-axis located 1 unit away while the FT of the sinusoid with frequency equals 4 is depicted by symmetric dots about the origin along the fx-axis located 4 units away.  From this observation, we can infer that the signal's frequency are projected in the frequency space after the application of FT.

Figure 3:  Effects of DC bias and bias with frequency on a sinusoidal signal and their corresponding Fourier Transforms.
In Fig. 3, we show the effects of DC bias and bias with frequency to the Fourier Transform of each original sinusoidal image.  The FT of the DC-biased sinusoidal signal is characterized by a pair of symmetric dots indicating the principal frequency of the signal and a dot in the center.  The dot in the center is the constant carrier signal "DC".  This behavior depicts the mathematical form of the FT of a constant value which is equal to a Dirac delta at 0.


In this activity I would give myself a 10/10 for a completeness.

Source:
    Activity Sheet for Activity 7 - Dr. Maricor Soriano