Thursday, August 6, 2009

Activity 10: Preprocessing Text

For this activity, we were asked to extract handwritten text from an imaged document with lines. The given image is shown below.

Observe that the image is rotated (the lines are not horizontal and is tilted by some angle). To be able to tilt the image such that horizontal lines are horizontal, the function mogrify was used. This resulted to the image below.

After rotating the image, a small portion containing of it was cropped.

Since we want to extract the text, what should be done first is to remove the lines in the image. To be able to do that the Fourier transform of the cropped image was calculated.

Equipped with the knowledge of the previous activities (activity 6 and 7), a filter was created using Gimp to block the frequencies of the lines.

We know from Fourier optics that the frequencies of horizontal lines can be found in a vertical region in the Fourier space. Knowing this, a filter as shown above was created. Notice that the center of the Fourier transform was not blocked. This is because this region contains large amount of information, not only of the lines but the texts as well.

Applying the the created filter and inverting the image resulted to..

The image was then binarized using thresholding,

Notice that the image contains noise, for it to be "clean" morphological operations must be applied. This is done by applying erosion and dilation to the image.


Then afterwards it was thinned to be a pixel thick. This was done by applying the thin function in Scilab.


Lastly, the occurrence of the the word DESCRIPTION was located using the correlation. This was done by creating a binarized image of the same size of the text with the word correlation as the object.The word DESCRIPTION was created with font Arial and a fontsize of 11.


In the image above white signifies high correlation. As can be observe, the locations of the word description was located however locations of other text as well.

For this activity, I'm giving myself a grade of 8. This is because I know I could have done more image processing to obtain better results. However, I was not able to do so because of the time constraint.

I thank Irene and all my classmates who discussed with me this activity.

No comments:

Post a Comment