Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
11 views1 page

Multimedia

The document discusses using the filter2 instruction in MATLAB to perform two-dimensional digital image filtering. It explains the syntax and usage of filter2, and provides an example program that loads a grayscale image, designs a filter mask, applies the filter to the image using filter2, and displays the filtered result. It also provides questions for a report on the program.
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)
11 views1 page

Multimedia

The document discusses using the filter2 instruction in MATLAB to perform two-dimensional digital image filtering. It explains the syntax and usage of filter2, and provides an example program that loads a grayscale image, designs a filter mask, applies the filter to the image using filter2, and displays the filtered result. It also provides questions for a report on the program.
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
You are on page 1/ 1

Multimedia Computing Lab.

Ruaa Hussam Al-Mallah/Lecturer


Computer Technical Eng. Dept.
4th Class

Experiment No. 12
Image Filtering (Filter2)
Introduction:-
Filtering is a technique for modifying or enhancing an image. For example, you can filter an image
to emphasize certain features or remove other features. Image processing operations implemented
with filtering include smoothing, sharpening, and edge enhancement ,Now, we will use the filter2
instruction in this experiment.
Filter2 :Which is Two-dimensional digital filtering ,You can digitally filter images and other 2-D
data using the filter2 function, which is closely related to the conv2 function.
Notes about Filter2 instruction:-
1. Not depend to color image (RGB).
2. Not scale to [0- 255].
3. Get actual, float points results.
4. Work only with image of types double(0 means black, 1 means white).
Syntax
Y = filter2(H,X)
Y = filter2 (H,X,shape)
Description
Y = filter2(H,X) filters the data in X with the two-dimensional FIR(finite impulse response)
filter in the matrix H. It computes the result, Y, using two-dimensional correlation, and returns
the central part of the correlation that is the same size as X.
Y=filter2(H,X,shape) returns the part of Y specified by the shape parameter. Shape is a
string with one of these values:-
'full' Returns the full two-dimensional correlation. In this case, Y is larger than X.
'same' (default) Returns the central part of the correlation. In this case, Y is the same size as X.
'valid' Returns only those parts of the correlation that are computed without zero-padded
edges. In this case, Y is smaller than X.
Procedure and Result:-
1. Load the grayscale image of double type to workspace.
Grayscale=imread('cameraman.tif');
Grayscale1=im2double(Grayscale);
2. Display grayscale image that is read in step i by the following code:-
figure imshow(Grayscale1)
3. Design mask filter for that image, which is by the following code:
h=ones(3,3)/9;
4. Using filter2 for filtering the image then display it,as following:-
Filter=filter2(h,Grayscal1);figure
Report
1. In the above program, why we had im2double with the image? Explain it.
2. Rewrite the above code to make the filtered image larger than the grayscale image.
3. Write a program to filter an color image (RGB)(‘peppers.png’) using filter2, and discuss
your work.

Exp. No. 12 : Image Filter(Filter2) Page 42

You might also like