Experiment No.9: Write A MATLAB Program To Add Noise To An Image and Remove It Using
Experiment No.9: Write A MATLAB Program To Add Noise To An Image and Remove It Using
EXPERIMENT NO.9
AIM:- Write a MATLAB program to add noise to an image and remove it using
MEDIAN FILTER
Color corrections such as brightness and contrast adjustments, color mapping, color balancing, quantization, or color translation to a different color space Digital compositing or optical compositing (combination of two or more images), which is used in film-making to make a "matte" Image registration, the alignment of two or more images Image recognition, for example, may extract the text from the image using optical character recognition or checkbox and bubble values using optical mark recognition Image segmentation
The Digital
image
processing is
the
use
of
computer algorithms to
perform image
processing on digital images. As a subcategory or field of digital signal processing, digital image processing has many advantages over analog image processing. It allows a much wider range of algorithms to be applied to the input data and can avoid problems such as the build-up of noise and signal distortion during processing.
NYSSCER, Nagpur
Syntax
imshow(I) imshow(RGB)
Description
imshow(I) displays the grayscale image I. imshow(RGB) displays the truecolor image RGB.
2.imread
Read image from graphics file
Syntax
A = imread(filename, fmt)
Description
A = imread(filename, fmt) reads a grayscale or color image from the file specified by the string filename. If the file is not in the current directory, or in a directory on the MATLAB path, specify the full pathname.
3.imnoise
Add noise to image
Syntax
J = imnoise(I,type)
Description
NYSSCER, Nagpur
J = imnoise(I,type) adds noise of a given type to the intensity image I. type is a string that can have one of these values.
4. medfilt2
2-D median filtering
Syntax
B = medfilt2(A, [m n])
Description
B = medfilt2(A, [m n]) performs median filtering of the matrix A in two dimensions. Each output pixel contains the median value in the m-by-n neighborhood around the corresponding pixel in the input image. medfilt2 pads the image with 0s on the edges, so the median values for the points within [m n]/2 of the edges might appear distorted.
5.imfilter
N-D filtering of multidimensional images
Syntax
B = imfilter(A, H) B = imfilter(A, H, option1, option2,...)
Description
B = imfilter(A, H) filters the multidimensional array A with the multidimensional filter H. The array A can be logical or a nonsparse numeric array of any class and dimension. The result B has the same size and class as A. Each element of the output B is computed using double-precision floating point. If A is an integer or logical array, then output elements that exceed the range of the integer type are truncated, and fractional values are rounded.
NYSSCER, Nagpur
%EXPT 9:Write a MATLAB program to add noise to an image and remove it using MEDIAN FILTER clc; clear all; close all; a=imread('eight.tif'); subplot(1,3,1); imshow(a); b=imnoise(a,'salt & pepper',0.02); subplot(1,3,2); imshow(b); c=medfilt2(b,[3 3]); subplot(1,3,3); imshow(c);
NYSSCER, Nagpur
%EXPT 9:Write a MATLAB program to add noise to an image and remove it using MEDIAN FILTER clc; clear all; close all; a=imread('C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Water lilies.jpg'); subplot(1,3,1); imshow(a); b=imnoise(a,'salt & pepper',0.02); subplot(1,3,2); imshow(b); h = ones(5,5)/25; c=imfilter(a,h); subplot(1,3,3); imshow(c);
CONCLUSION:
Studied about the MEDIAN FILTER and addition & removal of noise to a grey and RGB image.
NYSSCER, Nagpur