- Mask = [-1 -1 -1; -1 8 -1; -1 -1 -1];
- lena = imread('lena.pgm');
- lena2=conv2(lena,Mask);
- figure(1);
- imshow(lena);
- figure(2);
- imshow(uint8(lena2));
- F = fftshift(fft2(lena));
- M = log(abs(F)+1);
- M = (M./max(max(M)))*255;
- figure(3);
- imshow(uint8(M));
- F = fftshift(fft2(lena2));
- M = log(abs(F)+1);
- M = (M./max(max(M)))*255;
- figure(4);
- imshow(uint8(M));
- Mask = [-1 0 1; -2 0 2; -1 0 1];
- lena = imread('boats.pgm');
- lena2=conv2(lena,Mask);
- figure(1);
- imshow(lena);
- figure(2);
- imshow(uint8(lena2));
- F = fftshift(fft2(lena));
- M = log(abs(F)+1);
- M = (M./max(max(M)))*255;
- figure(3);
- imshow(uint8(M));
- F = fftshift(fft2(lena2));
- M = log(abs(F)+1);
- M = (M./max(max(M)))*255;
- figure(4);
- imshow(uint8(M));
- mask5x5 = [1/25 1/25 1/25 1/25 1/25;
- 1/25 1/25 1/25 1/25 1/25;
- 1/25 1/25 1/25 1/25 1/25;
- 1/25 1/25 1/25 1/25 1/25;
- 1/25 1/25 1/25 1/25 1/25];
- mask7x7 = [1/49 1/49 1/49 1/49 1/49 1/49 1/49;
- 1/49 1/49 1/49 1/49 1/49 1/49 1/49;
- 1/49 1/49 1/49 1/49 1/49 1/49 1/49;
- 1/49 1/49 1/49 1/49 1/49 1/49 1/49;
- 1/49 1/49 1/49 1/49 1/49 1/49 1/49;
- 1/49 1/49 1/49 1/49 1/49 1/49 1/49;
- 1/49 1/49 1/49 1/49 1/49 1/49 1/49];
- mask9x9 = [1/81 1/81 1/81 1/81 1/81 1/81 1/81 1/81 1/81;
- 1/81 1/81 1/81 1/81 1/81 1/81 1/81 1/81 1/81;
- 1/81 1/81 1/81 1/81 1/81 1/81 1/81 1/81 1/81;
- 1/81 1/81 1/81 1/81 1/81 1/81 1/81 1/81 1/81;
- 1/81 1/81 1/81 1/81 1/81 1/81 1/81 1/81 1/81;
- 1/81 1/81 1/81 1/81 1/81 1/81 1/81 1/81 1/81;
- 1/81 1/81 1/81 1/81 1/81 1/81 1/81 1/81 1/81;
- 1/81 1/81 1/81 1/81 1/81 1/81 1/81 1/81 1/81;
- 1/81 1/81 1/81 1/81 1/81 1/81 1/81 1/81 1/81];
- mask11x11 = [1/121 1/121 1/121 1/121 1/121 1/121 1/121 1/121 1/121 1/121 1/121;
- 1/121 1/121 1/121 1/121 1/121 1/121 1/121 1/121 1/121 1/121 1/121;
- 1/121 1/121 1/121 1/121 1/121 1/121 1/121 1/121 1/121 1/121 1/121;
- 1/121 1/121 1/121 1/121 1/121 1/121 1/121 1/121 1/121 1/121 1/121;
- 1/121 1/121 1/121 1/121 1/121 1/121 1/121 1/121 1/121 1/121 1/121;
- 1/121 1/121 1/121 1/121 1/121 1/121 1/121 1/121 1/121 1/121 1/121;
- 1/121 1/121 1/121 1/121 1/121 1/121 1/121 1/121 1/121 1/121 1/121;
- 1/121 1/121 1/121 1/121 1/121 1/121 1/121 1/121 1/121 1/121 1/121;
- 1/121 1/121 1/121 1/121 1/121 1/121 1/121 1/121 1/121 1/121 1/121;
- 1/121 1/121 1/121 1/121 1/121 1/121 1/121 1/121 1/121 1/121 1/121;
- 1/121 1/121 1/121 1/121 1/121 1/121 1/121 1/121 1/121 1/121 1/121];
- lena = imread('lena.pgm');
- lena2=conv2(lena,mask5x5);
- lena3=conv2(lena,mask7x7);
- lena4=conv2(lena,mask9x9);
- lena5=conv2(lena,mask11x11);
- figure(1);
- imshow(lena);
- figure(2);
- imshow(uint8(lena2));
- figure(3);
- imshow(uint8(lena3));
- figure(4);
- imshow(uint8(lena4));
- figure(5);
- imshow(uint8(lena5));