EECE/CS 253 Image Processing: Richard Alan Peters II
EECE/CS 253 Image Processing: Richard Alan Peters II
n i
This work is licensed under the Creative Commons Attribution-Noncommercial 2.5 License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/2.5/ or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.
Warning:
The jaggies!
zoomed zoomed2 2
20 October 2011
Downsampling (Decimation)
>> >> J J= = I(1:2:R,1:2:C,:); I(1:2:R,1:2:C,:);
Downsampling (Decimation)
>> >> J J= = I(1:2:R,1:2:C,:); I(1:2:R,1:2:C,:);
Recall:
DFT
20 October 2011
Recall:
decimated image
DFT
20 October 2011
power spectrum
6
Recall:
If then
r c F I , ab I av , bu . { }( ) a b
This Thisimplies impliesthat thatif ifan animage imageis isreduced reducedin insize, size,its its features featuresin inthe thespatial spatialdomain domainbecome becomesmaller smallerand and its itsfeatures featuresin inthe thefrequency frequencydomain domainbecome becomelarger. larger.
20 October 2011
Recall:
FT FT
If xy is the extent of the object in space and if xy is its extent in frequency then
x y uv 1 16 2
space
frequency
FT FT
A Asmall smallobject objectin inspace space has hasa alarge largefrequency frequency extent extentand andvice-versa. vice-versa.
1999-2011 by Richard Alan Peters II 8
20 October 2011
Contradiction?
Decimation of an RC image, I, by a factor of n results in an R/n C/n image, J. The DFT of image J is the same size as J. The uncertainty relation implies that the FT of J should be (R-1) (C-1) < n R/n n C/n R C.
Q: How can these 3 facts be true simultaneously? A: The FT of J folds over or aliases itself on the DFT of J because the DFT is defined on a torus.
20 October 2011 1999-2011 by Richard Alan Peters II 9
Discrete FT is on a Torus
Recall: the theDFT DFTof ofaa Recall: digitalimage imageassumes assumes digital theimage imagehas hasaa the toroidaltopology topology toroidal
20 October 2011
10
20 October 2011
which whichimplies impliesthat that the result also has the result also hasaa toroidal toroidaltopology. topology.
11
Point 1 (p. 9)
Discrete FT is on a Torus
Ifthe theimage imageis ismade made If smallerthe thetorus torusis is smaller likewise likewise
20 October 2011
12
Point 2 (p. 9)
Discrete FT is on a Torus
and andthe theDFT DFTis isthe the samesize. size. same
20 October 2011
13
zoomed2 2 zoomed
Onemight mightassume assume One thatthe thesmaller smallerDFT DFT that isthe thecentral centralregion region is ofthe thelarger larger but but of itsnot. not. its
20 October 2011
14
Allof ofthe thelarger largerone oneis is All presentin inthe thesmaller smallerone. one. present
high freqs. low freqs. of cols. high freqs. of rows of cols & rows
20 October 2011
1999-2011 by Richard Alan Partition intoII thesefour fourparts, parts, Partition {{ II }}Peters into these
15
Actual PS of 2 Dec:
20 October 2011
four fourparts partsthat thatare arecontiguous contiguous on onthe thefull-sized full-sizedDFT DFTtorus. torus.
16
Eachof ofthe the4 4PS PSregions regions Each formsaatorus. torus.The The4 4torii torii forms aresuperpositioned superpositionedonto onto1. 1. are
high freqs. low freqs. of cols. high freqs. of rows of cols & rows
20 October 2011
17
The4 4superpositioned superpositionedtorii torii The aliasthe thehigh highfrequencies frequencies alias ontothe thelow lowfrequencies. frequencies. onto
20 October 2011 1999-2011 by Richard Alan Peters II 18
original original
20 October 2011
original original
20 October 2011
20 October 2011
21
20 October 2011
22
27
20 October 2011 1999-2011 by Richard Alan Peters II 23
20 October 2011
24
(r jN ) (c kN )
j = k =
Thisresults resultsin inan an This imagewhose whosepixels pixels image havethe thevalues valuesof of have theoriginal originalimage imageat at the theimpulse impulselocations. locations. the
20 October 2011
25
F{ f g } = F G.
Moreover,
F { f g } = F G.
represents convolution represents pointwise multiplication
The Fourier Fourier Transform Transform of of The a product product equals equals the the a convolution of of the the Fourier Fourier convolution Transforms. Similarly, Similarly, the the Transforms. Fourier Transform Transform of of a a Fourier convolution is is the the product product convolution of the the Fourier Fourier Transforms Transforms of
20 October 2011
26
Cf. slide 23
20 October 2011 1999-2011 by Richard Alan Peters II 27
Convolution by an Impulse
An impulse is a digital image, that has a single pixel with value 1; all others have value zero. An impulse at location (, ) is represented by:
( r , c ) =
1, if r = and c = 0, otherwise
If an image is convolved with an impulse at location (, ), the image is shifted in location down by pixels and to the right by pixels.
[I (r , c )] (r , c) = I (r , c ).
20 October 2011 1999-2011 by Richard Alan Peters II 28
Convolution by an Impulse
The convolution of any function with a delta function translates the function to the location of the impulse.
20 October 2011 1999-2011 by Richard Alan Peters II 29
j = k =
F {I}(u, v ) u
j k v N N
If Ifthe the support supportof of F {I} has has a aradius radius N )) 1/(2 1/(2 N then then there therewill will be beoverlap overlap aliasing aliasing
20 October 2011
30
j = k =
F {I}(u, v ) u
j k v N N
20 October 2011
31
as computed (aliasing)
Although the FT of the sampled image continues on indefinitely in theory, only one copy of the complete pattern is required for processing. The Fast Fourier Transform (FFT) algorithm computes the transform with the origin in the upper left. Usually the transform is displayed with the origin in the center.
20 October 2011 1999-2011 by Richard Alan Peters II 32
original image
20 October 2011
power spectrum
1999-2011 by Richard Alan Peters II 34
to decimate original by 2
20 October 2011
zoomed zoomed2 2
notice ringing in the result
20 October 2011 1999-2011 by Richard Alan Peters II
ideal filter
36
zoomed zoomed2 2
PS of FT Gaussian
20 October 2011
by a Gaussian w/ (v,u)=(R, C)
39
zoomed zoomed2 2
PS of FT Gaussian
20 October 2011
zoomed zoomed2 2
ideal filtered
20 October 2011 1999-2011 by Richard Alan Peters II
original
41
Gaussian w/ (v,u)=(R, C)
1999-2011 by Richard Alan Peters II 42
original
43
decimated by factor of 2
1999-2011 by Richard Alan Peters II 44