Thursday, August 6, 2009

ACTIVITY 10 - Processing Text

This activity aims to extract handwritten text from an imaged document with lines. In order for the handwriting to be recognized, individual letters must be extracted. We will again use all the image processing techniques we have learned.

The image below will be utilized for this activity.
A portion of the image was cropped with handwritten text together with lines in the form.
We can see from the horizontal lines that the image is tilted. With the use of mogrify function which is built-in function is Scilab, the image was rotated. The image below shows the rotated image.
Now that we have rotated the image, we will have to remove the horizontal lines from the form using image processing techniques. First we have to display the FT of the image in logarithmic form. In doing this we will have the idea where the frequencies of the horizontal lines lie, just like in the previous activities. We will design the filtering mask by blocking the frequencies the correspond to the unwanted horizontal pattern.








The image at the left is the FT of the image in logarithmic form and the image at the right shows the filtering image. We can see on the filter how we are able to block the frequencies of the horizontal line. The resulting image is shown below.
This image resulted from the filtering technique applied to the cropped portion of the original image. After the removal of the horizontal lines, the image was then inverted. We notice that the background becomes black and the texts become white. This was done in able for us to use the morphological operations we have learned. We recall that these operations applies only to the "white" portion of the image which is our object.

But before implementing morphological operation, we have to binarize the image first. We look for the best threshold such that the object is well separated with the background. And then, the dilate and erode functions were used. The combination of the two operations were done until the best extraction of the texts was produced.
The image above shows the final extraction of the text image. From this image, we can see the significant separation of each text in the word "remote control". The rest of the words, although the letters are being separated from each other somehow, are still unrecognizable. From the beginning, we have a very poor image. We can compare the separation of the letters by counting the number of blobs produced using the bwlabel function. Supposedly, there are 46 letters in the cropped portion of the image. The number of blobs produced after doing image processing techniques was found to be 31. Thus, the image processing techniques applied to the image has a significant effects on the separation of each text.
-------------------------------------------------------------------------------------------------
In this part, we will use the template matching technique we have learned in Activity 6.C to find the instances of the word "DESCRIPTION" in the whole image.

First, we binarize the whole image and find the best threshold. Then we cropped the word DESCRIPTION from the image and pasted it on a black background with the same size as the image which will be our template.




















And then the correlation technique was applied. The FT of the template was multiplied with the conjugate of the FT of the image. Then the fftshift of the product was taken.
The image above shows three instances of the word DESCRIPTION in the image which is what we have expected. We can see these instances from the bright spots where the correlation is high.

I want to give myself a grade of 9 in this activity. Although I have used the image processing techniques I have learned, I was not able to come up with a more enhanced text image. Again, Gilbert was acknowledged for this activity.

No comments:

Post a Comment