The first figure is a set of images that shows the effects of the Fourier transform, fft2 in Scilab. The first is the original image, a 128 x 128 bitmap image from paint. The second is the output when fft2 is applied twice to the image. The result is an inverted circle. You won't notice much of a difference other than it appears to be lower than the original since the circle is not centered. the effect is more obvious in the second sample, the letter which is shown on the fourth and fifth image. The third and the last image are the result when applying the fft2 to the respective image once. It doesn't seem like much.
The next figure is the result of the convolution of the word NIP with an aperture. Again, the word appears is inverted since fft2 is applied twice. from left to right, the images are the result of increasing aperture size from radius 0.1 to 0.55.
blurred on purpose
The next figure is the result of template matching using correlation. The original image, the leftmost image is black text saying "THE RAIN IN SPAIN STAYS MAINLY IN THE PLAIN" on a white background. Again, this was done in paint saved as a 128x128 bitmap. A black letter 'A' was also saved in paint with the same settings, font and font size. What the code does is it finds letter A's in the phrase using correlation. It finds shapes in the first image that are similar to the second image. The result is still the blurred phrase wherein the letter As are less blurred. The third and fourth images are the same. I just tried if it would still work when the colors are inverted. Based on the result, it seems it does.
what does this phrase mean anyway?
The result is not exactly just purely letter As. The result of the correlation also contains some parts of the other letters since some parts of the letter A are also found in the other letters. I tried to remove the other letters by using the find function to remove lower values. The correlation of the letter A with the other letters are better exhibited here, in the third image of the figure below.
I guess if the Spanish plains are surrounded by mountains, clouds couldn't pass through...
The letter H, E and R contain a structure similar to the central part of the letter A and the letters N and M contains a similar triangular shape. That is why they are not completely removed from the image. For this to work perfectly, the template should be very different to all the other structures in the image. Otherwise, it would correlate to some degree and reduce the accuracy.
A short break before the edge detection. I think this post is one of the more serious in this blog. I can't think of anything funny to say. Probably, it would be better if the phrase used were more interesting. It could also be the mood as I write this. This is a sad day.. It also feels like I'm just pushing to finish everything on time and even not so late.
...
The next set of images are the result of edge detection using the built in convolution function in scilab, conv2. The image NIP was recycled for this. I just remembered that some of us used NIP instead of VIP since we are not part of the VIP lab. It just occurred to me that we use VIP which could also mean what we are doing and not the lab. Anyway, I'm proud to be an NIP student.. I think. From left to right, the patterns used were a horizontal line, a vertical line and a diagonal line. Personally, I think these are good results. The resulting images only show the parts of the letters that contain the pattern used.
a few shades of gray
I also tried it on the Spanish rain phrase as a measly attempt to 'extend the learning'. The results also appear fine. The first image shows horizontal lines clear enough to be distinguished. Similarly the vertical lines are obvious in the second image and diagonal lines in the third.
I called the phrase "Spanish rain" for short
Credits to Floyd for telling me about the conv2 function in Scilab and to Alix for a few syntax help and other bits of information such as to use the mat2gray function. Lesser credits to Chester for rearranging my Scilab console even if I didn't ask. I appreciate it :)
I would like to give myself an 11 since I believe I was able to do everything required and extend it a bit further. I would also like to encourage myself for completing this blog before the deadline. It is exactly 12 noon of July 11, 2013 as I'm typing this sentence.
No comments:
Post a Comment