fft_genericfft_genericFftGenericFftGenericfft_generic(算子)

名称

fft_genericfft_genericFftGenericFftGenericfft_generic — 计算图像的快速傅里叶变换。

签名

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)

void FftGeneric(const HObject& Image, HObject* ImageFFT, const HTuple& Direction, const HTuple& Exponent, const HTuple& Norm, const HTuple& Mode, const HTuple& ResultType)

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

HImage HImage::FftGeneric(const char* Direction, Hlong Exponent, const char* Norm, const char* Mode, const char* ResultType) const

HImage HImage::FftGeneric(const wchar_t* Direction, Hlong Exponent, const wchar_t* Norm, const wchar_t* Mode, const wchar_t* ResultType) const   ( Windows only)

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)

def fft_generic(image: HObject, direction: str, exponent: int, norm: str, mode: str, result_type: str) -> HObject

描述

fft_genericfft_genericFftGenericFftGenericFftGenericfft_generic computes the fast Fourier transform of the input image ImageImageImageImageimageimage. 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: 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 . Especially in image processing applications the DC term is shifted to the center of the image.

fft_genericfft_genericFftGenericFftGenericFftGenericfft_generic allows to select these choices individually. The parameter DirectionDirectionDirectionDirectiondirectiondirection 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""to_freq" and 'from_freq'"from_freq""from_freq""from_freq""from_freq""from_freq". The parameter ExponentExponentExponentExponentexponentexponent is used to determine the sign of the exponent. It can be set to 1 or -1. The normalizing factor can be set with NormNormNormNormnormnorm, and can take on the values 'none'"none""none""none""none""none", 'sqrt'"sqrt""sqrt""sqrt""sqrt""sqrt" and 'n'"n""n""n""n""n". The parameter ModeModeModeModemodemode 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""dc_center" or 'dc_edge'"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 ModeModeModeModemodemode 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)""(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)""(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)""(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)""(from_freq,1,sqrt,dc_center)".

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

注意

The transformation is always performed for the entire image, i.e., the domain of the image is ignored.

执行信息

参数

ImageImageImageImageimageimage (输入对象)  (multichannel-)image(-array) objectHImageHObjectHImageHobject (byte / direction / cyclic / int1 / int2 / uint2 / int4 / real / complex)

输入图像。

ImageFFTImageFFTImageFFTImageFFTimageFFTimage_fft (输出对象)  image(-array) objectHImageHObjectHImageHobject * (byte / direction / cyclic / int1 / int2 / uint2 / int4 / real / complex)

Fourier-transformed image.

DirectionDirectionDirectionDirectiondirectiondirection (输入控制)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Calculate forward or reverse transform.

默认值: 'to_freq' "to_freq" "to_freq" "to_freq" "to_freq" "to_freq"

值列表: 'from_freq'"from_freq""from_freq""from_freq""from_freq""from_freq", 'to_freq'"to_freq""to_freq""to_freq""to_freq""to_freq"

ExponentExponentExponentExponentexponentexponent (输入控制)  integer HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Sign of the exponent.

默认值: -1

值列表: -1, 1

NormNormNormNormnormnorm (输入控制)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Normalizing factor of the transform.

默认值: 'sqrt' "sqrt" "sqrt" "sqrt" "sqrt" "sqrt"

值列表: 'n'"n""n""n""n""n", 'none'"none""none""none""none""none", 'sqrt'"sqrt""sqrt""sqrt""sqrt""sqrt"

ModeModeModeModemodemode (输入控制)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Location of the DC term in the frequency domain.

默认值: 'dc_center' "dc_center" "dc_center" "dc_center" "dc_center" "dc_center"

值列表: 'dc_center'"dc_center""dc_center""dc_center""dc_center""dc_center", 'dc_edge'"dc_edge""dc_edge""dc_edge""dc_edge""dc_edge"

ResultTypeResultTypeResultTypeResultTyperesultTyperesult_type (输入控制)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Image type of the output image.

默认值: 'complex' "complex" "complex" "complex" "complex" "complex"

值列表: 'byte'"byte""byte""byte""byte""byte", 'complex'"complex""complex""complex""complex""complex", 'cyclic'"cyclic""cyclic""cyclic""cyclic""cyclic", 'direction'"direction""direction""direction""direction""direction", 'int1'"int1""int1""int1""int1""int1", 'int2'"int2""int2""int2""int2""int2", 'int4'"int4""int4""int4""int4""int4", 'real'"real""real""real""real""real", 'uint2'"uint2""uint2""uint2""uint2""uint2"

示例(C)

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

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

结果

fft_genericfft_genericFftGenericFftGenericFftGenericfft_generic 在所有参数正确时返回 2 ( H_MSG_TRUE )。当输入为空时,可设置行为通过算子 set_system(::'no_object_result',<Result>:)set_system("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>)set_system("no_object_result",<Result>)。如有必要,则抛出异常。

可能的前趋

optimize_fft_speedoptimize_fft_speedOptimizeFftSpeedOptimizeFftSpeedOptimizeFftSpeedoptimize_fft_speed, read_fft_optimization_dataread_fft_optimization_dataReadFftOptimizationDataReadFftOptimizationDataReadFftOptimizationDataread_fft_optimization_data

可能的后继

convol_fftconvol_fftConvolFftConvolFftConvolFftconvol_fft, correlation_fftcorrelation_fftCorrelationFftCorrelationFftCorrelationFftcorrelation_fft, phase_correlation_fftphase_correlation_fftPhaseCorrelationFftPhaseCorrelationFftPhaseCorrelationFftphase_correlation_fft, convol_gaborconvol_gaborConvolGaborConvolGaborConvolGaborconvol_gabor, convert_image_typeconvert_image_typeConvertImageTypeConvertImageTypeConvertImageTypeconvert_image_type, power_bytepower_bytePowerBytePowerBytePowerBytepower_byte, power_realpower_realPowerRealPowerRealPowerRealpower_real, power_lnpower_lnPowerLnPowerLnPowerLnpower_ln, phase_degphase_degPhaseDegPhaseDegPhaseDegphase_deg, phase_radphase_radPhaseRadPhaseRadPhaseRadphase_rad, energy_gaborenergy_gaborEnergyGaborEnergyGaborEnergyGaborenergy_gabor

替代

fft_imagefft_imageFftImageFftImageFftImagefft_image, fft_image_invfft_image_invFftImageInvFftImageInvFftImageInvfft_image_inv, rft_genericrft_genericRftGenericRftGenericRftGenericrft_generic

模块

基础