Image Fourier Transform
Nov 29, 2014
Image Fourier Transform
• >> I1=imread('lines1.png');• >> imshow(I1);• >> A1=fft2(I1);• >> A2=fftshift(A1);• >> imshow(A2);
fft transform for the strip lines image
Original image
• 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');
A3=A2(0.4*m:m,0.4*n:n); figure(3),imshow(uint8(abs((ifft2(A3))))); title('Restructuring the image after removing some fourier coefficients');
• 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');
Original Image
fft fourier transform of horizontal lines
The peak is at the center for vertical lines and horizontal lines