HALCON Reference Manual 10.0.2
Table of Contents / Filters / FFT ClassesClassesClasses | | | Operators

fft_genericfft_genericfft_genericFftGenericFftGeneric (Operator)

Name

fft_genericfft_genericfft_genericFftGenericFftGeneric — Compute the fast Fourier transform of an image.

Signature

fft_generic(Image : ImageFFT : Direction, Exponent, Norm, Mode, ResultType : )

Herror fft_generic(const Hobject Image, Hobject* ImageFFT, const char* Direction, const Hlong Exponent, const char* Norm, const char* Mode, const char* ResultType)

Herror T_fft_generic(const Hobject Image, Hobject* ImageFFT, const Htuple Direction, const Htuple Exponent, const Htuple Norm, const Htuple Mode, const Htuple ResultType)

Herror fft_generic(Hobject Image, Hobject* ImageFFT, const HTuple& Direction, const HTuple& Exponent, const HTuple& Norm, const HTuple& Mode, const HTuple& ResultType)

HImage HImage::FftGeneric(const HTuple& Direction, const HTuple& Exponent, const HTuple& Norm, const HTuple& Mode, const HTuple& ResultType) const

HImageArray HImageArray::FftGeneric(const HTuple& Direction, const HTuple& Exponent, const HTuple& Norm, const HTuple& Mode, const HTuple& ResultType) const

void HOperatorSetX.FftGeneric(
[in] IHUntypedObjectX* Image, [out] IHUntypedObjectX*ImageFFT, [in] VARIANT Direction, [in] VARIANT Exponent, [in] VARIANT Norm, [in] VARIANT Mode, [in] VARIANT ResultType)

IHImageX* HImageX.FftGeneric(
[in] BSTR Direction, [in] Hlong Exponent, [in] BSTR Norm, [in] BSTR Mode, [in] BSTR ResultType)

static void HOperatorSet.FftGeneric(HObject image, out HObject imageFFT, HTuple direction, HTuple exponent, HTuple norm, HTuple mode, HTuple resultType)

HImage HImage.FftGeneric(string direction, int exponent, string norm, string mode, string resultType)

Description

fft_genericfft_genericfft_genericFftGenericFftGeneric computes the fast Fourier transform of the input image ImageImageImageImageimage. Because several definitions of the forward and reverse transforms exist in the literature, this operator allows the user to select the most convenient definition.

The general definition of a Fourier transform is as follows:


               M-1  N-1
               ---  ---
           1   \    \    s*2*pi*i*(k*m/M+l*n/N)
  F(m,n) = - * /    /   e                       * f(k,l)
           c   ---  ---
               k=0  l=0

Opinions vary on whether the sign s in the exponent should be set to 1 or -1 for the forward transform, i.e., the transform for going to the frequency domain. There is also disagreement on the magnitude of the normalizing factor c. This is sometimes set to 1 for the forward transform, sometimes to M*N, and sometimes (in case of the unitary FFT) to sqrt(M*N). Especially in image processing applications the DC term is shifted to the center of the image.

fft_genericfft_genericfft_genericFftGenericFftGeneric allows to select these choices individually. The parameter DirectionDirectionDirectionDirectiondirection allows to select the logical direction of the FFT. (This parameter is not unnecessary; it is needed to discern how to shift the image if the DC term should rest in the center of the image.) Possible values are 'to_freq'"to_freq""to_freq""to_freq""to_freq" and 'from_freq'"from_freq""from_freq""from_freq""from_freq". The parameter ExponentExponentExponentExponentexponent is used to determine the sign of the exponent. It can be set to 1 or -1. The normalizing factor can be set with NormNormNormNormnorm, and can take on the values 'none'"none""none""none""none", 'sqrt'"sqrt""sqrt""sqrt""sqrt" and 'n'"n""n""n""n". The parameter ModeModeModeModemode determines the location of the DC term of the FFT. It can be set to 'dc_center'"dc_center""dc_center""dc_center""dc_center" or 'dc_edge'"dc_edge""dc_edge""dc_edge""dc_edge".

In any case, the user must ensure the consistent use of the parameters. This means that the normalizing factors used for the forward and backward transform must yield M*N when multiplied, the exponents must be of opposite sign, and ModeModeModeModemode must be equal for both transforms.

A consistent combination is, for example '(to_freq,-1,n,dc_edge)'"(to_freq,-1,n,dc_edge)""(to_freq,-1,n,dc_edge)""(to_freq,-1,n,dc_edge)""(to_freq,-1,n,dc_edge)" for the forward transform and '(from_freq,1,none,dc_edge)'"(from_freq,1,none,dc_edge)""(from_freq,1,none,dc_edge)""(from_freq,1,none,dc_edge)""(from_freq,1,none,dc_edge)" for the reverse transform. In this case, the FFT can be interpreted as interpolation with trigonometric basis functions. Another possible combination is '(to_freq,-1,sqrt,dc_center)'"(to_freq,-1,sqrt,dc_center)""(to_freq,-1,sqrt,dc_center)""(to_freq,-1,sqrt,dc_center)""(to_freq,-1,sqrt,dc_center)" and '(from_freq,1,sqrt,dc_center)'"(from_freq,1,sqrt,dc_center)""(from_freq,1,sqrt,dc_center)""(from_freq,1,sqrt,dc_center)""(from_freq,1,sqrt,dc_center)".

The parameter ResultTypeResultTypeResultTypeResultTyperesultType can be used to specify the result image type of the reverse transform (DirectionDirectionDirectionDirectiondirection = 'from_freq'"from_freq""from_freq""from_freq""from_freq"). In the forward transform (DirectionDirectionDirectionDirectiondirection = 'to_freq'"to_freq""to_freq""to_freq""to_freq"), ResultTypeResultTypeResultTypeResultTyperesultType must be set to 'complex'"complex""complex""complex""complex".

Attention

The filtering is always done on the entire image, i.e., the region of the image is ignored.

Parallelization

Parameters

ImageImageImageImageimage (input_object)  image(-array) objectHImageHImageHImageXHobject (byte / direction / cyclic / int1 / int2 / uint2 / int4 / real / complex)

Input image.

ImageFFTImageFFTImageFFTImageFFTimageFFT (output_object)  image(-array) objectHImageHImageHImageXHobject * (byte / direction / cyclic / int1 / int2 / uint2 / int4 / real / complex)

Fourier-transformed image.

DirectionDirectionDirectionDirectiondirection (input_control)  string HTupleHTupleVARIANTHtuple (string) (string) (char*) (BSTR) (char*)

Calculate forward or reverse transform.

Default value: 'to_freq' "to_freq" "to_freq" "to_freq" "to_freq"

List of values: 'to_freq'"to_freq""to_freq""to_freq""to_freq", 'from_freq'"from_freq""from_freq""from_freq""from_freq"

ExponentExponentExponentExponentexponent (input_control)  integer HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong)

Sign of the exponent.

Default value: -1

List of values: -1, 1

NormNormNormNormnorm (input_control)  string HTupleHTupleVARIANTHtuple (string) (string) (char*) (BSTR) (char*)

Normalizing factor of the transform.

Default value: 'sqrt' "sqrt" "sqrt" "sqrt" "sqrt"

List of values: 'none'"none""none""none""none", 'sqrt'"sqrt""sqrt""sqrt""sqrt", 'n'"n""n""n""n"

ModeModeModeModemode (input_control)  string HTupleHTupleVARIANTHtuple (string) (string) (char*) (BSTR) (char*)

Location of the DC term in the frequency domain.

Default value: 'dc_center' "dc_center" "dc_center" "dc_center" "dc_center"

List of values: 'dc_center'"dc_center""dc_center""dc_center""dc_center", 'dc_edge'"dc_edge""dc_edge""dc_edge""dc_edge"

ResultTypeResultTypeResultTypeResultTyperesultType (input_control)  string HTupleHTupleVARIANTHtuple (string) (string) (char*) (BSTR) (char*)

Image type of the output image.

Default value: 'complex' "complex" "complex" "complex" "complex"

List of values: 'complex'"complex""complex""complex""complex", 'byte'"byte""byte""byte""byte", 'int1'"int1""int1""int1""int1", 'int2'"int2""int2""int2""int2", 'uint2'"uint2""uint2""uint2""uint2", 'int4'"int4""int4""int4""int4", 'real'"real""real""real""real", 'direction'"direction""direction""direction""direction", 'cyclic'"cyclic""cyclic""cyclic""cyclic"

Example (C)

/* simulation of fft */
my_fft(Hobject In, Hobject *Out)
{
  fft_generic(In,Out,"to_freq",-1,"sqrt","dc_center","complex");
}

/* simulation of fft_image_inv */
my_fft_image_inv(Hobject In, Hobject *Out)
{
  fft_generic(In,&Out,"from_freq",1,"sqrt","dc_center","byte");
}

Result

fft_genericfft_genericfft_genericFftGenericFftGeneric returns 2 (H_MSG_TRUE) if all parameters are correct. If the input is empty the behavior can be set via set_system(::'no_object_result',<Result>:)set_system("no_object_result",<Result>)set_system("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>). If necessary, an exception is raised.

Possible Predecessors

optimize_fft_speedoptimize_fft_speedoptimize_fft_speedOptimizeFftSpeedOptimizeFftSpeed, read_fft_optimization_dataread_fft_optimization_dataread_fft_optimization_dataReadFftOptimizationDataReadFftOptimizationData

Possible Successors

convol_fftconvol_fftconvol_fftConvolFftConvolFft, convol_gaborconvol_gaborconvol_gaborConvolGaborConvolGabor, convert_image_typeconvert_image_typeconvert_image_typeConvertImageTypeConvertImageType, power_bytepower_bytepower_bytePowerBytePowerByte, power_realpower_realpower_realPowerRealPowerReal, power_lnpower_lnpower_lnPowerLnPowerLn, phase_degphase_degphase_degPhaseDegPhaseDeg, phase_radphase_radphase_radPhaseRadPhaseRad, energy_gaborenergy_gaborenergy_gaborEnergyGaborEnergyGabor

Alternatives

fft_imagefft_imagefft_imageFftImageFftImage, fft_image_invfft_image_invfft_image_invFftImageInvFftImageInv, rft_genericrft_genericrft_genericRftGenericRftGeneric

Module

Foundation


Table of Contents / Filters / FFT ClassesClassesClasses | | | Operators
HALCON Reference Manual 10.0.2 Copyright © 1996-2011 MVTec Software GmbH