This is the coding assignment for Homework 4 for CSE3313 (Introduction to Signal Processing). There are 2 coding assignment questions for this hw, the first is Design of Lowpass and Highpass FIR filters and the second is Image Processing using these filters
Learn how to produce the filter coefficients needed to construction lowpass and highpass filters.
That is, a common signal processing task is to remove the components of a signal whose frequency is outside a particular range. A lowpass filter removes the components whose frequency is higher than a certain cut-off frequency while a highpass filter removes the components whose frequency is below a certain cut-off frequency.
- First we design a low-pass filter with the following specifications
- A cut-frequency of fc = 50 Hz
- Filter length of L = 21, and M = filter length - 1
- 0 ≤ n < L
The filter weights w[n] are found using the formula:
Where ft = fc / fs is the normalized cut-off freq.
- Then we use
numpy.convolve()
function to apply the filter. - For the highpass filter, we design a highpass filter with the following specifications:
- A cut-off freq of fc = 280 Hz
- Filter len of 21 and M = filter len - 1
The filter weights w[n] are found from:
Where ft = fc / fs is the normalized cut-off freq.
- Then once again, apply this highpass filter using
numpy.convolve()
to the original signal.
Learn to apply simple filters to images.
-
We display the original images from the tiff images given (boat, clock, man, and tank) in their own figure window
-
We then blur the images using a lowpass filter
- The lowpass filter is a 10-point moving average (that is, h[n] consists of 10 values of 0.1 each)
- Apply this filter to each row of the image using the convolve function
- Display the processed image in its own figure window
-
Then we perform edge detection using a highpass filter
- For this filter, h[n] = {1, -1}
- Apply this filter to each row of the original image
- Display the processed image in its own figure window.
-
We do these steps for each individual image given
-
Finally for the image darinGreyNoise.jpg we do the following:
- remove the noise
i. Display the original image in its own figure window. This image contains what is called “salt and pepper” noise.
ii. Remove the noise by averaging it out using a low-pass filter. So we apply the 10-point running average to each row of the image.
iii. Apply a medin filter (which is a nonlinear filter) to the original noisy image usingoutputImage = ndimage.median filter(inputImage, 5)
whereimputImage
andoutputImage
are the names we choose. We use the importfrom scipy import ndimage
- remove the noise