Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use IMAQ ComplexTruncate?

What is the correct order of the following functions in order to high pass and low pass spatial freqency filtering.
IMAQ FFT according the help file produces a complex image with the high spatial frequences in the centre.
IMAQ Complex Truncate according the help file however acts on complex images with the low frequencies centralized.
IMAQ ComplexFlipFrequency seem to be the answer, ie FFT--FLIP--TRUNCATE. But then there's no indiaction of what IMAQ InverseFFT wants as an input in terms of a complex image and how the spatial frequencies are arranged.
0 Kudos
Message 1 of 5
(3,500 Views)
IMAQ InverseFFT requires the same arrangement of frequencies that are produced by IMAQ FFT, since they are inverse functions. Therefore, it sounds like FFT-FLIP-TRUNCATE-FLIP-INVERSE would be the sequence you would want to use. This would give you a low pass filtering of your image. If you want a high pass filtering, leave out the FLIP steps.

Bruce
Bruce Ammons
Ammons Engineering
0 Kudos
Message 2 of 5
(3,500 Views)
If you take an FFT of an image and do an Inverse FFT on it you'll obtain the original image. So the input to the IMAQ Inverse FFT function should have the high frequencies centralized.
The correct order of your operation should be FFT -> FLIP -> TRUNCATE -> FLIP -> INVERSE FFT

Let me know if you have any questions regarding this.

Yusuf C.
Applications Engineering
National Instruments
0 Kudos
Message 3 of 5
(3,500 Views)
This does not appear to be the case.
I performed an experiment taking an image and taking it through the various combinations of possible routes and came up with the following observations.

A final IMAQ ComplexFlipFrequency stage is irrelevant with respect to IMAQ InverseFFT. I can only assume that the frequency arrangement is being automatically passed in the image information somewhere and the InverseFFT function is reading this.

Also the Truncation Frequency defination on the help file seems to be incorrect.
The Help file states:
Truncation Frequency % is the percentage of the frequencies that are retained within a Fourier-transformed image. This Percentage is expresessed with respect to the length of the diagonal of the FFT image and the
Boolean Low pass/High pass (Low pass). The default value is 10.
This being true. A value of 0 or 100 could be used to completely remove all the information. This does not occur. 100 seems to put the cut off line for filtering at the edge of both the vertical and horizontal directions and the constructs the ellipse with thes as the major and minor axes. I tried the function with a square image and putting the cut off to 142 (approximatly root 2 * 100) but the value appears to be max out at 100.
Its also clear by this that a "Low pass" of a flipped image is not the same as the "High pass" of a non-flipped image given the IMAQ ComplexTruncate function always keeps\removes data governed by an ellipse always drawn from the centre. These will encompass slightly different regions.

So what should be the correct method of Low pass and High pass filtering in the spatial frequency domain.
0 Kudos
Message 4 of 5
(3,500 Views)
These sound like good observations.

To explain to you the exact way to do what you want, I would need more details of exactly what you want to do. The flipping gives you low pass and high pass filters, but they are not conjugates of each other. You can't combine them to reproduce the original image. If this is what you want, you should create your own mask for removing the information from the FFT. You can invert the mask to switch between low pass and high pass.

Another option is to copy the FFT image, do the filtering, then subtract the filtered FFT image from the original FFT image to get the conjugate.

Bruce
Bruce Ammons
Ammons Engineering
0 Kudos
Message 5 of 5
(3,500 Views)