### Create a StudySoup account

#### Be part of our community, it's free to join!

Already have a StudySoup account? Login here

# Introduction to Applied Mathematics MA 325

NCS

GPA 3.93

### View Full Document

## 13

## 0

## Popular in Course

## Popular in Mathematics (M)

This 11 page Class Notes was uploaded by Braeden Lind on Thursday October 15, 2015. The Class Notes belongs to MA 325 at North Carolina State University taught by Staff in Fall. Since its upload, it has received 13 views. For similar materials see /class/223721/ma-325-north-carolina-state-university in Mathematics (M) at North Carolina State University.

## Reviews for Introduction to Applied Mathematics

### What is Karma?

#### Karma is the currency of StudySoup.

#### You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 10/15/15

Lecture 8 Filters in Frequency Domain If b is an image then its Fourier transform will re ect the frequencies of the periodic parts of the image By masking or ltering out the unwanted frequencies one can obtained a new image by applying the inverse Fourier transformation A filter is a matrix with the same dimension as the Fourier transform of the padded image The components of the lter usually vary from 0 to 1 If the component is 1 then the frequency is allowed to pass if the component is 0 then the frequency is tossed out Let Filter represent such a matrix Then the filtered image is given by Newb in Newb i ZFilter t2b 2 nx l 2 ny 1 The Matlab codes fftsinem and fftsine2dm in the previous lectures illustrated this for a low frequency sine wave with higher frequency sine noise Three important types off11ters are low pass high pass and bandreject They are depicted in the following graphic where the low frequencies have been shifted to the center and one is viewing the diagonal section of the filter matrix bandreject l T 7w pass iagshs 39 freq ue ncy The above lters have jumps and are often called idea lters The important lters that make use of polynomial and exponential approximations are the Butterworth and Gaussian lters Let w 610 be given and dist y i nx12 j ny1212 Butterworth Bandreject Filter Filteri j 1 ldisti jwdisti j2 61102 39 Gaussian Bandirej ect Filter 71dzszzLd01dzszzw1 Filterz39j l e The parameters w and d0 control the width and location of the band In the Butterworth bandreject lter the exponent n controls the steepest of the boundaries in the band of frequencies to be rejected There are similar versions of high and low pass lters The Matlab code lterincsum uses a low pass lter to mask the noise from sine and cosine functions with frequency equal to 80 160 in the padded Fourier transform 1000 2000 400 0 0 500 Li 2000 i 2000 Matlab Code filterncsum Clear ncsu bign5 bigc7 bigs9 bigull newncsu 20ncsu nx ny sizenewncsu nx HY newncsu newncsunx ll newncsul uint8newncsu imwritenewncsul 39ncsujpg39 u newncsu for i lznx This is NCSU with periodic noise for j lzny uij uij 15lsin2pii lnx80 15lsin2pijlny80 end end sinencsu uint8u imwritesinencsu 39sinencsujpg39 fftu fft2u2nx l2ny l fftu fftshiftfftu subplot22l meshu39 subplot222 meshloglabsfftu filter ones2nx l2ny l dO 150 Use ideal low pass filter for i l2nx l for j l2ny l dist i nxlA2 j nylA2A5 if dist gt dO filterij 0 end end end subplot223 meshfilter filincsu filterfftu subplot224 meshloglabsfil7ncsu filincsu ifftshiftfil7ncsu filincsu ifft2filincsu2nx l2ny l filincsu realfilincsulnxlny filincsu uint8fil7ncsu imwritefil7ncsu 39sinencsuifiljpg39 The ltered image sinencsui ljpg is not entirely satisfactory Another approach is to use a bandrej ect lter Where one may need to experiment With the Width W and the location d0 of the band The Matlab code lteribum uses the Butterworth bandrej ect lter and may be applied to either the noisy big sine wave or the noisy ncsu 1000 2000 1500 i 1500 Matlab Code lterbum Clear ncsu bign5 bigc7 bigs9 bigull newncsu 20ncsu nx ny sizenewncsu nx HY newncsu newncsunx ll newncsul uint8newncsu imwritenewncsul 39ncsujpg39 u newncsu for i lznx for j lzny This is the big wave with periodic noise l OlOOlsin2pijlny5 15lsin2piilnx80 15lsin2pijlny80 This is NCSU with periodic noise uij uij 15lsin2piilnx80 15lsin2pijlny Uij o0 o0 end end sinencsu uint8u imwritesinencsu 39sinencsujpg39 fftu fft2u2nx l2ny l fftu fftshiftfftu subplot22l meshu39 subplot222 meshloglabsfftu filter ones2nx l2ny l Use Butterworth band reject filter dO 160 a n 4 w 20 for i l2nx l for j l2ny l dist i nxlA2 j nylA2A5 if dist dO filterij ll else filterij O distWdistA2 dOA2A2n end end end subplot223 meshfilter filincsu filterfftu subplot224 meshloglabsfil7ncsu filincsu ifftshiftfil7ncsu filincsu ifft2filincsu2nx l2ny l filincsu realfilincsulnxlny filincsu uint8fil7ncsu imwritefil7ncsu 39sinencsuifiljpg39 Another application of the bandrej ect lter is to the noisy aerial photograph This image suffers from too much light an eXposure and from banded sine and cosine noise The light is modi ed by use of the power transformation with the power equal to two and then the Butterworth bandreject filter is used to reduce to noise 2000 Matlab Code lteraerialm Clear aerial aerial nx my nx HY u 7 imread39Fig309ajpg39 doubleaerial sizeaerial aerial for i for lznx l n o0 L This is aerial with periodic noise uij uij 2pi M i l x200 lsin2pijl i l i l wwww 2pi xj lsin 2pi n n n nx j end end sineaerial uint8u imwritesineaerial 39sineaerialjpg39 C l Use the power transformation to darken gamma 2 fifp 255 0u255Agamma u fifp fftu fft2u2nx l2ny l fftu fftshiftfftu subplotl2l meshloglabsfftu filter d0 7 ones2nx l2ny l 400 9 o 7 Use Butterworth band reject filter 7 4 w 20 for i l2nx l for j l2ny l dist i nxlA2 j nylA2A5 if dist dO filterij ll distWdistA2 dOA2A2n else filterij 0 end end end filiaerial filterfftu subplotl22 meshloglabsfil7aerial fil aerial ifftshiftfil aerial filaerial 7 ifft2 filiaerial 2nx l 2ny l fil aerial realfil aeriallnxlny filaerial uint8fil7aerial imwritefil7aerial 39sineaerialifiljpg39 The Matlab code lterimicrom uses a high pass lter to give emphasis to the higher frequencies in the image of a damaged electronic chip The high pass image is then added to the original image so as to obtain a sharper image The reader may nd it interesting to experiment With Width and frequency threshold of the Butterworth or the Gaussian high pass lters Also it is interesting to compare this sharpening Which is done in the frequency domain With the sharpening done in the space domain as in the third lecture FFT of Image High Pass Filter of FFT Image Matlab Code filtermicr0m clear micro 7 imread39Fig404ajpg39 micro doublemicro nx ny sizemicro nx my u micro micro uint8u imwritemicro 39microjpg39 fftu fft2u2nx l2ny l fftu fftshiftfftu subplotl2l meshloglabsfftu 0 Use Butterworth or Gaussian high pass filter filter ones2nx l2ny l dO lOO n 4 for i l2nx l for j l2ny l dist o i HX1A2 jnylA2A5 Use Butterworth high pass filter filterij 11 distdOA2n filterij lO filterij 9 Use Gaussian high pass filter filterij exp distA22dOA2 filterij lO filterij end end 9 0 Update image with high frequencies filimicro fftu filterfftu subplotl22 meshloglabsfilimicro fftu fil micro ifftshiftfil micro filmicro ifft2filimicro2nx l2ny l fil micro realfil microlnxlny filmicro uint8fil7micro imwritefil7micro 39microifiljpg39

### BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.

### You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

## Why people love StudySoup

#### "I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"

#### "I made $350 in just two days after posting my first study guide."

#### "There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."

#### "It's a great way for students to improve their educational experience and it seemed like a product that everybody wants, so all the people participating are winning."

### Refund Policy

#### STUDYSOUP CANCELLATION POLICY

All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email support@studysoup.com

#### STUDYSOUP REFUND POLICY

StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here: support@studysoup.com

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to support@studysoup.com

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.