Sem 7‎ > ‎

Digital Image Processing

WAP to show filtered image after passing through ideal low pass filter

posted Oct 30, 2013, 4:49 PM by Neil Mathew

a=imread('C:\Users\Desktop\lena2.png');

b=double(a);

[m n]=size(a);

d0=input('enter the cut off frequency');

for u=1:1:m
    for v=1:1:n
        d=((u-m/2)^2+(v-n/2)^2)^0.5;
  
      if(d<d0)
            H(u,v)=1;
        else
            H(u,v)=0;

        end
    end
end

fouriertrans=fft2(b,size(H,1),size(H,2));

shiftedfouriertrans=fftshift(fouriertrans);

x=shiftedfouriertrans.*H;

X=abs(ifft2(x));

filtered_image=uint8(X);

filtered_image = filtered_image(1:size(a, 1), 1:size(a, 2));
subplot(2,2,1);
imshow(a);

title('original image');
subplot(2,2,2);
imshow(filtered_image);
title('Filtered Image'); 

subplot(2,2,3);
imshow(H);
title('Ideal low pass filter');

subplot(2,2,4);
mesh(H),colormap(gray);
title 'Ideal low pass frequency response';


00 Understanding it all

posted Oct 30, 2013, 8:02 AM by Neil Mathew   [ updated Oct 30, 2013, 6:15 PM ]

WAP to display the antilog transformation of an image.

posted Oct 30, 2013, 7:58 AM by Neil Mathew   [ updated Oct 30, 2013, 8:02 AM ]

Source

Preview:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
a=imread('C:\Users\Desktop\lena.png');
subplot(2,2,1);
imshow(a);
title('original image');
b=im2double(a);
subplot(2,2,2);
imshow(b);
title('Double of image');
c=log10(1+b);
subplot(2,2,3);
imshow(c);
title('log10 of an image');
d=exp(b)/10;
subplot(2,2,4);
imshow(d);
title('antilog of an image');



WAP to display log transformation of an image.

posted Oct 30, 2013, 7:56 AM by Neil Mathew   [ updated Oct 30, 2013, 8:02 AM ]

Preview:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
a=imread('C:\Users\Desktop\lena.png');
subplot(2,2,1);
imshow(a);
title('original image');
b=im2double(a);
subplot(2,2,2);
imshow(b);
title('double of an image');
c=log(1+b);
subplot(2,2,3);
imshow(c);
title('log of an image'); 
d=log2(1+b);
subplot(2,2,4);
imshow(d);
title('log to the base 2');

WAP to display negative of image

posted Oct 30, 2013, 7:53 AM by Neil Mathew   [ updated Oct 30, 2013, 7:54 AM ]

Source Code:


a=imread('C:\Users\Desktop\lena.png');
subplot(2,2,1);
imshow(a);
title('original image');
 b=rgb2gray(a);
subplot(2,2,2);
imshow(b);
title('gray scale image');
 c=255-a;
subplot(2,2,3);
imshow(c);
title('negative of image');
 d=255-b;
subplot(2,2,4);
imshow(d);
title('negaative of gray scale image');

Output:


1-5 of 5