Frequency Analysis and FFT
Introduction to Frequency Analysis in Image Processing
- Frequency analysis is a common method for extracting information from images.
- This lecture aims to explain the concept of FFT (Fast Fourier Transform) from a biologist's perspective.
- Understanding the math in detail is not required for biologists.
What is FFT?
- FFT stands for Fast Fourier Transform.
- It is a development that reduces the computational load of performing Fourier transforms.
- An image can be broken down into its frequencies using FFT.
- For a 2D image, this results in a 2D frequency domain image.
- Peaks in the frequency domain image relate to the frequency of structures in the original image.
- Example: T-tubules in cardiac myocytes. The T tubules occur every sarcomere.
- The inverse transform can be used to get the original image back from the frequency domain.
- Working in the frequency domain is computationally efficient, especially for operations like convolution.
- Frequency features, such as sarcomere spacing, can be easily measured or identified.
- Images can be filtered based on their frequency components (low-pass and high-pass filtering).
Frequency in Microscopes
- Frequency of light can be observed in the back focal plane of a microscope.
- Microscopes collect frequencies, and these frequencies can be observed.
- Image processing mathematically manipulates these collected frequencies.
Continuous Fourier Series
- The continuous Fourier series states that any signal can be recreated using its sine and cosine components.
- Sine and cosine waves have different phases.
- Waves can exhibit constructive or destructive interference.
- Constructive interference: overlapping waves increase net amplitude.
- Destructive interference: perfectly offset waves cancel each other out.
- A sine function has three components: amplitude, frequency, and phase.
- Cosine and sine components are used to manage the phase component.
- In a 1D FFT, a signal in the time domain (time vs. amplitude) can be decomposed into frequency space (low to high frequency).
Discrete Fourier Series
- The discrete Fourier series is used computationally.
- The more coefficients used, the more accurate the representation.
- A periodic signal can be represented using a sum of sine waves.
- As the number of coefficients increases, the representation becomes more accurate.
- 1 coefficient: flat line.
- Increasing coefficients: increasingly accurate representation.
- Edge effects, known as the Gibbs phenomenon, can occur, causing ringing artifacts.
- These artifacts can be seen in deconvolution.
- The discrete Fourier series has both real (cosine) and imaginary (sine) components.
- Euler's formula is computationally very efficient for this calculation.
Visualizing Frequency
- A single frequency can be visualized by plotting it around a circle, speeding up the plotting.
- Euler's formula helps to computationally achieve this.
- As the winding frequency increases, the center of mass shifts.
- When the winding frequency matches the actual frequency, there is an increase in the center of mass, indicating the dominant frequency.
Aliasing and Nyquist Sampling
- Aliasing occurs when the sampling rate is not high enough to accurately represent the original signal.
- In this animation, the frequency goes from low to high. At the low frequency, the replication is pretty well but sampling isn't there anymore that's when aliasing occurs.
Real Component and Power Spectrum
- Typically, the real component of the FFT is displayed.
- The power spectrum is the square magnitude of the Fourier transform.
Why use FFT?
- FFT is a fundamental tool in information processing and computers.
- It can be used to filter noise from an image.
- Convert the noisy image to Fourier space.
- Identify and filter out the noise components.
- Reconstruct the image with the majority of the signal.
- Periodic signals have distinct representations in Fourier space.
- The center of the Fourier space represents the total intensity of the image (zero frequency).
- Low frequencies are closer to the center, while higher frequencies are further out.
- The direction of the signal correlates with its representation in Fourier space.
- The power spectrum is usually visualized on a logarithmic scale.
- Combining images is equivalent to adding their FFTs and inverting.
Image Decomposition with FFT
- A grayscale image can be decomposed by taking its FFT.
- Low-pass filtering: taking the center portion of the FFT (captures larger structures).
- Medium frequency filtering: taking a ring around the center of the FFT.
- High-frequency filtering: filtering out the center of the FFT (captures smaller structures).
Object Position, Rotation, and Scaling
- Changing the position of an object does not change the magnitude of the FFT.
- This information is stored in the imaginary part.
- Rotating or scaling an object will change the FFT.
Sarcomere Spacing and Harmonics
- FFT can be used to analyze sarcomere spacing in skeletal muscle sections.
- Harmonics are higher frequencies that provide additional information about a structure.
- The first harmonic is the fundamental frequency, and subsequent harmonics add detail.
- Repeating harmonics in an FFT indicate a repeating structure.
Application: Atomic Lattice of Silicon
- FFT can be used to remove noise from an image of an atomic lattice.
- Convert the image to Fourier space and identify high-intensity peaks.
- Filter the image to isolate the periodic frequency.
- Reconstruct the image to reveal the silicon lattice structure.
Removing Grid Patterns
- FFT can be used to remove grid-like patterns (e.g., from newsprint).
- Identify the peaks corresponding to the grid pattern in the FFT.
- Mask out these peaks and perform an inverse FFT to remove the pattern.
Filtering: Low Pass and High Pass
- FFT is useful for filtering images.
- Low-pass filtering: captures the main structure of an image.
- High-pass filtering: captures the edges of an image.
- Sharp cutoffs in filtering can cause ringing artifacts (Gibbs phenomenon).
- A rolling cutoff (e.g., Butterworth filter) can suppress these artifacts.
Convolution
- Convolution is simpler in the frequency domain (multiplication) than in the spatial domain.
- In the spatial domain, convolution involves multiplying a kernel with the image and shifting it pixel by pixel.
- In the frequency domain, it involves taking the FFTs of the image and kernel, multiplying them, and then taking the inverse FFT.
- Deconvolution (undoing blurring) is a simple division in the frequency domain.
- Frequency domain convolution assumes a continuing signal, avoiding edge problems.
Gaussian Convolution
- Gaussian convolution can be used for image smoothing.
- In the spatial domain, this involves convolving a Gaussian kernel with the image.
- In the frequency domain, it is a simple multiplication.
Examples of Applications of FFT
Hubble telescope
- Used to enhance images of the solar system
Motion Artifact
- FFT can correct motion artifacts in images.
Template Matching
- FFT can be used to locate objects in an image using template matching.
Autocorrelation
- Autocorrelation (easier in frequency space) can be used to find dominant orientations in an image.
T-tubules in Cardiology
- FFT can be used to analyze T-tubules in cardiac myocytes.
- T-tubules are plasma membrane invaginations important for signaling contraction.
- FFT can quantify the regularity of T-tubules, which is related to cardiac health and heart failure.
- T power is a metric developed to measure the height of the first harmonic, it determines frequency associated with the sarcomere, which is around 1.8 microns.