How can I remove the central pattern (near 0 hz value) correctly?

2 次查看(过去 30 天)
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.

回答(1 个)

Image Analyst
Image Analyst 2024-1-9
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.

类别

Help CenterFile Exchange 中查找有关 Fourier Analysis and Filtering 的更多信息

产品


版本

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by