Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Image Filtering - Digital Signal Processing - Lab Handouts, Lecture notes of Digital Signal Processing

Main points of this handout are: Image Filtering, Low Pass Filter, Sharpening Filter, Point Spread Function, Image Processing Operations, Analytical Expression, Frequency Response, Command Line Arguments, Matlab Code, Arbitrary Value

Typology: Lecture notes

2012/2013

Uploaded on 05/18/2013

maazi
maazi 🇮🇳

4.4

(12)

77 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
ECE-S490 Digital Image Processing
Laboratory 2
Image Filtering
1 Introduction
In this laboratory, you will filter gray scale images using both FIR and IIR filters. We will also use
Matlab to plot various functions. When processing images on a computer, there are usually
special cases that must be properly handled. In particular, all filters will be implemented using
free boundary conditions along edges, and pixels will be clipped to a range of [0, 255].
Free boundary conditions - In order to understand a free boundary condition, consider an
M x N image denoted by img(i, j) where i = 1,.., M and j = 1,…,N. Some filtering
operations require that you index outside of this valid range. Pixels indexed outside this
range should be considered equal to zero.
Clipping - Image processing operations will sometimes cause a pixel to exceed the value
255 or go below the value 0. In these cases, you could clip the pixel's value.
y(m, n) = 0 if x(m, n) < 0
y(m, n) = 255 if x(m, n) > 255
y(m, n) = x(m; n) if 0 <= x(m, n) <= 255
2 FIR Low Pass Filter
In this problem, you will analyze and implement a simple low pass filter given by the 9 x 9 point
spread function:
h(m, n) = 1/81 for m, n = -4, …, -1,0,1,…,4
h(m, n) = 0 otherwise
1. Calculate an analytical expression for H(ejµ ; ejν) the DSFT of h(m; n), and use Matlab to plot
the magnitude of the frequency response |H(ejµ ; ejν)| . Make sure to label the axis properly and
plot over the region [ -π ; π] x [ -π ; π] .
2. Load pout.tif image to Matlab by using the command “imread”.
4. Write a Matlab program to perform FIR filtering. Command line arguments should accept an
input image and a FIR filter kernel. Filter pout.tif with the h(m,n) given above.
5. Print out the original and the resulting filtered image.
Docsity.com
pf3

Partial preview of the text

Download Image Filtering - Digital Signal Processing - Lab Handouts and more Lecture notes Digital Signal Processing in PDF only on Docsity!

ECE-S490 Digital Image Processing

Laboratory 2

Image Filtering

1 Introduction

In this laboratory, you will filter gray scale images using both FIR and IIR filters. We will also use Matlab to plot various functions. When processing images on a computer, there are usually special cases that must be properly handled. In particular, all filters will be implemented using free boundary conditions along edges, and pixels will be clipped to a range of [0, 255].

  • Free boundary conditions - In order to understand a free boundary condition, consider an M x N image denoted by img(i, j) where i = 1,.., M and j = 1,…,N. Some filtering operations require that you index outside of this valid range. Pixels indexed outside this range should be considered equal to zero.
  • Clipping - Image processing operations will sometimes cause a pixel to exceed the value 255 or go below the value 0. In these cases, you could clip the pixel's value.

y(m, n) = 0 if x(m, n) < 0 y(m, n) = 255 if x(m, n) > 255 y(m, n) = x(m; n) if 0 <= x(m, n) <= 255

2 FIR Low Pass Filter

In this problem, you will analyze and implement a simple low pass filter given by the 9 x 9 point spread function:

h(m, n) = 1/81 for m, n = -4, …, -1,0,1,…, h(m, n) = 0 otherwise

  1. Calculate an analytical expression for H(ejμ^ ; ejν) the DSFT of h(m; n), and use Matlab to plot the magnitude of the frequency response |H(ejμ^ ; ejν)|. Make sure to label the axis properly and plot over the region [ -π ; π] x [ -π ; π].
  2. Load pout.tif image to Matlab by using the command “imread”.
  3. Write a Matlab program to perform FIR filtering. Command line arguments should accept an input image and a FIR filter kernel. Filter pout.tif with the h(m,n) given above.
  4. Print out the original and the resulting filtered image.

Section 2 Report: Hand in:

  1. A plot of |H(ejμ^ ; ejν)|.
  2. A print out of pout.tif.
  3. A print out of the filtered image.
  4. A print out of your Matlab code.

3 FIR Sharpening Filter

In this problem, you will analyze the effect of a sharpening filter known as an “unsharp mask”. The terminology comes from the fact that an unsharp mask filter removes the unsharp (low frequency) components of the image, and therefore produces an image with a sharper appearance. Let h(m, n) be a low pass filter. For our purposes use

h(m, n) = 1/25 for m, n = -2,-1,0,1, h(m, n) = 0 otherwise

The unsharp mask filter is then given by

g(m, n) = δ(m, n) + λ(δ(m, n) - h(m, n))

where λ is a constant greater than zero.

  1. Calculate an analytical expression for H(ejμ^ ; ejν) the DSFT of h(m, n), and use Matlab to plot the magnitude of the frequency response |H(ejμ^ ; ejν)|. Make sure to label the axis properly and plot over the region [ -π ; π] x [ -π ; π].
  2. Calculate an analytical expression for G(ejμ^ ; ejν) the DSFT of g(m; n). Use Matlab to plot |G((ejμ^ ; ejν)| for λ = 0.8. Make sure to label the axis properly and plot it over the region [ -π ; π] x [ -π ; π].
  3. Write a Matlab program for unsharp filtering. The command line should accept, the original image, an arbitrary FIR kernel h, and an arbitrary value of λ.
  4. Load eight.tif to Matlab by using the command “imread”. Apply your sharpening filter to eight.tif for λ = 0.2, 0.8, 1.5. Display and compare each result to the original image.