100% found this document useful (2 votes)
9K views

Pre Processing Filters Matlab Code

This document contains MATLAB code to apply noise reduction and edge detection filters to images. It adds Gaussian noise to an image of Saturn, then uses a Wiener filter to reduce the noise. It also applies Prewitt and Canny edge detection filters to a grayscale version of the painting "Water Lilies" to find edges.

Uploaded by

Saba
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
9K views

Pre Processing Filters Matlab Code

This document contains MATLAB code to apply noise reduction and edge detection filters to images. It adds Gaussian noise to an image of Saturn, then uses a Wiener filter to reduce the noise. It also applies Prewitt and Canny edge detection filters to a grayscale version of the painting "Water Lilies" to find edges.

Uploaded by

Saba
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

%% apply wiener filter . clc; newImageRGB = imread('saturn.

png'); %% convert image to gray level grayImage = rgb2gray(newImageRGB); figure; imshow(grayImage); %% adding noise to image . afferNoise = imnoise(grayImage,'gaussian',0,0.025); figure; imshow(afferNoise) %% applying wiener filter ot image. afterWiener = wiener2(afferNoise,[6 6]); figure, imshow(afterWiener) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% clc; %% create a new figure to show the image . newImg = imread('Water lilies.jpg'); figure(1); %% convert RGB to gray scale. grayImage= rgb2gray(newImg) imshow(grayImage); figure(2); %% apply prewitt filter. afterFilter = edge(grayImage,'prewitt') imshow(afterFilter); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% apply canny filter . clc; %% create a new figure to show the image . newImg = imread('Water lilies.jpg'); figure(1); %% convert RGB to gray scale. grayImage= rgb2gray(newImg) imshow(grayImage); figure(2); %% apply canny filter. cannyResult = edge(grayImage,'canny') imshow(cannyResult);

You might also like