Docsity

Fourier Filtering: Understanding Image Processing in the Frequency Domain - Prof. Leona Mc, Study notes of Computer Science

Partial preview of the text

Download Fourier Filtering: Understanding Image Processing in the Frequency Domain - Prof. Leona Mc and more Study notes Computer Science in PDF only on Docsity!

Fourier Filtering

9/8/08 Comp 665 – Fourier Filtering 1 The first Problem set is posted on the web site, and is due on 9/

Fourier Impetus

  • There was one mo<va<ng factor behind our

finding a set of Eigenvectors capable of

describing a wide range of func<ons

  • It is summed up by one Fourier Property:
  • Spa<al domain convolu<on is equivalent to

mul<plica<on in the Fourier domain

x [ n ] ∗ h [ n ] ↔ X [ k ] H [ k ]

Fourier Domain Filters

  • OUen, it is intui<ve to specify filters en<rely in the frequency domain

×^ =

2D Fourier Filters

  • A boxcar image, as a “low‐pass” filter
  • A smaller boxcar image…

2D Fourier Filter Kernels

More Frequency Components

2D Fourier Convolu>on

  • Fourier‐domain Convolu<on
× =

Log(mag(X)) Log(mag(Y = X H))

  • Fourier‐domain Filter

2D Fourier Filtering

× =

Log(mag(X)) Log(mag(Y = X H))

Non‐Separable Convolu>on

  • Some convolu<on kernels cannot be separated into
independent row and column filters (but the DFT s<ll is)

9/9/08 Comp 665 – Fourier Fun 11 11

× =

Log(mag(X)) Log(mag(Y = X H))

Behind the Curtains

  • Simple Python code fragments to process

images

  • Need
    • Python 2.
    • Install “easy_install”
    • Install scipy (includes numpy)
    • Install PIL (Python Imagining Library)

A Simple Image

  • You can type this as a script or execute it

interac<vely using “idle” or ipython (ipython

comes with scipy)

import Image im = Image.open(“mandrillSmall.png”) print im.size, im.format, im.mode im.show()

Convert to a Numerical Array

from pylab import * x = im.convert(“L”) # make image one channel X = fftshift(fft2(asarray(x))) H = fftshift(fft2(asarray(h))) mag = hypot(X.real, X.imag) t = 255.0 * mag / mag.max() Xim = Image.fromarray(numpy.uint8(t),'L') Xim.show() Xim.save(”imgMag.png", "PNG") mag = log10(mag) t = 255.0 * mag / mag.max() Xim = Image.fromarray(numpy.uint8(t),'L') Xim.show() Xim.save("imgLogMag.png", "PNG”)

Next Time

  • More Python tricks
  • The flip side of convolu<on– modula<on
  • Sampling