Title: Filtering of images containing Gaussian white noise
Thinking: Adding Gaussian white noise to the image first, median filtering, Gaussian filtering, mean filtering, morphological filtering, and the median filter operation after the closed operation.
The results of the experiment are shown below:
The MATLAB code is as follows:
Clear CLC
Close all;
im = Imread (' apple.jpg '); Percent added Gaussian white noise Im_gaus = Imnoise (IM, ' Gaussian ', 0, 0.02);
% adds a Gaussian white noise figure of mean 0 with variance of 0.02 (' numbertitle ', ' off ', ' Name ', ' smooth apple with Gaussian noise ');
Subplot (3, 4, 1); Imshow (IM);
% Display original image title (' Apple-original ');
Subplot (3, 4, 2); Imshow (Im_gaus);
% display adds Gaussian white noise to the image title (' Apple-gaussian Noise '); Percent Image Filter Im_gray = Rgb2gray (Im_gaus); % color graph to grayscale image IM_BW = IM2BW (Im_gray, 0.9);
% grayscale figure to two value figure subplot (3, 4, 3); Imshow (Im_gray);
% Display grayscale Image title (' Apple-gray ');
Subplot (3, 4, 4); Imshow (IM_BW);
% Show binary graph title (' Apple-binary ');
% Median filter im_med = MEDFILT2 (IM_BW);
im_med = MEDFILT2 (im_med);
im_med = MEDFILT2 (im_med);
Subplot (3, 4, 5); Imshow (im_med);
% display median filtered image title (' Apple-medfilt_3 ');
% Gaussian Filter h = fspecial (' Gaussian ', [18 18], 0.15);
Im_gausfilt = IMFilter (IM_BW, h);
Subplot (3, 4, 6); Imshow (im_gausfilt);
% shows the image title (' Apple-gausfilt ') after the Gaussian lowpass filter; im_gf_med = MEDFILT2 (im_gausfilt);
% median filter subplot (3, 4, 7) for Gaussian filtered images; Imshow (im_gf_med); % shows Gaussian + median filtered image title (' Apple-gaus-med ');
% mean filter h = fspecial (' average ', [5, 5]);
Im_mean = IMFilter (IM_BW, h);
Subplot (3, 4, 8); Imshow (Im_mean);
% shows the image title after the mean filter (' Apple-mean '); % morphological Filter SE = strel (' disk ', 2);
% creates a flat disc-shaped structural element with a radius of 2 closed operation: first expansion and corrosion Im_clos = Imclose (IM_BW, SE);
Subplot (3, 4, 9);
Imshow (Im_clos);
Title (' Imclose ');
% closed operation and then median filter im_clos_med = MEDFILT2 (Im_clos);
Subplot (3, 4, 10);
Imshow (im_clos_med);
Title (' imclose+med ');
% open operation: first corrosion and re-expansion im_op = Imopen (IM_BW, SE); % Im_op = Imopen (im_clos_med, SE);
% open operation for hole filling subplot (3, 4, 11);
Imshow (IM_OP);
Title (' Impen '); % use Imfill to fill the image with holes Im_clos_med_fil = Imfill (im_clos_med);