DIGITAL SIGNAL & IMAGE PROCESSING B Option { 8 Lectures

3y ago
24 Views
2 Downloads
2.11 MB
172 Pages
Last View : 1m ago
Last Download : 3m ago
Upload by : Mya Leung
Transcription

DIGITAL SIGNAL & IMAGE PROCESSINGB Option – 8 lecturesStephen Robertssjrob@robots.ox.ac.uk

Lecture 1 – Foundations1.1Recommended books Lynn. An introduction to the analysis and processing of signals. Macmillan. Oppenhein & Shafer. Digital signal processing. Prentice Hall Orfanidis Introduction to Signal Processing. Prentice Hall. Proakis & Manolakis. Digital Signal Processing: Principles, Algorithms andApplications. Matlab Signal processing toolbox manual.1

1.2IntroductionThis course is ultimately concerned with the problem of computation, inference,manipulation and decision making using 1- and 2-dimensional data streams (’signals’ and ’images’). The course starts by considering the foundations of modernsignal processing theory, defining terms and offering a simple but profound framework under which data may be manipulated. Although theory is very importantin this subject area, an effort is made to provide examples of the major pointsthroughout the course.1.3Summary/Revision of basic definitionsFor the sake of brevity in the nomenclature definitions and theorems are oftengoing to be introduced in their 1-d form (i.e. as signals) with the index variablet or x. Please note that such an indexed set of samples is just a 1-d case ofa generic ordered set which could be 2-d or more, i.e. dependent on a set ofindices or variables, i, j or x, y for example. I try to keep to the convention thatf (x) is a 1-d system with 1-d frequency support indexed by u and f (x, y ) is a2-d system with 2-d frequency support indexed by u, v .2

1.3.1Linear SystemsA linear system may be defined as one which obeys the Principle of Superposition. If f1(x) and f2(x) are inputs to a linear system which gives rise to outputsr1(x) and r2(x) respectively, then the combined input af1(x) bf2(x) will giverise to an output ar1(x) br2(x), where a and b are arbitrary constants.Notes If we represent an input signal by some support in a frequency domain, Fi n(i.e. the set of frequencies present in the input) then no new frequencysupport will be required to model the output, i.e.Fout Fin Linear systems can be broken down into simpler sub-systems which can bere-arranged in any order, i.e.f g1 g2 f g2 g1 f g1,23

1.3.2Time or space InvarianceA time-invariant system is one whose properties do not vary with time (i.e. theinput signals are treated the same way regardless of their time of arrival); forexample, with discrete systems, if an input sequence f (x) produces an outputsequence r (x), then the input sequence f (x xo ) will produce the output sequence r (x xo ) for all xo . In the case of 2-d images, the system response doesnot depend on the position within the image, i.e. not on xo , yo .1.4Linear ProcessesSome of the common signal processing functions are amplification (or attenuation), mixing (the addition of two or more signal waveforms) or un-mixing andfiltering. Each of these can be represented by a linear time-invariant “block” withan input-output characteristic which can be defined by: The impulse response g(x) in the time domain. The transfer function G(u) in a frequency domain. We will see that thechoice of frequency basis may be subtly different from time to time.4

As we will see, there is (for many of the systems we examine in this course)an invertable mapping between the time (image index) and (spatial) frequencydomain representations.1.5ConvolutionConvolution allows the evaluation of the output signal from a LTI system, givenits impulse response and input signal.The input signal can be considered as being composed of a succession ofimpulse functions, each of which generates a weighted version of the impulseresponse at the output, as shown in 1.1.5

0100total0.106080010002040Figure 1.1: Convolution as a summation over shifted impulse responses.6

The output at time x, r (x), is obtained simply by adding the effect of eachseparate impulse function – this gives rise to the convolution integral :Z Xdτ 0r (x) {f (x τ )dτ }g(τ ) f (x τ )g(τ )dτ0ττ is a dummy variable which represents time measured “back into the past” fromthe instant x at which the output r (x) is to be calculated.1.5.1Notes Convolution is commutative. Thus:Z r (x) is alsof (τ )g(x τ )dτ0 For discrete systems convolution is a summation operation:r [n] Xf [k]g[n k] k 0 Xk 07f [n k]g[k]

1.6Frequency-Domain AnalysisLinear (time-invariant) systems, by definition, may be represented (in the continuous case) by linear differential equations (in the discrete case by linear difference equations). Consider the application of the linear differential operator,D d/dx, to the function f (x) e sx :Df (x) sf (x)An equation of this form means that f (x) is the eigenfunction of D. Just like theeigen analysis you know from matrix theory, this means that f (x) and any linearoperation on f (x) may be represented using a set of functions of exponentialform, and that this function may be chosen to be orthogonal. This naturallygives rise to the use of the Laplace and Fourier representations. The Laplace transform:F (s) Transfer function G(s) R(s)where,ZF (s) f (x)e sx dxLaplace transform of f (x)08

R(s) G(s)F (s)where G(s) can be expressed as a pole-zero representation of the form:G(s) A(s z1) . . . (s zm )(s p1)(s p2) . . . (s pn ) The Fourier transform:Z F (u) f (x)e i 2πux dx Fourier transform of f (x) andR(iu) G(iu)F (iu)The output time function can be obtained by taking the inverse Fouriertransform:Z 1f (x) F (u)e i 2πux du2π 9

TheoremConvolution in the time domain is equivalent to multiplication in the frequencydomain i.e.r (x) g(x) f (x) F 1{R(u) G(u)F (u)}andr (x) g(x) f (x) L 1{R(s) G(s)F (s)}ProofConsider the general integral (Laplace) transform of a shifted function:Zf (x τ )e sx dxL{f (x τ )} ex sτL{f (x)}Now consider the Laplace transform of the convolution integralZ ZL{f (x) g(x)} f (x τ )g(τ )dτ e sx dxZx τ g(τ )e sτ dτ L{f (x)}τ L{g(x)}L{f (x)}By allowing s iu we prove the result for the Fourier transform as well.10

1.7Simple filtering - basicsIt is very useful in image and signal processing to view transformations as inputoutput relationships, specified by a transfer function.h(x)f(x)r(x)Figure 1.2: Transfer function model.11

The transfer function is defined by the impulse response of the system. Thisspecifies the response of the system to an impulse input (a dirac). The convolution theorem states that the response, r (x), of such an impulse input, i (x), maybe given asr (x) i (x) h(x)where h(x) is the impulse response function. And for an arbitrary input, f (x)r (x) f (x) h(x)or, by taking the FTR(u) F (u)H(u)where H(u) is the transfer function in the Fourier domain. As F (u) representsthe spectrum of f (x), so multiplying by some function H(u) may be regarded asmodifying or filtering F (u) and hence filtering the data sequence f (x).Key point : Filtering may be regarded as a multiplication in the spectral domain, or as a convolution in the image/signal domain.12

The Ideal LPF (ILPF) : Consists of H(u, v ) 1 if (u 2 v 2) D and 0otherwise. As the ILPF is symmetric about the origin in Fourier space, it requiresthat the FT of the image is also centred on the origin.The Butterworth LPF (BLPF) : Consists of( 2n ) 1D(u, v )H(u, v ) 1 D where D(u, v ) (u 2 v 2) and D and n are filter settings The IHPF : Is theinverse transfer function of the ILPF, and the corresponding Butterworth filter,the BHPF, as the inverse of the BLPF.13

(a)1 G(u ) G(ω) 0.81n 10.60.4n 20.2n 6000.20.40.60.811.2ω1.41.61.82(b)0log G(ω) 10uc01-du 2 110110.80.80.60.60.40.40.20.206010010log d 1101000Figure 1.3: The ILPF and the BLPF140

Lecture 2 – The Fourier Domain & Digital Filters2.1The Fourier transformConsider again the 1-D case of a signal f (x), the FT is defined asZ F (u) f (x) exp[ i 2πux]dx Zand the inverse as f (x) F (u)e i 2πux du which form a Fourier transform pair. We note that the FT is, in general, acomplex function of the form F (u) R(u) i I(u). We call F (u) the Fourierspectrum of f (x) and φ(u) tan 1[I(u)/R(u)] the phase spectrum.15

2.1.12-D Fourier transformThere is no inherent change in theory for the 2-dimensional case, where f (x, y )exists, so the FT, F (u, v ) is given asZ Z F (u, v ) f (x, y ) exp[ i 2π(ux v y )]dxdy and the inverse asZ Z f (x, y ) F (u, v ) exp[i 2π(ux v y )]dudv We note that the above are separable2.1.2Some basic theoremsHere are some basic (and useful) theorems related to the FT. They are shownfor a 1-D system, for ease of reading and notation, and directly translate intohigher dimensions as above. Similarity theorem : if f (x) F (u) then f (ax) 1 a F (u/a) Addition theorem : if f (x), g(x) F (u), G(u) then af (x) bg(x) aF (u) bG(u)16

Shift or twist theorem : if f (x) F (u) then f (x a) exp[ i 2πua]F (u) Convolution theorem : ifZf (x) g(x) f (τ )g(x τ )dτthen F T [f (x) g(x)] F (u)G(u). Note that this is of great use in filtering Power theorem :ZZ f (x) 2dx F (u) 2dui.e. a statement about conservation of energy. Derivative theorem : if f (x) F (u) then f 0(x) d/dx[f (x)] iuF (u)2.1.3The discrete FT (DFT)We sample the continuous (start with 1-D) function, f (x), at M points spaced x apart. We now describe the function asf (x) f (xo x x)17

where x now describes an index, with this transformation, u the Fourier varablepaired to x is discretised into M points. We thus obtain :M 11 XF (u) f (x) exp[ i 2πux/M]M x 0andf (x) M 1XF (u) exp[i 2πux/M]u 0and, for 2-D systemsM 1 N 11 1 XXF (u, v ) f (x, y ) exp[ i 2π(ux/M v y /N)]M N x 0 y 0andf (x, y ) M 1X N 1XF (u, v ) exp[i 2π(ux/M v y /N)]u 0 v 0if y is sampled evenly at N sample points.The sampling in the space domain, x, y corresponds to a sampling in the‘frequency’ domain of11 v u M xM y18

2.1.4Some useful results using the DFT The total width of the samples in the x, y directions determines the lowestspatial frequency we can resolve, umin 1/(M x) The sample interval, x, y , dictates the highest spatial frequency we canresolve, umax 1/(2 x) The number of samples, M, N, dictates the number of spatial frequency‘bins’ that can be resolved. Addition & linearity : as with continuous functions Shift theorem : : if f (x) F (u) then f (x a) exp[ i 2πua/M]F (u),hencef (x, y ) exp[i 2π(uo x vo y )/M] F (u uo , v vo )andf (x xo , y yo ) F (u, v ) exp[ i 2π(uxo v yo )/M]if we let uo vo M/2 then we can shift the frequency space to the centreof the frequency squaref (x, y )( 1)x y F (u M/2, v M/2)19

Discrete convolution :f (x) g(x) M 1Xf (m)g(x m)m 0andDF T [f (x) g(x)] MF (u)G(u) Power theorem :M 1X f (x) 2 Mx 0M 1X F (u) 2u 0 Periodicity :F (u, v ) F (u M, v ) F (u, v M) F (u M, v M)Note that this leads us to deduce the aliasing theorem Rotation :f (r, θ θo ) F (ω, φ θo ) Average value : If we define the average value of the 2-D function asM 1 M 11 XXf (x, y ) 2f (x, y )M x 0 y 020thenf (x, y ) F (0, 0)

Laplacian : The Laplacian of a 2-D variable is defined as 2f 2f f (x, y ) 2 2 x y2The DFT of the above is hence (2π)2(u 2 v 2)F (u, v )(each time we take a derivative we get a factor of i 2π)Trick : Plots of F (u, v ) often decay very rapidly from a central peak, so it isgood to display on a log scale. Often the transform, F 0(u, v ) log[1 F (u, v ) ]is used.21

(a)202040406060808010010012012020(b)406080 100 1202020404060608080100406080 100 12020406080 100 12010022120(c)2020406080 100 120120Figure 2.1: Image (a), Fourier spectrum (b) and shifted Fourier spectrum (c).

20202040404060606080808010010010012012012020 40 60 80 100 12020 40 60 80 100 12020 40 60 80 100 12020202040404060606080808010010010012012012020 40 60 80 100 12020 40 60 80 100 12020 40 60 80 100 120Figure 2.2: Some 2-D functions and their resultant DFTs23

202040406060808010010012012020 40 60 80 100 12020 40 60 80 100 120Figure 2.3: Rotation in FT space (top) and 2-D Convolution (bottom).24

2.2Other transformsThe FT represents a specific case in a more general transform theory. In the FTthe image is decomposed into a series of harmonic functions (sines and cosines).These have the property of being orthogonal functions and form a complete basisset. They are not the only such functions, however. FT kernel basis Walsh Hadamard Discrete cosine transform (DCT) Wavelets - localised functions.We concentrate later in the course on the use of the DCT as this is the mostwidely used of the above and forms the basis of JPEG compression. We alsolook at wavelets as these form the basis of the JPEG-2000 compression scheme.25

2.32.3.1Digital filteringThe sampling processThis is performed by an analogue to digital converter (ADC) in which the continuous function f (x) is replaced by a “discrete function” f [k], which is definedonly at x kT , with k 0, 1, 2. We thence only need consider the digitisedsample set f [k] and the sample interval T . A simple generalisation allows for asampled set over the 2-D plane, with samples at u M, v N so that u, v indexesthe image pixels.AliasingxConsider f (x) cos( π2 Tt ) (one cycle every 4 samples) and also f (t) cos( 3π2 T)(3 cycles every 4 samples) as shown in the Figure. Note that the resultantsamples are the same. This result is referred to as aliasing.26

10.50 0.5 10102030405060708090100010203040506070809010010.50 0.5 1Figure 2.4: Aliasing.27

2.4Introduction to the principles of digital filteringWe can see that the numerical processing is at the heart of the digital filteringprocess. How can the arithmetic manipulation of a set of numbers produce a“filtered” version of that set? Consider the noisy signal of figure 2.5, togetherwith its sampled version:-2-1012Figure 2.5: Noisy data.28

One way to (e.g) reduce the noise might be to try and smooth the data.For example, we could try a polynomial fit using a least-squares criterion. If wechoose, say, to fit a parabola to every group of 5 points in the sequence, then, forevery point, we will make a parabolic approximation to that point using the valueof the sample at that point together with the values of the 4 nearest samples(this forms a parabolic filter), as in Fig. 2.6parabolic fit-2-101 2centre point, k 0Figure 2.6: Parabolic fit.29

p[k] s0 ks1 k 2s2where p[k] value of parabola at each of the 5 possible values of k { 2, 1, 0, 1, 2}and s0, s1, s2 are the variables used to fit each of the parabolae to 5 input datapoints.We obtain a fit by finding a parabola (coefficients s0, s1 and s2) which bestapproximates the 5 data points as measured by the least-squares error E:E(s0, s1, s2) 2X(x[k] [s0 ks1 k 2s2])2k 2Minimizing the least-squares error gives: E 0, s0 E 0, s1andand thus:k 2X5s0 10s2 x[k]k 210s1 k 2Xk 230 E 0 s2kx[k]

10s0 34s2 k 2Xk 2x[k]k 2which therefore gives:1( 3x[ 2] 12x[ 1] 17x[0] 12x[1] 3x[2])351s1 ( 2x[ 2] x[ 1] x[1] 2x[2])101s2 (2x[ 2] x[ 1] 2x[0] x[1] 2x[2])14The centre point of the parabola is given by:s0 p[k] k 0 s0 ks1 k 2s2 k 0 s0Thus, the parabola coefficient s0 given above is the output sequence numbercalculated from a set of 5 input sequences points. The output sequence soobtained is similar to the input sequence, but with less noise (i.e. low-passfiltered) because the parabolic filtering provides a smoothed approximation toeach set of five data points in the sequence. Fig. 2.7 shows this filtering effect.31

1.510.50 0.50102030405060708090Figure 2.7: Noisy data (thin line) and 5-point parabolic filtered (thick line).32100

The magnitude response (which we will re-consider later) for the 5-pointparabolic filter is shown below in Fig. 2.8.1 H(z) 0.80.6fsamp/20.40.200100200300400500fFigure 2.8: Frequency response of 5-point parabolic filter.33600700

The filter which has just been described is an example of a non- recursivedigital filter, which are defined by the following relationship (known as a differenceequation):NXr [k] ai f [k i ]i 0where the ai coefficients determine the filter characteristics. The differenceequation for the 5-point smoothing filter, therefore, is:1r [k] ( 3f [k 2] 12f [k 1] 17f [k] 12f [k 1] 3f [k 2])35This is a non-causal filter since a given output value r [k] depends not only onprevious inputs, but also on the current input f [k], the input f [k 1] and theinput f [k 2]. The problem is solved by delaying the calculation of the outputvalue f [k] (the centre point of the parabola) until all the 5 input values have beensampled (i.e. a delay of 2T where T sampling period), ie:1( 3f [k] 12f [k 1] 17f [k 2] 12f [k 3] 3f [k 4])35PIt is of importance to note that the equation r [k] ai f [k i ] representsa discrete convolution of the input data with the filter coefficients; hence theser [k] 34

coefficients constitute the impulse response of the filter.Proof:PLet f [k] 0, except at k 0, where f [0] 1. Then r [k] i ai f [k i ] ak f [0] (all terms zero except when i k). This is equal to ak since f [0] 1.Therefore r [0] a0; r [1] a1; etc . . . As there is a finite number of a’s, theimpulse response is finite. For this reason, non-recursive filters are also calledFinite-Impulse Response (FIR) filters.As we will see, we may also formulate a digital filter as a recursive filter; inwhich, the output r [k] is also a function of previous outputs:r [k] NXai f [k i ] i 0MXbi r [k i ]i 1Before we can describe methods for the design of both types of filter, we needto review the concept of the z-transform.35

2.5The z-transformThe z-transform is important in digital filtering because it describes the samplingprocess and plays a role in the digital domain similar to that of the Laplacetransform in analogue filtering.The Laplace transform of a unit impulse occurring at time x kT is e kT s .Consider the discrete function f [k] to be a succession of impulses, for exampleof area f (0) occurring at x 0, f (1) occurring at x T , etc . . . The Laplacetransform of the whole sequence would be:Fd (s) f (0) f (1)e T s f (2)e 2T s . . . f [k]e kT sThe suffix d denotes the transform of the discrete sequence, not of the continuous f (t).Let us replace e T s by a new variable z, and rename Fd (s) as F (z):F (z) f (0) f (1)z 1 f (2)z 2 . . . f [k]z kFor many functions, the infinite series can be represented in “closed form”, ingeneral as the ratio of two polynomials in z 1.36

2.5.1The Pulse Transfer FunctionThis is the name for (z-transform of output)/(z-transform of input).Let the impulse response, for example of an FIR filter, be a0 at t 0, a1 atx T , . . . an at x nT with n 0 to N.Let G(z) be the z-transform of this sequence:G(z) a0 a1z 1 a2z 2 . . . ai z i . . . aN z NLet F (z) be an input expressed in the z-domain as:F (z) f [0] f [1]z 1 f [2]z 2 . . . f [k]z k . . .The product G(z)F (z) is:G(z)F (z) (a0 a1z 1 . . . an z n . . . aN z N )(f [0] f [1]z 1 . . . f [k]z k )in which the coefficient of z k is:a0f [k] a1f [k 1] . . . an f [k n] . . . aN f [k N]This is nothing else than the value of the output sample at x kT . Hencethe whole sequence is the z-transform of the output, say R(z), where R(z) G(z)F (z). Hence the pulse transfer function, G(z), is the z-transform of theimpulse response.37

For non-recursive filters:G(z) NXan z nn 0For recursive filters:R(z) NX iai z F (z ) n 0MXbi z i R(z)i mPR(z )an z nnPG(z) F (z) 1 m bm z m2.5.2z-plane pole-zero plotLet z e sT , where T s

Digital Signal Processing: Principles, Algorithms and Applications. Matlab Signal processing toolbox manual. 1. 1.2 Introduction This course is ultimately concerned with the problem of computation, inference, manipulation and decision making using 1- and 2-dimensional data streams (’sig-

Related Documents:

most of the digital signal processing concepts have benn well developed for a long time, digital signal processing is still a relatively new methodology. Many digital signal processing concepts were derived from the analog signal processing field, so you will find a lot o f similarities between the digital and analog signal processing.

The input for image processing is an image, such as a photograph or frame of video. The output can be an image or a set of characteristics or parameters related to the image. Most of the image processing techniques treat the image as a two-dimensional signal and applies the standard signal processing techniques to it. Image processing usually .

Digital image processing is the use of computer algorithms to perform image processing on digital images. As a subfield of digital signal processing, digital image processing has many advantages over analog image processing; it allows a much wider range of algorithms to be applied to the in

A digital image is a 2D representation of a scene as a finite set of digital values, calledpicture elements or pixels or pels. The field of digital image processing refers to processing digital image by means of a digital computer. NOTE: A digital image is composed of finite number of elements like picture elements, image

Digital image processing is the use of computer algorithms to perform image processing on digital images. As a . Digital cameras generally include dedicated digital image processing chips to convert the raw data from the image sensor into a color-corrected image in a standard image file format. I

A DSP System A/D DSP D/A Analog signal Analog signal Sampled data signal Analog signal Cts-time dst-amp staricase signal Digital signal Digital signal DSP System Antialiasing Filter Sample and Hold Reconstruction Filter A/D: Iconverts a sampled data signal value into a digital number, in part, through quantization of the amplitude

What is Digital Image Processing? Digital image processing focuses on two major tasks -Improvement of pictorial information for human interpretation -Processing of image data for storage, transmission and representation for autonomous machine perception Some argument about where image processing ends and fields such as image

Java Digital Image Processing 1 Digital Image Processing (DIP) deals with manipulation of digital images using a computer. It is a subfield of signals and systems but focuses particularly on images. DIP focuses on developing a computer system that is able to perform processing on an image. The input of such system is a digital image.