In the Spring of 2014, I completed a very enjoyable audio compression project in Math 447. It is available on my homepage, listed as "A Simple Audio Codec." In this project, I had the choice between compressing an audio or image file. I choose the audio option, and I am now going to investigate image compression and manipulation. For better or for worse, I have chosen to do this with an image of myself. I am very interested in Fourier Analysis and Wavelets, and image compression will let me futher my studies of these two very rewarding fields.
To start with, I am currently reading the book "A Wavelet Tour of Signal Processing the Sparse Way," by Stephane Mallat. Very conveniently, he has a website with informative links and most importantly, Matlab code! This is invaluable for someone like myself, as it spares me the task of implementing operations in Matlab. The link to the code is listed below:
Valuable Links Here
The so-called tours are made by Gabriel Peyrè, who was a student of his. He is responsible for ALL of the code that has enabled me to further my independent study. I owe him much gratitude!
Prior to this, I have zero experience with image compression or manipulation. To get started, with the help of Mr. Peyrè's code and tutorials, I am going to do some simple manipulations to the image of myself. This image can be seen in it's original form Here
In the first plot below, one sees the original image of myself. Next to the picture, is a randomly selected zoomed in part of the same picture. One can see some pixelated tree branches and leaves.
I state again, this was generated with Mr. Peyrè's code, not mine.
Moving forward, more manipulations are implemented. The first image on the bottom left is the -1 * the original image. The image to the right is flipped upside down using the flipdim function in Matlab.
Next, the image is convolved with a low-pass filter which yields a blurry image. By convolving the image with a low pass filter, one loses the higher frequencies of the image. From this, one can conclude that the higher frequencies add more detail to an image. It takes higher oscillations (frequencies) to produce the finer details of the image.
Continuing on, we next take another look at the original image, alongside its shifted Fourier Transform. The shifted Fourier Transform places the zero in the center of the spectrum. This function was written by Mr. Peyre.
At this point, Mr. Peyre asks us to use a window function to remove the artifacts from the image so one can determine the true frequency content of the image. Thankfully, he provides the code for this as well. A plot of the window function is given below. To simplify things, I converted the original image to grayscale and then proceeded with the filtering. I have also made the image a square of dimensions 500 x 500.
As of now, I am not sure of what kind of filter this is. It appears to completely remove everything outside of a circle centered in the center of the image.
Another low pass filter is implemented via simply removing higher frequencies from the Spectrum. This filter is not as severe as the blurry one that was previously seen.
Lastly, image interpolation is briefly investigated. This is done by adding higher frequencies to spectrum of a transformed image. Mr. Peyrè does this by importing a smaller dimensioned image FFT into a larger dimensioned image FFT. This results in a matrix with entries in it's early columns and rows, but elsewhere, it is entirely zeros. Then, Mr. Peyrè takes the real part of the inverse FFT which results in values where there were previously zeros. This represents a method of zero padding, which I have seen used for interpolating functions as well, i.e., adding more points in order to help with smoothness. Unfortuntely, the resulting image is not very exciting, as it is a zoomed in section of my shirt. The interpolation does make it less pixelated though.
Mr. Peyrè also offers an improvement of the previous method above - this entails using a cubic spline. He says that the spline is an improvement because, "the spline has a smaller support with less oscillations." (1)
I am not sure that the spline result looks better than the Fourier one. The example on Mr. Peyrè's website is much better. Not surprisingly, zooming in on my silver Polo shirt is not a great example to analyze. In Mr. Peyre's example, the image with the spline is noticeably more clear.
This represents my first experience in image manipulation. Mr. Peyrè's website and code was extremely helpful in building my intuition with this subject. Most of these so-called manipulations were rather simple. The real fun is going to start in the next section, when futher analysis of the image is done with Fourier and Wavelets!
Works Cited
(1) Peyrè, Gabriel. "Introduction to Image Processing." Introduction to Image Processing. N.p., 2008. Web. 22 May 2014. https://www.ceremade.dauphine.fr/~peyre/numerical-tour/tours/introduction_3_image/
G. Peyré, The Numerical Tours of Signal Processing - Advanced Computational Signal and Image Processing, IEEE Computing in Science and Engineering, vol. 13(4), pp. 94-97, 2011.