#### gaurav007

##### Newbie level 4

The proposed FFT/IFFT algorithm is also folIows:

- Read the input file from the host system.
- Evaluate the (8x8) Cosine and Sine matrix using Equations.

**C(u+l, x+l) = cos(pi / 4)*(u* x))**

S(u + 1, x + 1) = sin(pi / 4) * (u * x))

- The image is accessed as (8x8) block successively, and the Cosine and Sine transforms are obtained.
- Compute the FFT of the image using basic equation.
- Verify the obtained FFT values with buiIt in FFT functional values of MATLAB.
- Compute the IFFT of the processed image in step 4 using the Eq.
- Verify visually the reconstructed image with the original image.
- Calculate the Power Signal to Noise Ratio (PSNR) of the processed signals for validation.

So far i have done this

clc;

clear all;

close all;

I_color=imread('lena.jpg');

I=rgb2gray(I_color);

[r,c,p]= size(I);

subplot(2,2,1);

imshow(I_color);

title('Original Image');

subplot(2,2,2);

imshow(I);

title('Grayscaled');

bs=8;

nob=r/bs;

xx=0;

% creating cos and sine matrix

for u=0:7

for x=0:7

C(u+1,x+1)= cos((pi/4)*(u*x)); %cos matrix

S(u+1,x+1)= sin((pi/4)*(u*x)); %sine matrix

C= im2uint8(C);

S= im2uint8(S);

end

end

%Ctransform = zeros(8,8,64);

for k=1:r/bs

for j=1:c/bs

block,:,xx+j)= I(bs*(k-1)+1:bs*(k-1)+bs,bs*(j-1)+1:bs*(j-1)+bs);

Ctransform,:,xx+j)= immultiply(C,block,:,xx+j));

Stransform,:,xx+j)= immultiply(S,block,:,xx+j));

end

xx=xx+(r/bs);

end

yy=0;

%F=im2uint8(zeros(512,512));

Fblock=im2uint8(zeros(8,8,64));

for M=1:64

for N=1:64

Fblock,:,yy+N)=Ctransform,:,yy+N) +imag((Stransform,:,yy+N)));

% F(bs*(M-1)+1:bs*(M-1)+bs,bs*(N-1)+1:bs*(N-1)+bs) = Fblock;

end

yy=yy+64;

end

now i want to recombine Fblock (fft of each block) after taking inverse fft plz help me out i am confused a lot