# Performing a Direct Fourier Transform

This code snippet shows how to compute the direct Fourier transform of a grayscale image (from the spatial domain to the frequency domain).

## C++

```cpp
#include <eVision/EasyImage/EFourierTransformer.h>
```

```cpp
using namespace eVision;

int width = 256;
int height = 256;

// Assuming you have the following loaded image
EImageBW8 spatialImage(width, height);

// Initialize an empty image that will contain frequencies information
// Be aware of the specified dimensions
EFourierImage frequencyImage(EFrequentialDomainFormat_ComplexExtended, width * 2, height);

// Compute the direct Fourier transform
EFourierTransformer fourier;
fourier.DirectTransform(spatialImage, frequencyImage);
```

## C#

```cs
using eVision;
```

```cs
// Assuming you have the following loaded image
EImageBW8 spatialImage = new EImageBW8();

// Initialize an empty image that will contain frequencies information
// Be aware of the specified dimensions
EFourierImage frequencyImage = new EFourierImage(EFrequentialDomainFormat.ComplexExtended, spatialImage.Width * 2, spatialImage.Height);

// Compute the direct Fourier transform
EFourierTransformer fourier = new EFourierTransformer();
fourier.DirectTransform(spatialImage, frequencyImage);
```

## Python

```py
import eVision

# Assuming you have the following loaded image
spatialImage = eVision.EImageBW8()

# Initialize an empty image that will contain frequencies information
# Be aware of the specified dimensions
frequencyImage = eVision.EFourierImage(eVision.EFrequentialDomainFormat.ComplexExtended, spatialImage.Width * 2, spatialImage.Height)

# Compute the direct Fourier transform
fourier = eVision.EFourierTransformer()
fourier.DirectTransform(spatialImage, frequencyImage)
```
