Skip to content

gen_bandfilterGenBandfilterGenBandfiltergen_bandfiltergen_bandfilter🔗

Short description🔗

gen_bandfilterGenBandfilterGenBandfiltergen_bandfiltergen_bandfilter — Generate an ideal band filter.

Signature🔗

gen_bandfilter( out image ImageFilter, real MinFrequency, real MaxFrequency, string Norm, string Mode, integer Width, integer Height )void GenBandfilter( HObject* ImageFilter, const HTuple& MinFrequency, const HTuple& MaxFrequency, const HTuple& Norm, const HTuple& Mode, const HTuple& Width, const HTuple& Height )static void HOperatorSet.GenBandfilter( out HObject imageFilter, HTuple minFrequency, HTuple maxFrequency, HTuple norm, HTuple mode, HTuple width, HTuple height )def gen_bandfilter( min_frequency: float, max_frequency: float, norm: str, mode: str, width: int, height: int ) -> HObject

Herror gen_bandfilter( Hobject* ImageFilter, double MinFrequency, double MaxFrequency, const char* Norm, const char* Mode, const Hlong Width, const Hlong Height )

Herror T_gen_bandfilter( Hobject* ImageFilter, const Htuple MinFrequency, const Htuple MaxFrequency, const Htuple Norm, const Htuple Mode, const Htuple Width, const Htuple Height )

void HImage::GenBandfilter( double MinFrequency, double MaxFrequency, const HString& Norm, const HString& Mode, Hlong Width, Hlong Height )

void HImage::GenBandfilter( double MinFrequency, double MaxFrequency, const char* Norm, const char* Mode, Hlong Width, Hlong Height )

void HImage::GenBandfilter( double MinFrequency, double MaxFrequency, const wchar_t* Norm, const wchar_t* Mode, Hlong Width, Hlong Height ) (Windows only)

void HImage.GenBandfilter( double minFrequency, double maxFrequency, string norm, string mode, int width, int height )

Description🔗

gen_bandfilterGenBandfilter generates an ideal band filter in the frequency domain. The parameters MinFrequencyminFrequencymin_frequency and MaxFrequencymaxFrequencymax_frequency determine the cutoff frequencies of the filter as a fraction of the maximum (horizontal and vertical) frequency that can be represented in an image of size Widthwidthwidth x Heightheightheight, i.e., MinFrequencyminFrequencymin_frequency and MaxFrequencymaxFrequencymax_frequency should lie between 0 and 1. To achieve a maximum overall efficiency of the filtering operation, the parameter Normnormnorm can be used to specify the normalization factor of the filter. If fft_genericFftGeneric and Normnormnorm \(=\) 'n'"n" is used the normalization in the FFT can be avoided. Modemodemode can be used to determine where the DC term of the filter lies or whether the filter should be used in the real-valued FFT. If fft_genericFftGeneric is used, 'dc_edge'"dc_edge" can be used to gain efficiency. If fft_imageFftImage and fft_image_invFftImageInv are used for filtering, Normnormnorm \(=\) 'none'"none" and Modemodemode \(=\) 'dc_center'"dc_center" must be used. If rft_genericRftGeneric is used, Modemodemode \(=\) 'rft'"rft" must be used. The resulting image contains an annulus with the value 0, and a value determined by the normalization outside of this annulus.

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

Parameters🔗

ImageFilterimageFilterimage_filter (output_object) image → object (real)HObject (real)HImage (real)HObject (real)Hobject * (real)

Band filter in the frequency domain.

MinFrequencyminFrequencymin_frequency (input_control) real → (real)HTuple (double)HTuple (double)floatHtuple (double)

Minimum frequency.

Default: 0.10.1
Suggested values: 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.00.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0
Restriction: MinFrequency >= 0

MaxFrequencymaxFrequencymax_frequency (input_control) real → (real)HTuple (double)HTuple (double)floatHtuple (double)

Maximum frequency.

Default: 0.20.2
Suggested values: 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.00.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0
Restriction: (MaxFrequency >= 0) && (MaxFrequency >= MinFrequency)

Normnormnorm (input_control) string → (string)HTuple (HString)HTuple (string)strHtuple (char*)

Normalizing factor of the filter.

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

Modemodemode (input_control) string → (string)HTuple (HString)HTuple (string)strHtuple (char*)

Location of the DC term in the frequency domain.

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

Widthwidthwidth (input_control) integer → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Width of the image (filter).

Default: 512512
Suggested values: 128, 160, 192, 256, 320, 384, 512, 640, 768, 1024, 2048, 4096, 8192128, 160, 192, 256, 320, 384, 512, 640, 768, 1024, 2048, 4096, 8192

Heightheightheight (input_control) integer → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Height of the image (filter).

Default: 512512
Suggested values: 120, 128, 144, 240, 256, 288, 480, 512, 576, 1024, 2048, 4096, 8192120, 128, 144, 240, 256, 288, 480, 512, 576, 1024, 2048, 4096, 8192

Example🔗

(HDevelop)


* Filtering with maximum efficiency with fft_generic.
gen_bandpass(Bandfilter,0.2,0.4,'n','dc_edge',Width,Height)
fft_generic(Image,ImageFFT,'to_freq',-1,'none','dc_edge','complex')
convol_fft(ImageFFT,Bandfilter,ImageConvol)
fft_generic(ImageConvol,ImageResult,'from_freq',1,'none','dc_edge','byte')

Result🔗

gen_bandfilterGenBandfilter returns 2 (H_MSG_TRUE) if all parameters are correct. If necessary, an exception is raised.

Combinations with other operators🔗

Combinations

Possible successors

convol_fftConvolFft

Alternatives

gen_circleGenCircle, paint_regionPaintRegion

See also

gen_highpassGenHighpass, gen_lowpassGenLowpass, gen_bandpassGenBandpass, gen_gauss_filterGenGaussFilter, gen_mean_filterGenMeanFilter, gen_derivative_filterGenDerivativeFilter

Module🔗

Foundation