ImageDev

ComplexCenteredFft

Computes the centered Fast Fourier Transform of an image.

Access to parameter description

For an introduction: see section Frequency Domain.

This algorithm is used to visualize the modulus of the FFT centered in the middle of image rather than in the upper left corner. The image is centered by a translation in circular mode by a vector equal to half the diagonal of the image. In the following figure, to visualize the image, it is divided in four equal quadrants.

<b>Figure 1.</b> Results of a regular and centered FFT
Figure 1. Results of a regular and centered FFT

See also

Function Syntax

This function returns a ComplexCenteredFftOutput structure containing outputRealImage and outputImaginaryImage.
// Output structure of the complexCenteredFft function.
struct ComplexCenteredFftOutput
{
    /// The output real part image. Its dimensions are forced to the same values as the input. Its data type is forced to floating point.
    std::shared_ptr< iolink::ImageView > outputRealImage;
    /// The output imaginary part image. Its dimensions are forced to the same values as the input. Its data type is forced to floating point.
    std::shared_ptr< iolink::ImageView > outputImaginaryImage;
};

// Function prototype
ComplexCenteredFftOutput complexCenteredFft( std::shared_ptr< iolink::ImageView > inputImage, std::shared_ptr< iolink::ImageView > outputRealImage = nullptr, std::shared_ptr< iolink::ImageView > outputImaginaryImage = nullptr );
This function returns a tuple containing output_real_image and output_imaginary_image.
// Function prototype.
complex_centered_fft(input_image: idt.ImageType,
                     output_real_image: idt.ImageType = None,
                     output_imaginary_image: idt.ImageType = None) -> Tuple[idt.ImageType, idt.ImageType]
This function returns a ComplexCenteredFftOutput structure containing outputRealImage and outputImaginaryImage.
/// Output structure of the ComplexCenteredFft function.
public struct ComplexCenteredFftOutput
{
    /// 
    /// The output real part image. Its dimensions are forced to the same values as the input. Its data type is forced to floating point.
    /// 
    public IOLink.ImageView outputRealImage;
    /// 
    /// The output imaginary part image. Its dimensions are forced to the same values as the input. Its data type is forced to floating point.
    /// 
    public IOLink.ImageView outputImaginaryImage;
};

// Function prototype.
public static ComplexCenteredFftOutput
ComplexCenteredFft( IOLink.ImageView inputImage,
                    IOLink.ImageView outputRealImage = null,
                    IOLink.ImageView outputImaginaryImage = null );

Class Syntax

Parameters

Parameter Name Description Type Supported Values Default Value
input
inputImage
The input image. Image Binary, Label, Grayscale or Multispectral nullptr
output
outputRealImage
The output real part image. Its dimensions are forced to the same values as the input. Its data type is forced to floating point. Image nullptr
output
outputImaginaryImage
The output imaginary part image. Its dimensions are forced to the same values as the input. Its data type is forced to floating point. Image nullptr
Parameter Name Description Type Supported Values Default Value
input
input_image
The input image. image Binary, Label, Grayscale or Multispectral None
output
output_real_image
The output real part image. Its dimensions are forced to the same values as the input. Its data type is forced to floating point. image None
output
output_imaginary_image
The output imaginary part image. Its dimensions are forced to the same values as the input. Its data type is forced to floating point. image None
Parameter Name Description Type Supported Values Default Value
input
inputImage
The input image. Image Binary, Label, Grayscale or Multispectral null
output
outputRealImage
The output real part image. Its dimensions are forced to the same values as the input. Its data type is forced to floating point. Image null
output
outputImaginaryImage
The output imaginary part image. Its dimensions are forced to the same values as the input. Its data type is forced to floating point. Image null

Object Examples

auto polystyrene_float = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene_float.vip" );

ComplexCenteredFft complexCenteredFftAlgo;
complexCenteredFftAlgo.setInputImage( polystyrene_float );
complexCenteredFftAlgo.execute();

std::cout << "outputRealImage:" << complexCenteredFftAlgo.outputRealImage()->toString();
std::cout << "outputImaginaryImage:" << complexCenteredFftAlgo.outputImaginaryImage()->toString();
polystyrene_float = imagedev.read_vip_image(imagedev_data.get_image_path("polystyrene_float.vip"))

complex_centered_fft_algo = imagedev.ComplexCenteredFft()
complex_centered_fft_algo.input_image = polystyrene_float
complex_centered_fft_algo.execute()

print("output_real_image:", str(complex_centered_fft_algo.output_real_image))
print("output_imaginary_image:", str(complex_centered_fft_algo.output_imaginary_image))
ImageView polystyrene_float = Data.ReadVipImage( @"Data/images/polystyrene_float.vip" );

ComplexCenteredFft complexCenteredFftAlgo = new ComplexCenteredFft
{
    inputImage = polystyrene_float
};
complexCenteredFftAlgo.Execute();

Console.WriteLine( "outputRealImage:" + complexCenteredFftAlgo.outputRealImage.ToString() );
Console.WriteLine( "outputImaginaryImage:" + complexCenteredFftAlgo.outputImaginaryImage.ToString() );

Function Examples

auto polystyrene_float = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene_float.vip" );

auto result = complexCenteredFft( polystyrene_float );

std::cout << "outputRealImage:" << result.outputRealImage->toString();
std::cout << "outputImaginaryImage:" << result.outputImaginaryImage->toString();
polystyrene_float = imagedev.read_vip_image(imagedev_data.get_image_path("polystyrene_float.vip"))

result_output_real_image, result_output_imaginary_image = imagedev.complex_centered_fft(polystyrene_float)

print("output_real_image:", str(result_output_real_image))
print("output_imaginary_image:", str(result_output_imaginary_image))
ImageView polystyrene_float = Data.ReadVipImage( @"Data/images/polystyrene_float.vip" );

Processing.ComplexCenteredFftOutput result = Processing.ComplexCenteredFft( polystyrene_float );

Console.WriteLine( "outputRealImage:" + result.outputRealImage.ToString() );
Console.WriteLine( "outputImaginaryImage:" + result.outputImaginaryImage.ToString() );