How to run a 2 D FFT of an image and find the dominant frequency accurately
14 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am trying to run a 2D FFT on a satellite image (30 m resolution 256*256 image) and need to get the dominant frequency value and coordinates for the same in the kx ky dimension. The following is the code I wrote.
pkg load image
A = imread('1_b05_brest.tif'); A = imresize(A,[255,255]); A = double(A); imshow(A); % J = imadjust(A); J = A-mean(mean(A));
w = hamming(255); FA = fft2(J.*(w*w'));
%FA = fft2(J); FFA = fftshift(FA);
%him=blpf(FA,10,0.5); %FFA = fftshift(him); kx = 2*pi.*(-127:127)./(30*255); ky = 2*pi.*(-127:127)./(30*255);
j = abs(FFA); plot(kx,ky,j);
dominos = max(max(((abs(FFA))))); [x1,y1] = find(((abs(FA)))==dominos); j(x(1),y(1))=0; % i supressed the maximum noise in tha data j(x(2),y(2))=0; dominos1 = max(max(((j)))); [x1,y1] = find(((j))==dominos1); %noise_error = dominos - dominos1;
u = kx(x1(2)); v = ky(y1(2)); L = (2*pi)/sqrt(u.^2+v.^2); thetha = atan2(v,u);
%figure(1) imagesc(kx,ky,1+log(j));colormap(jet); colorbar; %title('magnitude'); % %figure(2) %imagesc(kx,ky,angle(FA)); colormap(jet); colorbar; %title('phase spectrum')
The code doesn't give a very smooth spectrum and also I am not able to isolate the dominant frequency coordinates efficiently. I would really appreciate if someone can help me regarding the same.
0 comentarios
Respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!