Skip to main content
deleted 9 characters in body
Source Link
bill s
  • 69.7k
  • 4
  • 103
  • 198

Taking the Fourier transform is easy and fun!

Let's strip away some of the complexities in order to look at what is going on. First, remove the color formfrom the image, since this just complicates things (you can always do ittake the same fortransform of each color channel separately).

img = ColorConvert[Import["ExampleData/lena.tif"], "Grayscale"];

Here are the magnitude and phase of the Fourier transform:

(abs = Abs[Fourier[ImageData[img]]]) // Image
(arg = Arg[Fourier[ImageData[img]]]) // Image

enter image description here

enter image description here

To invert these, use:

Chop[InverseFourier[(abs E^(I arg))]] // Image

enter image description here

which is the same as we started with. The Chop is needed because spurious (almost zero) complex numbers remain after the Inverse).

Notice how clear and concise this is... it's just taking Fourier of the image, taking the Abs and Arg to get the magnitude and phase images, and then reconstructing using InverseFourier on Abs*Exp[I Arg].

This is a bit simpler than usual. For one thing, the zero frequency is in the upper left hand corner (instead of the center, where one usually plots it). You can move this to the center using RotateLeft on the transformed image, or by multiplying in the spatial domain by +/-1^(i,j)+/-1^(i,j) as in Nasser's answer. Of course, then, to reconstruct, you have to rotate back. This also uses the default FourierParameters, which may or may not be exactly what you want.

Taking the Fourier transform is easy and fun!

Let's strip away some of the complexities in order to look at what is going on. First, remove the color form the image, since this just complicates things (you can always do it the same for each color channel).

img = ColorConvert[Import["ExampleData/lena.tif"], "Grayscale"];

Here are the magnitude and phase of the Fourier transform:

(abs = Abs[Fourier[ImageData[img]]]) // Image
(arg = Arg[Fourier[ImageData[img]]]) // Image

enter image description here

enter image description here

To invert these, use:

Chop[InverseFourier[(abs E^(I arg))]] // Image

enter image description here

which is the same as we started with. The Chop is needed because spurious (almost zero) complex numbers remain after the Inverse).

Notice how clear and concise this is... it's just taking Fourier of the image, taking the Abs and Arg to get the magnitude and phase images, and then reconstructing using InverseFourier on Abs*Exp[I Arg].

This is a bit simpler than usual. For one thing, the zero frequency is in the upper left hand corner (instead of the center, where one usually plots it). You can move this to the center using RotateLeft on the image, or by multiplying in the spatial domain by +/-1^(i,j) as in Nasser's answer. Of course, then, to reconstruct, you have to rotate back. This also uses the default FourierParameters, which may or may not be exactly what you want.

Taking the Fourier transform is easy and fun!

Let's strip away some of the complexities. First, remove the color from the image, since this just complicates things (you can always take the transform of each color channel separately).

img = ColorConvert[Import["ExampleData/lena.tif"], "Grayscale"];

Here are the magnitude and phase of the Fourier transform:

(abs = Abs[Fourier[ImageData[img]]]) // Image
(arg = Arg[Fourier[ImageData[img]]]) // Image

enter image description here

enter image description here

To invert these, use:

Chop[InverseFourier[(abs E^(I arg))]] // Image

enter image description here

which is the same as we started with. The Chop is needed because spurious (almost zero) complex numbers remain after the Inverse).

Notice how clear and concise this is... it's just taking Fourier of the image, taking the Abs and Arg to get the magnitude and phase images, and then reconstructing using InverseFourier on Abs*Exp[I Arg].

This is a bit simpler than usual. For one thing, the zero frequency is in the upper left hand corner (instead of the center, where one usually plots it). You can move this to the center using RotateLeft on the transformed image, or by multiplying in the spatial domain by +/-1^(i,j) as in Nasser's answer. Of course, then, to reconstruct, you have to rotate back. This also uses the default FourierParameters, which may or may not be exactly what you want.

added 49 characters in body
Source Link
bill s
  • 69.7k
  • 4
  • 103
  • 198

Taking the Fourier transform is easy and fun!

Let's strip away some of the complexities in order to look at what is going on more clearly. First, remove the color form the image, since this just complicates things (you can always do it the same for each color channel).

img = ColorConvert[Import["ExampleData/lena.tif"], "Grayscale"];

Here are the magnitude and phase of the Fourier transform:

(abs = Abs[Fourier[ImageData[img]]]) // Image
(arg = Arg[Fourier[ImageData[img]]]) // Image

enter image description here

enter image description here

To invert these, use:

Chop[InverseFourier[(abs E^(I arg))]] // Image

enter image description here

which is the same as we started with. The Chop is needed because spurious (almost zero) complex numbers remain after the Inverse).

Notice how clear and concise this is... it's just taking Fourier of the image, taking the Abs and Arg to get the magnitude and phase images, and then reconstructing using InverseFourier on Abs*Exp[I Arg].

This is a bit simpler than usual. For one thing, the zero frequency is in the upper left hand corner (instead of the center, where one usually plots it). You can move this to the center using RotateLeft on the image, or by multiplying in the spatial domain by +/-1^(i,j) as in Nasser's answer. Of course, then, to reconstruct, you have to rotate back. This also uses the default FourierParameters, which may or may not be exactly what you want.

Let's strip away some of the complexities in order to look at what is going on more clearly. First, remove the color form the image, since this just complicates things (you can always do it the same for each color channel).

img = ColorConvert[Import["ExampleData/lena.tif"], "Grayscale"];

Here are the magnitude and phase of the Fourier transform:

(abs = Abs[Fourier[ImageData[img]]]) // Image
(arg = Arg[Fourier[ImageData[img]]]) // Image

enter image description here

enter image description here

To invert these, use:

Chop[InverseFourier[(abs E^(I arg))]] // Image

enter image description here

which is the same as we started with. The Chop is needed because spurious (almost zero) complex numbers remain after the Inverse).

Notice how clear and concise this is... it's just taking Fourier of the image, taking the Abs and Arg to get the magnitude and phase images, and then reconstructing using InverseFourier on Abs*Exp[I Arg].

This is a bit simpler than usual. For one thing, the zero frequency is in the upper left hand corner (instead of the center, where one usually plots it). You can move this to the center using RotateLeft on the image, or by multiplying in the spatial domain by +/-1^(i,j) as in Nasser's answer. Of course, then, to reconstruct, you have to rotate back.

Taking the Fourier transform is easy and fun!

Let's strip away some of the complexities in order to look at what is going on. First, remove the color form the image, since this just complicates things (you can always do it the same for each color channel).

img = ColorConvert[Import["ExampleData/lena.tif"], "Grayscale"];

Here are the magnitude and phase of the Fourier transform:

(abs = Abs[Fourier[ImageData[img]]]) // Image
(arg = Arg[Fourier[ImageData[img]]]) // Image

enter image description here

enter image description here

To invert these, use:

Chop[InverseFourier[(abs E^(I arg))]] // Image

enter image description here

which is the same as we started with. The Chop is needed because spurious (almost zero) complex numbers remain after the Inverse).

Notice how clear and concise this is... it's just taking Fourier of the image, taking the Abs and Arg to get the magnitude and phase images, and then reconstructing using InverseFourier on Abs*Exp[I Arg].

This is a bit simpler than usual. For one thing, the zero frequency is in the upper left hand corner (instead of the center, where one usually plots it). You can move this to the center using RotateLeft on the image, or by multiplying in the spatial domain by +/-1^(i,j) as in Nasser's answer. Of course, then, to reconstruct, you have to rotate back. This also uses the default FourierParameters, which may or may not be exactly what you want.

added 101 characters in body
Source Link
bill s
  • 69.7k
  • 4
  • 103
  • 198

Let's strip away some of the complexities in order to look at what is going on more clearly. First, remove the color form the image, since this just complicates things (you can always do it the same for each color channel).

img = ColorConvert[Import["ExampleData/lena.tif"], "Grayscale"];

Here are the magnitude and phase of the Fourier transform:

(abs = Abs[Fourier[ImageData[img]]]) // Image
(arg = Arg[Fourier[ImageData[img]]]) // Image

enter image description here

enter image description here

To invert these, use:

Chop[InverseFourier[(abs E^(I arg))]] // Image

enter image description here

which is the same as we started with. The Chop is needed because spurious (almost zero) complex numbers remain after the Inverse).

Notice how clear and concise this wasis... it's just taking Fourier of the image, taking the Abs and Arg to get the magnitude and phase images, and then reconstructing using InverseFourier on Abs*Exp{IAbs*Exp[I Arg].

This is a bit simpler than usual. For one thing, the zero frequency is in the upper left hand corner (instead of the center, where one usually plots it). You can move this to the center using RotateLeft on the image, or by multiplying in the spatial domain by +/-1^(i,j) as in Nasser's answer. Of course, then, to reconstruct, you have to rotate back.

Let's strip away some of the complexities in order to look at what is going on more clearly. First, remove the color form the image, since this just complicates things (you can always do it the same for each color channel).

img = ColorConvert[Import["ExampleData/lena.tif"], "Grayscale"];

Here are the magnitude and phase of the Fourier transform:

(abs = Abs[Fourier[ImageData[img]]]) // Image
(arg = Arg[Fourier[ImageData[img]]]) // Image

enter image description here

enter image description here

To invert these, use:

Chop[InverseFourier[(abs E^(I arg))]] // Image

enter image description here

which is the same as we started with.

Notice how clear and concise this was... it's just taking Fourier of the image, taking the Abs and Arg to get the magnitude and phase, and then reconstructing using InverseFourier on Abs*Exp{I Arg].

This is a bit simpler than usual. For one thing, the zero frequency is in the upper left hand corner (instead of the center, where one usually plots it). You can move this to the center using RotateLeft on the image, or by multiplying in the spatial domain by +/-1^(i,j) as in Nasser's answer. Of course, then, to reconstruct, you have to rotate back.

Let's strip away some of the complexities in order to look at what is going on more clearly. First, remove the color form the image, since this just complicates things (you can always do it the same for each color channel).

img = ColorConvert[Import["ExampleData/lena.tif"], "Grayscale"];

Here are the magnitude and phase of the Fourier transform:

(abs = Abs[Fourier[ImageData[img]]]) // Image
(arg = Arg[Fourier[ImageData[img]]]) // Image

enter image description here

enter image description here

To invert these, use:

Chop[InverseFourier[(abs E^(I arg))]] // Image

enter image description here

which is the same as we started with. The Chop is needed because spurious (almost zero) complex numbers remain after the Inverse).

Notice how clear and concise this is... it's just taking Fourier of the image, taking the Abs and Arg to get the magnitude and phase images, and then reconstructing using InverseFourier on Abs*Exp[I Arg].

This is a bit simpler than usual. For one thing, the zero frequency is in the upper left hand corner (instead of the center, where one usually plots it). You can move this to the center using RotateLeft on the image, or by multiplying in the spatial domain by +/-1^(i,j) as in Nasser's answer. Of course, then, to reconstruct, you have to rotate back.

Source Link
bill s
  • 69.7k
  • 4
  • 103
  • 198
Loading