Example Code

Demonstration of 2-D Fourier Filter Using NI Vision Development Module

Code and Documents

Attachment

Download All

Overview

This example demonstrates the basic principles of 2-D Fourier Filters using VIs from the NI Vision Development Module.

Description

Frequency filtering is an important tool that is used both in signal processing and image processing. The principle is essentially the same whether the operation is performed on a 1-D array of samples or a 2-D array of pixels. First, the data is converted to the Fourier domain (also called the frequency domain) using a Fast Fourier Transform. Next, the data is multiplied by a mask or a window, which will block or diminish certain frequencies. Last, the data is converted back to the real domain using the Inverse Fourier Transform.

A 2-D Fourier Transform contains information about the strength of various patterns in the image. Fine details in the image are encoded in high frequency information while large shapes tend to be encoded in the low frequency information. After processing the image with the 2-D Fourier Transform, the magnitude of the lowest frequencies are displayed closest to the center. The frequencies grown higher as you move from the center to the perimeter of the image. Also, the strength of these patterns along any angle in the image are represented along the same angles in the 2-D Fourier Transform. For example, if an image were to contain fine details in the upper-right to lower left diagonal direction of the image, then the Fourier transform would indicate a strong magnitude in the upper left and lower right.

This VI allows its user to interactively experiment with the 2-D Fourier Transform. You can upload your own images or use the image of a spider that I provided. Also, you can seleted an ROI in the Fourier transform that will block all frequencies outside of the ROI. After the frequencies have been filtered, the data is converted back to the real domain so that you can see what the image would look like without that frequency information.

Steps to Implement or Execute Code

1. Save a grayscale image file in the same directory as this VI. You may use the

image of the spider that is provided.

2. Enter the name of that image file in the Image File Name Control

3. Run the VI. The original image will appear to the right. The 2-D Fourier

tranform of that image will appear below. The low frequency information

is located near the center of the image while the high frequency information

is found closer to the perimeter of the image.

4. Create an ROI on the Fourier Tranform image. This VI will block out all

of the frequencies that are not in the ROI. Notice that the Inverse Fourier

image to the lower right. It will display the image with only the selected

frequencies.

5. Press Stop to end the demonstration and erase the images

Requirements

Software: LabVIEW 2014, Vision Development Module 2014

Hardware: None required

Additional Images or Video


fourier example demonstration.jpg


Applications Engineer
National Instruments

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Contributors