[VTK Study Notes-11] Frequency domain processing (Fast Fourier Transform FFT/RFFT, low-pass filtering, high-pass filtering)

Learning Tutorial: "Advanced VTK Graphics and Image Development" Zhang Xiaodong, Luo Huoling
Special thanks: Dongling Studio

5.6 Frequency domain processing

Image frequency domain processing uses spatial transformation to convert the image from image space to frequency domain space, processes the data (such as filtering) according to the properties of frequency domain space, and finally transforms the processed data into image space through spatial transformation.

Image frequency domain processing can be applied to image smoothing, edge extraction, digital watermarking, etc.

5.6.1 Fast Fourier Transform

Fast Fourier transform FFT is widely used in digital image processing, such as digital image frequency domain filtering, denoising, and enhancement. FFT is reversible, and its inverse transform is RFFT. The corresponding classes are vtkImageFFT and vtkImageRFFT respectively.

The inputs of vtkImageFFT and vtkImageRFFT are real or complex data, and the outputs are complex data. Therefore, the output results cannot be displayed directly, and a certain component needs to be extracted for image display.

For example, a two-dimensional fast Fourier transform outputs vtkImageData data with a pixel type of complex number, that is, each pixel value has two components: the real part and the imaginary part of the complex number. Therefore, if this vtkImageData data is displayed directly, it will be a color image. If a frequency domain image is displayed, a certain component image needs to be extracted and then displayed.

The steps of image frequency domain processing are: first transform the spatial domain image into the frequency domain image through FFT, design a filter to process the frequency domain components of different frequencies; then transform the processed frequency domain image into the spatial domain through RFFT, and get Processed image. The design of the filter needs to be selected according to the needs, mainly divided intolow pass filterandhigh pass filter
Insert image description here

5.6.2 Low-pass filtering

Low-pass filtering filters out the high-frequency parts of the frequency domain image while retaining the low-frequency parts. The edges and noise of the image correspond to the high-frequency part of the image, and the function of low-pass filtering is to weaken the energy of this part, thereby achievingImage smoothing and denoisingthe goal of.

(1) Ideal low-pass filter

Given a frequency threshold, set everything above that threshold to 0, while leaving everything below it unchanged.

The ideal low-pass filtering effect, after filtering out the high-frequency part of the image, the image becomes blurred and many details are lost. In addition, the image after ideal low-pass filtering has a certain ringing effect.

Ringing effect: It manifests as oscillations in the neighborhood where the grayscale of the image changes drastically. The direct cause of the ringing effect is the loss of information during image degradation, especially the loss of high-frequency information.

(2) Butterworth low-pass filtering

Insert image description here
Butterworth low-pass filtering produces a smoother image without ringing.

5.6.3 High-pass filtering

High-pass filtering passes the high-frequency parts of the frequency domain image and suppresses the low-frequency parts. The edges of the image correspond to high-frequency components, so the effect of high-pass filtering isImage sharpening

(1) Ideal high-pass filter

Set a frequency threshold, let the frequency part above the threshold pass, and set the low frequency part below the threshold to 0.

After ideal high-pass filtering, the image is sharpened and only the edges remain.

(2) Butterworth high-pass filtering

Insert image description here

Guess you like

Origin blog.csdn.net/m0_51141265/article/details/132917399