(*This is an image processing demonstration. We'll load a picture of my cat (Mona) and take her Fourier transform. Then we'll operate on the Fourier transform in order to adjust the contrast of her picture. You can replace her picture with any image and do it yourself.*)

(*Change the working directory to wherever your picture is.*)
SetDirectory["UserDirectory"];

(*Import the image and extract the data from it.*)
Mona=Import["Mona.jpg",ImageSize->400]
data=ImageData[Mona];

(*Now let's take her Fourier transform. Use Chop to throw away small imaginary parts.*)
fMona=Chop[Fourier[data]];

(*Mathematica has a built-in command for plotting the Fourier data of an image. It scales the data in order to make it easier to interpret, so we'll just use it.*)
ImagePeriodogram[Mona]

(*Let's take the chance to demonstrate the invertibility of the Fourier transform.*)
data2=InverseFourier[fMona];
Image[Chop@data2]

(*Great. We took a really roundabout way of getting our picture back. We should try to do something interesting with it. We'll start with brightness.*)
fbright=2*fMona;
bright=InverseFourier[fbright];
Image[Chop@bright]

(*Since the magnitude of a Fourier coefficient controls how much that frequency contributes to the overall signal (in this case, how brightly it shines), it's not too surprising that doubling the Fourier coefficients will brighten the picture.*)

(*Let's try something more interesting. If we alter how brightly certain frequencies shine relative to each other,maybe we can transform the picture in a less uniform way.*)
mag=Abs[fMona];
fblur=3*mag^(-0.75)*fMona;
blur=InverseFourier[Chop@fblur];
Image[Chop@blur]

(*We've arranged things so that the high frequencies contribute more to the image, and we've dampened the low frequencies. This creates higher contrast in the image. (We've also brightened by a factor of 3 to make the picture more visible.*)

(*If we scale down the brightness and add this back to the original image, we get higher contrast version of the original.*)
hicontrast=0.25*Chop[blur]+data;
Image[hicontrast]

(*Now we'll try altering the frequencies with an exponential.*)
fblur2=Exp[-0.5*mag]*fMona;
blur2=InverseFourier[Chop@fblur2];
Image[7*Chop@blur2]

(*Once again, let's try adding this back to the original while scaling the brightness accordingly.*)
kitty=4*blur2+data;
Image[Chop@kitty]