0% found this document useful (0 votes)
15 views5 pages

Image Filtering and Noise Reduction Techniques

The document contains examples of image processing techniques in MATLAB including filtering, noise addition, edge detection and more. Multiple images are loaded and filtered using techniques like averaging, median, minimum/maximum filters. Noise is added using Gaussian, salt and pepper, speckle models and filtered. Edge detection is performed using Prewitt, Sobel, Canny, Roberts and zero-cross operators.

Uploaded by

moussa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views5 pages

Image Filtering and Noise Reduction Techniques

The document contains examples of image processing techniques in MATLAB including filtering, noise addition, edge detection and more. Multiple images are loaded and filtered using techniques like averaging, median, minimum/maximum filters. Noise is added using Gaussian, salt and pepper, speckle models and filtered. Edge detection is performed using Prewitt, Sobel, Canny, Roberts and zero-cross operators.

Uploaded by

moussa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Exercice 1

I = imread("circuit.tif");
H = [-1 -1 -1; -1 9 -1; -1 -1 -1];
H1 = (1/9)*ones(3,3);

I1 = imfilter(I, H);
I2 = imfilter(I1, H1);

montage({I,I1,I2}, 'Size', [1,3]), title('Image Initiale, Filtrage


Réhausseur, Filtrage Moyenneur', 16)

Exercice 2
I = imread("cameraman.tif");

B1 = imnoise (I, 'gaussian');


B2 = imnoise (I, 'speckle');
B3 = imnoise (I, 'salt & pepper');

montage({I,B1,B2,B3}, 'Size', [1,4]),


title("Image Initiale-Bruit Gaussien-Bruit Speckle-Bruit Salt & Pepper")

1
M5 = (1/25)*ones(5,5);
M7 = (1/49)*ones(7,7);
M9 = (1/81)*ones(9,9);

B1M5 = imfilter(B1, M5);


B1M7 = imfilter(B1, M7);
B1M9 = imfilter(B1, M9);

B2M5 = imfilter(B2, M5);


B2M7 = imfilter(B2, M7);
B2M9 = imfilter(B2, M9);

B3M5 = imfilter(B3, M5);


B3M7 = imfilter(B3, M7);
B3M9 = imfilter(B3, M9);

montage({B1,B1M5,B1M7,B1M9,B2,B2M5,B2M7,B2M9,B3,B3M5,B3M7,B3M9}, 'Size',
[3,4]),
title("Bruit - 5*5 - 7*7 - 9*9")

B1G5 = imfilter(B1, fspecial("gaussian", 5));


B1G7 = imfilter(B1, fspecial("gaussian", 7));
B1G9 = imfilter(B1, fspecial("gaussian", 9));

B2G5 = imfilter(B2, fspecial("gaussian", 5));

2
B2G7 = imfilter(B2, fspecial("gaussian", 7));
B2G9 = imfilter(B2, fspecial("gaussian", 9));

B3G5 = imfilter(B3, fspecial("gaussian", 5));


B3G7 = imfilter(B3, fspecial("gaussian", 7));
B3G9 = imfilter(B3, fspecial("gaussian", 9));

montage({B1,B1G5,B1G7,B1G9,B2,B2G5,B2G7,B2G9,B3,B3G5,B3G7,B3G9}, 'Size',
[3,4]),
title("Bruit - FG 5*5 - FG 7*7 - FG 9*9")

Exercice 3
I = imread("cameraman.tif");

B1 = imnoise (I, 'gaussian');


B2 = imnoise (I, 'speckle');
B3 = imnoise (I, 'salt & pepper');

B1MED = medfilt2(B1);
B2MED = medfilt2(B2);
B3MED = medfilt2(B3);

B1MIN = ordfilt2(B1,1,ones(3,3));
B2MIN = ordfilt2(B2,1,ones(3,3));

3
B3MIN = ordfilt2(B3,1,ones(3,3));

B1MAX = ordfilt2(B1,9,ones(3,3));
B2MAX = ordfilt2(B2,9,ones(3,3));
B3MAX = ordfilt2(B3,9,ones(3,3));

montage({B1,B1MED, B1MIN,B1MAX,B2,B2MED,B2MIN,B2MAX,B3,B3MED,B3MIN,B3MAX},
'Size', [3,4]),
title("Bruit - Median - Minimum - Maximum")

Exercice 4
I = imread("retine.jpg");
R = rgb2gray(I);

prewitt = fspecial("prewitt");
sobel = fspecial("sobel");

Rpx = imfilter(R,prewitt);
Rpy = imfilter(R, prewitt');
Rsx = imfilter(R,sobel);
Rsy = imfilter(R, sobel');

Rp = Rpx + Rpy;
Rs = Rsx + Rsy;

4
Rlog = imfilter(R, fspecial("log"));

Ec= edge(R, "canny");


Er= edge(R, "roberts");
Ez = edge(R, "zerocross");

montage({R,Rp,Rs,Rlog,Ec,Er,Ez}, 'Size', [2,4]),


title("Original-Prewitt-Sobel-LoG-Canny-Roberts-Zerocross")

%%prewitt/sobel génèrent des images au niveau de gris


%%canny/roberts/zerocross génerent des images binaires

You might also like