Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- close all;
- clear all;
- A1 = imread('plansza.tif');
- H = fspecial('average',3);
- H5 = fspecial('average',5);
- H9 = fspecial('average',9);
- H15 = fspecial('average',15);
- H35 = fspecial('average',35);
- A1s = uint8(conv2(A1,H,'same'));
- A1s1 = uint8(conv2(A1,H5,'same'));
- A1s2 = uint8(conv2(A1,H9,'same'));
- A1s3 = uint8(conv2(A1,H15,'same'));
- A1s4 = uint8(conv2(A1,H35,'same'));
- A1d = imabsdiff(A1,A1s);
- A1d1 = imabsdiff(A1,A1s1);
- A1d2 = imabsdiff(A1,A1s2);
- A1d3 = imabsdiff(A1,A1s3);
- A1d4 = imabsdiff(A1,A1s4);
- figure(1)
- subplot(1,3,1)
- imshow(A1);
- title("obraz startowy")
- subplot(1,3,2);
- imshow(A1s);
- title("obraz po filtracji")
- subplot(1,3,3);
- imshow(A1d);
- title("obraz po różnicy")
- figure(2)
- subplot(1,3,1)
- imshow(A1);
- title("obraz startowy")
- subplot(1,3,2);
- imshow(A1s1);
- title("obraz po filtracji")
- subplot(1,3,3);
- imshow(A1d1);
- title("obraz po różnicy")
- figure(3)
- subplot(1,3,1)
- imshow(A1);
- title("obraz startowy")
- subplot(1,3,2);
- imshow(A1s2);
- title("obraz po filtracji")
- subplot(1,3,3);
- imshow(A1d2);
- title("obraz po różnicy")
- figure(4)
- subplot(1,3,1)
- imshow(A1);
- title("obraz startowy")
- subplot(1,3,2);
- imshow(A1s3);
- title("obraz po filtracji")
- subplot(1,3,3);
- imshow(A1d3);
- title("obraz po różnicy")
- figure(5)
- subplot(1,3,1)
- imshow(A1);
- title("obraz startowy")
- subplot(1,3,2);
- imshow(A1s4);
- title("obraz po filtracji")
- subplot(1,3,3);
- imshow(A1d4);
- title("obraz po różnicy")
- %filtracja dolno przepustowa poprawia obraz wygładza jego krawędzie
- A2 = imread('lena.bmp');
- M = [1 2 1; 2 4 2; 1 2 1];
- M = M/sum(sum(M));
- A2s = uint8(conv2(A2,M,'same'));
- figure(6)
- subplot(1,2,1)
- imshow(A2)
- title("obraz startowy")
- subplot(1,2,2)
- imshow(A2s);
- title("po filtracji")
Advertisement
Add Comment
Please, Sign In to add comment