Performing an Inverse Fourier Transform¶
This code snippet shows how to compute the inverse Fourier transform to get the original grayscale image (from the frequency domain to the spatial domain).
C++¶
#include <eVision/EasyImage/EFourierTransformer.h>
using namespace eVision;
int width = 256;
int height = 256;
// Assuming you have the following loaded image
EFourierImage frequencyImage(EFrequentialDomainFormat_ComplexExtended, width, height);
// Initialize an empty image that will contain spatial information
// Be aware of the specified dimensions
EImageBW8 spatialImage(frequencyImage.GetWidth() / 2, frequencyImage.GetHeight());
// Compute the inverse Fourier transform
EFourierTransformer fourier;
fourier.InverseTransform(frequencyImage, spatialImage);
C#¶
using eVision;
int width = 256;
int height = 256;
// Assuming you have the following loaded image
EFourierImage frequencyImage = new EFourierImage(EFrequentialDomainFormat.ComplexExtended, width * 2, height);
// Initialize an empty image that will contain spatial information
// Be aware of the specified dimensions
EImageBW8 spatialImage = new EImageBW8(frequencyImage.Width / 2, frequencyImage.Height);
// Compute the inverse Fourier transform
EFourierTransformer fourier = new EFourierTransformer();
fourier.InverseTransform(frequencyImage, spatialImage);
Python¶
import eVision
width = 256
height = 256
# Assuming you have the following loaded image
frequencyImage = eVision.EFourierImage(eVision.EFrequentialDomainFormat.ComplexExtended, width * 2, height)
# Initialize an empty image that will contain spatial information
# Be aware of the specified dimensions
spatialImage = eVision.EImageBW8(int(frequencyImage.Width / 2), frequencyImage.Height)
# Compute the inverse Fourier transform
fourier = eVision.EFourierTransformer()
fourier.InverseTransform(frequencyImage, spatialImage)