

im= imread('cell.tif');
h= [-1,0,1 ; -1, 0, 1; -1,0,1];
h2=[1,1,1; 1,1,1; 1,1,1];
imf= filter2(h, im);
imf2= filter2(h2, im);
figure(1);
imagesc(im);
colormap(gray);
figure(2);
imagesc(abs(imf));
colormap(gray)
figure(3);
imagesc(abs(imf2));
colormap(gray)


% Gaussian filter
h3= fspecial('gaussian',[5 5],2);
imf3= filter2(h3, im);
figure(4);
imagesc(imf3);
colormap(gray);


h4= fspecial('laplacian');
imf4= filter2(h4, im);
figure(5);
imagesc(abs(imf4));
imagesc(abs(imf4)+ double(im));
colormap(gray);



% image interpolation (resizing)
x= [150, 100, 200; 100, 50, 150; 120, 150, 140];

x1= imresize(x,100,'nearest');
x2= imresize(x,100,'bilinear');
x3= imresize(x,100,'bicubic');


figure(6);
imagesc(x1);
colormap(gray);
figure(7);
imagesc(x2);
colormap(gray);
figure(8);
imagesc(x3);
colormap(gray);

x1= imresize(im,4,'nearest');
x2= imresize(im,4,'bilinear');
x3= imresize(im,4,'bicubic');


figure(9);
imagesc(x1);
colormap(gray);
figure(10);
imagesc(x2);
colormap(gray);
figure(11);
imagesc(x3);
colormap(gray);

%---- Sinc interpolation
N2= 512;
fim= fftshift(fft2(fftshift( im)));
size1= size(im);
fim2= zeros(N2,N2);
fim2(1:size1(1), 1:size1(2))= fim;
figure(12);
image(abs(fim2));
colormap(gray);
im512= abs(fftshift(ifft2(fim2)));
figure(13);
imagesc(im512);
colormap(gray);



