How can I remove the central pattern (near 0 hz value) correctly?
7 views (last 30 days)
Show older comments
I want to perform a 2D Fast Fourier Transform on a matrix (named hstg, attached to this question) and observe its behavior around 0 frequency.
The size of the matrix hstg is 1024*1024, before processing, I applied a window function to this matrix.
windowf = hann(1024)*hann(1024)';
hstg = hstg.*windowf;
sq = fft2(hstg);
sq1 = (abs(fftshift(sq)));
imagesc(-sq1);
clim([-15 0]);

As the picture shows, there is a large range of abnormally large intensity in the center, which is near the 0 frequency.
To solve this problem, I used the method of subtracting the mean.
While keeping the window function type still, I applied
hstg = (hstg - mean2(hstg.*windowf)/mean2(windowf)).*windowf;

It worked but failed to satisfy me.
Then I tried a high pass filter.
cutOffFrequency = 0.005;
filterOrder = 3;
filteredRows = zeros(size(hstg));
for i = 1:size(hstg, 1)
filteredRows(i, :) = highpass(hstg(i, :), cutOffFrequency, filterOrder);
end
filteredMatrix = zeros(size(hstg));
for j = 1:size(hstg, 2)
filteredMatrix(:, j) = highpass(filteredRows(:, j), cutOffFrequency, filterOrder);
end
hstg = filteredMatrix;

I'm afraid that I might do it wrong, 'cause judging from the result, the intensity of the central part is simply deleted.
So I sincerely hope that someone can give me some suggestions to solve this problem.
I will check carefully any answer, and the matrix hstg is attached to this question.
0 Comments
Answers (1)
Image Analyst
on 9 Jan 2024
It looks like it's deleting the spectrum along the axes. If you just want the central spot, then just erase that:
[rows, columns] = size(sq1);
midRow = floor(rows/2)
midCol = floor(columns/2)
windowWidth = 5; % Whatever you want to erase.
sq1(midRow - windowWidth : midRow + windowWidth, midCol - windowWidth : midCol + windowWidth) = 0;
See attached demos using demo image, not yours.
0 Comments
See Also
Categories
Find more on Multirate Signal Processing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!