Image fft
- 8. • >> I1=imread('lines1.png');
• >> imshow(I1);
• >> A1=fft2(I1);
• >> A2=fftshift(A1);
• >> imshow(A2);
- 11. • I1=imread('lines1.png');
• figure(1), imshow(I1);
• A1=fft2(I1);
• A2=fftshift(A1);
• figure(2),imshow(A2);
•
• [m,n]=size(A2);
•
• %%%%%%%%%%%%%%%%%%%%%%%%%%%%%Here we retrieve part of the image fourier
•
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%coefficients%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%
•
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%
•
• A3=A2(0.4*m:m,0.4*n:n);
•
• figure(3),imshow(uint8(ifft2(A3)));
•
• title('Restructuring the image after removing some fourier coefficients');
- 14. • close all,clear all,clc
• I1=imread('lines2.png');
• figure(1), imshow(I1);
• A1=fft2(I1);
• A2=fftshift(A1);
• [m,n]=size(A2);
• nn=max(max(A2));
• for i=1:m
• for j=1:n
• if A2(i,j)==nn
• l=i
• p=j
• end
• end
• end
• xx=(A2==nn);
• figure(2),imshow(A2);
•
• [m,n]=size(A2);
•
• %%%%%%%%%%%%%%%%%%%%%%%%%%%%%Here we retrieve part of the image fourier
• %%%%%%%%%%%%%%%%%%%%%%%%%%%%%coefficients%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
• %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
•
• A3=A2(0.45*m:m,0.45*n:n);
•
• figure(3),imshow(uint8(abs((ifft2(A3)))));
•
• title('Restructuring the image after removing some fourier coefficients');
- 18. The peak is at the
center for vertical lines
and horizontal lines