0% found this document useful (0 votes)
12 views6 pages

Gaussian Noise and Wiener Filtering

The document outlines image processing techniques including the addition of Gaussian and Salt & Pepper noise to images, followed by the application of Wiener, average, and median filters for noise reduction. It also demonstrates image enhancement methods such as histogram equalization and adaptive histogram equalization, as well as conversion to HSV color space and manipulation of hue. Finally, it includes steps for converting RGB images to grayscale and displaying histograms.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views6 pages

Gaussian Noise and Wiener Filtering

The document outlines image processing techniques including the addition of Gaussian and Salt & Pepper noise to images, followed by the application of Wiener, average, and median filters for noise reduction. It also demonstrates image enhancement methods such as histogram equalization and adaptive histogram equalization, as well as conversion to HSV color space and manipulation of hue. Finally, it includes steps for converting RGB images to grayscale and displaying histograms.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

%% Gaussian Noise and Wiener Filtering

% Read and convert image to grayscale


I = imread('Bird.png');
J = im2gray(I);
figure, imshow(J);
title('Grayscale Image');

% Add Gaussian noise to grayscale image


K = imnoise(J, "gaussian", 0, 0.0235);
% Display portion of the noisy image
figure;
imshow(K(600:1000, 1:600));
title('Portion of the Image with Gaussian Noise');

% Apply Wiener filter to reduce Gaussian noise


L = wiener2(K, [5, 5]); % <-- Corrected spelling
% Display portion of the denoised image
figure;
imshow(L(600:1000, 1:600));
title('Portion with Gaussian Noise Removed by Wiener Filter');
%% Salt & Pepper Noise with Average and Median Filtering

% Load grayscale image


I2 = imread('Bird.png');
figure, imshow(I2);
title('Original Image (eight.tif)');

% Add Salt & Pepper noise


J2 = imnoise(I2, "salt & pepper", 0.02);
figure, imshow(J2);
title('Image with Salt & Pepper Noise');

% Apply average filter


Avg_filt = filter2(fspecial('average', 3), J2_noise) / 255;
figure, imshow(Avg_filt);
title('Denoised with Average Filter');
% Apply median filter
Median_filter = medfilt2(J2_noise);
figure, imshow(Median_filter);
title('Denoised with Median Filter');

% Compare both filters


figure;
imshowpair(Avg_filt, Median_filter, 'montage');
title('Average Filter (Left) vs Median Filter (Right)');
I=imread("Tiger.jpg");
I=im2gray(I);
I1_imadjust=imadjust(I)
I1_histeq = histeq(I);
I1_adapthisteq = adapthisteq(I);

montage({I,I1_imadjust,I1_histeq,I1_adapthisteq},"Size",[1 4])
title("Original Image and Enhanced Images using imadjust, histeq, and
adapthisteq")

I=imread("Tiger.jpg");
% Convert to HSV color space
subplot(2,3,1);imshow(I)
hsvImage = rgb2hsv(I);

hueImage = hsvImage(:, :, 1);


subplot(2,3,2);imshow(hueImage)

saturationImage = hsvImage(:, :, 2);


subplot(2,3,3);imshow(saturationImage)

valueImage = hsvImage(:, :, 3);


subplot(2,3,4);imshow(valueImage)
someFactor = 1.5; % Whatever you want.
hueImage = hueImage * someFactor;

hueImage = mod(hueImage, 1);

hsvImage = cat(3, hueImage, saturationImage, valueImage);

rgbImage = hsv2rgb(hsvImage);

subplot(2, 3, 5);
imshow(rgbImage);
Img1 = imread("TT.jpg");
subplot(2,3,1);
imshow(Img1); title('RGB Image');

greyI=rgb2gray(Img1);
subplot (2,3,2);
imshow(greyI); title('Grey Image');

Black= im2bw(greyI);
subplot (2,3,3);
imshow(Black); title('Black and White Image');

adj=imadjust(greyI);
subplot(2,3,4);
imshow(adj); title('Adjusted Image')

new=Img1;
new=rgb2gray(new);
subplot(2,3,5);
imhist(new); title('Histogram of the Image')

[height, width, colour_planes]=size(Img1);

%colormap('spring')

You might also like