wavelet transforms and edge detectors on digital images

10

Click here to load reader

Upload: j-schmeelk

Post on 26-Jun-2016

215 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Wavelet transforms and edge detectors on digital images

ELSEVIER

Available online at www.sciencedirect.com M A T H E M A T I C A L AND

SC,E.CE C~.,mBCT" COMPUTER MODELLING

Mathematical and Computer Modelling 41 (2005) 1469-1478 www.elsevier.eom/locate/mcm

Wavelet Transforms and Edge Detectors on Digital Images

J. SCHMEELK Depar tmen t of Mathemat i ca l Sciences

Virginia Commonweal th Univers i ty -Qatar Doha, Qa ta r

(Received and accepted December 2003)

A b s t r a c t - - T h e paper investigates the problem of locating edges on digital images. The process is completed through various mathematical transforms. The edges are found by implementing mathe- matical algorithms for convolutions that are adapted to locate the edges and highlights the technique on using wavelet transforms. We are especially addressing the problem of edge detection, because it has far reaching applications to all fields and especially within medicine. A patient can be diagnosed as having an aneurysm by studying an angiogram. An angiogram is the visual view of the blood ves- sels whereby the edges are highlighted through the implementation of edge detectors. This process can be completed through wavelet transforms and other convolution techniques. @ 2005 Elsevier Ltd. All rights reserved.

K e y w o r d s - - W a v e l e t transforms, Image analysis, Edge detectors.

1. I N T R O D U C T I O N

To help motivate this paper, we provide an introduction to some interesting problems in image processing. The second section introduces partial derivatives and how they are applied to the gray level values at the pixel locations. The third section introduces a few specific examples such

as the vertical, horizontal, and Soble edge detecting techniques. Sections 4 and 5 introduces some fundamentals about wavelet transforms and leads into image edgers using wavelets. Section 6 provides the reader with a series of pictures that illustrate results in obtaining the edges within

the image.

2. S O M E N O T I O N S A N D N O T A T I O N S

A current 20 inch monitor displaying a black and white image currently contains pixel loca- tions of 1600 rows and 1200 columns. Of course the number continues to increase everyday as technology progresses. Each pixel location is designated by a rectangular coordinate, (x l ,y l ) , and evaluates a gray level value at that coordinate location indicating the shade of gray. The values are traditionally on a scale of 0 to 255 whereby 0 corresponds to white and 255 correspond to black. The value of the gray level at this coordinate point, (xl,Yl), will be designated by

f(xl,yl).

0895-7177/05/$ - see front matter @ 2005 Elsevier Ltd. All rights reserved. doi:10.1016/j.mcm.2004.12.002

Typeset by ~4A/tS-~X

Page 2: Wavelet transforms and edge detectors on digital images

1470 J. SCHMEELK

However, before we continue with the edge detection analysis, we first review a few elementary algebra and calculus notions. We first recall the familiar dot product for two vectors, x, y, to be x y ~ 2 2 • = i=l xiyi. From this dot or inner product, we define the norm to be Ilx]l 2 = ~ i = 1 xiyi. Then, we obtain tile familiar and very important result to many applications tha t the cosine of

the angle between the two vectors, x and y, satisfy the equation tha t cos(0) = x . y/llxll ]]y]], where each x and y are nonzero vectors. The maximum value for the cosine occurs when the two

vectors coincide giving a value, cos(0) = 1 and a minimum value for the cosine occurs when two

vectors are orthogonai giving a value cos(7~/2) = 0. These values are impor tant in edge detection•

We now introduce the partial derivative formulas,

Of(x, y) _ lira f ( x + Ax, y) - f ( x , y) Ox ~ ~ o A x

and Of(x, y._.__~) _ lim f (x , y + Ay) - f ( z , y )

Oy ~y--,o Ay

The distance between pixel locations will be normalized to be equal to 1 so all increments in the partial derivative formulae will be equal to one. This then gives,

Of(x, y) f ( x + 1, y) - f (x , y) Oz 1

and Of(x, y) f (x , y + 1) - f (x , y)

Oy 1

We now denote the function, f (x , y), to be the gray level values between neighboring pixels in the horizontal and vertical directions, respectively, giving us the formulas, f ( x l + 1, y l ) - f ( x l , Yl) and f ( x l , yl + 1) - f ( x l , yl). The spatial locations, xi and y~ can only take on integer values given by their pixel locations.

3. C O N V O L U T I O N A N D E D G E D E T E C T O R S

We first introduce the usual calculus definition for convolution given by the formula

and its discrete version by the formula,

h(nl,n2) * f (n l ,n2) = o~

kl ~--00 k2 =--0o

h ( ~ l , ~ 2 ) f ( n 1 - - ~ 1 , n 2 - - k2 ) .

We now reduce the discrete convolution to be a 3 by 3 matrix, which will play the role of a convolute and select our function, h(nl, n2), to have the matr ix values,

h =

(h ll, h,0i, h(-1 ,O) h(O,O) h(1,0) = - 1 0 1 .

h ( - 1 , - 1 ) h (O, -1) h ( 1 , - 1 ) - 1 0 1

Arguments (hi, n2) in h(nl, n2) of the first array are easily remembered by noting tha t they are the needed lattice point coordinates referred to as a Cartesian coordinate system. Clearly, the reduced array for h(nl, n2) is part of the complete array where h(nl, n2) is part of the complete

Page 3: Wavelet transforms and edge detectors on digital images

Wavelet Transforms 1471

array and is equal to zero whenever Inll o r In21 > 2. Next, we convoive the function, h(nl, n2) with the function, f ( n l , n2), and obtain

1 1

h(nl, n2) * f (n l , n2) --- E E h(kl, k2)S(nl - kl, n2 - k2) k l = - I k 2 = - I

= f(n2 - 1, n2 + 1) - f ( n l + 1, n2 + 1) + f ( n l - 1, n2)

- f ( n l + 1,n2 + 1) + f ( n l - 1 , n 2 + 1) - f ( n l + 1, n2 - 1).

We now investigate this last result only to find that it gives the difference of three columns of pixel values in the horizontal direction. If one checks the literature [1], we find that this is the approximation used in the horizontal direction in several leading imaging software packages. The function, h(nl, n2), is called the kernel of the convolution and when we change its values, we obtain different edgers. The edge is the portion of the image where there is a sudden change in

0.8.

0.6-

0.4.

0.2.

80

0 0

Figure 1.

o o

F i g u r e 2.

70

70

Page 4: Wavelet transforms and edge detectors on digital images

1472 J. SCHMEELK

...... : . . . . . . . i ........ i ...........

............. ~ ....... i ...... ~:~ ....... i ..... / i .......... i.~, ......... : .... 4 . . . . . . . . . . . i . . , i . . . . . . . i i . . . . . . . i . . . . . . i . . . . . . . . i . . . . . . . . ! .......

3t ........ i ........ i ̧¸....~ ...... i ....... i ........ i ...... ! ......... ~i ........... i ............ i ...... .....

1

C

-1

-2

-3

-4 80

7O

0 0

Figure 3.

gray levels. The edger implemented selects a particular feature in the image, which is beneficial

to the particular application. The kernel for vertical edging is given by

h = 0 .

1 - 1 1

A more sophisticated edger is the Soble edger, which uses the gradient to approximate the edges.

Since the gradient includes both horizontal and vertical components, two kernels are employed

given by the matrices,

- 2 0 2 , 0 ,

- 1 0 1 1 - 2 1

................... iiiiiiiiiill ....... : ....

respectively.

0 0

70

Figure 4.

Page 5: Wavelet transforms and edge detectors on digital images

Wavelet Transforms 1473

The letter N and its horizontal and vertical edge matrices applied to N are illustrated in Figures 1-3, respectively.

We now employ the familiar formula for the magnitude of the gradient for a two-independent variable function, z(x, y),

Igradz( ,y)l = (3.1)

We then replace the partial derivative formulas in (3.1) with the appropriate vertical and horizontal convolutes, so that it becomes a form of the Soble transform. Then, we use the gradient result, namely the Soble transform on the letter N illustrated in Figure 4.

Figure 4 clearly defines the edges of the image. We now begin the process of applying some wavelet transforms. They are localized on images and should give greater detail on special portions found in the image.

4. T W O - D I M E N S I O N A L W A V E L E T T R A N S F O R M S

We will not include a presentation regarding multiresolution analysis leading to a scaling func- tion and then to a "mother" wavelet. References [2-4] are but a few resources for this remarkable analysis.

We begin with a two-dimensional mother wavelet, w(x, y), having dilation and translation parameters, (al, a2) and (hi, b2), respectively, each varying over R 2. The dilated and translated "mother" wavelet then becomes

w(al,a2)(bl,b2)(2g, y ) l ( x - b l y - b ~ ) - - - - W - - , - - ,

al a2

a l 7 ~ 0 and a2 ~ 0. The Fourier transform of this wavelet then becomes

w(al,a2)(bl,b2)(U,V) - 271" i J i J e_j~r(uz+VY)w(X-b I y-b2)

- l

x/ala2

Furthermore, Parsevals' formula in R 2 becomes

f(x, y)g(x, y) dx dy = ~ u, v)[7(u, O 0 O 0 0(3 O 0

DEFINITION 4.1. The two-dimensional wavelet transform on f(x,y) is then defined by the for- mula,

(wWaVf) ((al, a2), (bl, b2)) = (f,w (<~l'<~2)(bl'b2)'

i J f J 1 ( x - b t Ya2b2 ) z 4_aTa2 f ( x , y ) w ' dx dy.

The resolution of the identity an important inversion tool for the wavelet transform is given by the following theorem.

THEOREM 4.2. For all f, g C L2(R 2) there holds

ffffdalda2dbldb2 {(TWaVf) (al, a2) (bl, b2)) {(TWaVg) (al, a2) (bl, b2)} = C~(f, 9).

Page 6: Wavelet transforms and edge detectors on digital images

1474 J. SCHMEELK

PROOF. See references [4-6].

The C~ in Theorem 4.2 equals

/ f dslds2 C w = ~ IT(s1, s~)l , (4.3)

leading to the inversion formula,

f(x)=C~l f f / dalda2dbldb2 {(TW~Vf)(al,a2)(bl, b2)} {w(al,a~)(bl,b2)} " (4.4) (ala2) 2

Expression (4.4) requires the "mother" wavelet to satisfy the necessary condition,

/ ~(x, y) dx dy = O.

5. W A V E L E T S I N I M A G E P R O C E S S I N G

A major reference for this section is the paper by Mallat and Zhong [7]. A smoothing func- tion [4], s(x, y) E L2(R2), having unit length is selected and whose partial derivatives become a "mother" wavelet. The smoothing function, s(x, y) has the following property proven in Propo- sition 5.1.

PROPOSITION 5.1. If function, s(x,y) E L2(R~), where IIs(x, Y)I] = 1, then all functions

sj,k( , y) = 2 j/2,j/ s ( 2 i x - k, 2Jy - k) ,

also have unit length for all j, k belonging to the integers, N.

PROOF. We compute the norm of sj,k(x, y),

= s - - (5.2)

Changing variables by sl = 2 J z - ~ and s2 = 2 J y - ]¢ immediately gives us the result,

Is(s~, s~)l 2 ds~ ds~ = L

In many applications for image processing the smoothing function, s(x, y), selected is the Gaussian function and it is illustrated in Figure 5.

• i ' i " ' ' :

0.8 . . . . . . . i : . . . . . . [ : . . . i , . . . ' '~

o.e. .... i i

: . . . . . . .

0.4 . . . . . . . : - i . . . . . . i

. . . . . . . . . . . . . i A • . . m l 0.2 . . . . . . . . ' . . . . ; . / "

_. . , . , . " . . .

0~ i , j . . " . ' . ' 80

~o

4O

~ " . . . . •

." "..-~ .,.

20 ~ 0 30

0 0 1 0

: , . :

?:: ....... ! ....... i

6 0

4 0

7 0

Figure 5.

Page 7: Wavelet transforms and edge detectors on digital images

Wavelet Transforms 1475

We then define the two functions that become the "mother" wavelets in our image processing

technique given by the partial derivatives,

(x, y) = ~xS(X, y) ~d 1

and

(x,y) = ~s(~ ,y) . ~2

The dilation factors, 2 j, where j C N are then selected and the wavelet transform for f(x,y) becomes

and

' , ,

0 0

Figure 6.

0.5.

-0,5

80

. . . ! . . . . - ' " ' , . . .

. . . , . , " : : o .

. . . . . , - ' " ' : : i " . , : . . .

1 . . . . . . . . . " " " " ! . . . . : • • • ' ' ' ' ' ' ' ' ' " " " . . ' ' " . . : . . b m b d

0 4

~ 4

0 -

0 0

Figure 7.

Page 8: Wavelet transforms and edge detectors on digital images

1476 J. SCHMEELK

We now illustrate the partial derivatives, a;l(x,y) and cv2(x,y) for the Gaussian, respectively, shown in Figures 6 and 7.

We next recall the following mathematical result for convolution.

THEOREM 5.2. D ( f * g) = D f * g = f * Dg, where D is a differential operator and f, g are suitably differentiable functions.

PROOF. See any mathematical reference including convolution properties for differentiable func- tions.

This result gives a fundamental result in image processing namely that the gradient of f (x , y) smoothed by s(x, y) is proportional to the wavelet transform of f ( x , y) in the following sense:

~j f(x, y) = f , ~ f ( x , y ) = f , (2/22J)~2(x/2J,y/2J) J

= =

= 2 J v ( f • s~j)(x, y)

The gradient operator in the last equation is written in column form. For image processing the two-dimensional wavelet transform of f (x , y) is the set of functions,

W f = [W~j f ( x , y), W~j f ( x , y)] ,

j belongs to N.

6. W A V E L E T T R A N S F O R M S A P P L I E D T O T H E I M A G E N

DEFINITION 6.1. The order of regularity of a wavelet is the number of its continuous partial derivatives.

With this in mind, we consider the following quote in reference [8, p. 197]: "Encoding a smooth picture with a discontinuous function like the Haar wavelet

produces a discontinuous picture; edges appear that do not exist in the original picture. Using a regular (smooth) function as the analyzing function can prevent such artifacts."

1 .5~ " . . . .

1~ - ' " " "

0 . 5 ~, , , " ' " " ' "

60"

0 0

80

Figure 8.

Page 9: Wavelet transforms and edge detectors on digital images

Wavelet Transforms 1477

0 0

Figure 9.

NO,•

0 0

Figure 10. , . . ; .

: " ' ' " .

. . . . . : ' . i

0 0

Figure 11.

t20

200

Page 10: Wavelet transforms and edge detectors on digital images

1478 J. SCHMEELK

We begin with the wavelet transforms on N by applying the partial derivative in x and y of the Gaussian. Clearly, the Gaussian together with all of its partial derivatives have continuous partial derivatives. Therefore, in some sense one could say the order of regularity is excellent. Figures 8 and 9 clearly show excellent edge detection and, moreover, in Figure 9, we see a very strong feature shown on each "corner" of the image.

We go on in Figures 10 and 11 to illustrate the Haar wavelet and the wavelet transform on the letter N, respectively. Clearly, you see maximum distortion and artifacts that clearly do not indicated any extra information about the image. We conclude the paper with Figures 8-11.

R E F E R E N C E S

1. I. Daubechies, The wavelet transform, time frequency localization and signal analysis, IEEE Transactions on Information Theory 36 (5), 961-1005, (1990).

2. F.W. Campbell and J.G. Robson, Application of Fourier analysis to the visibility of gratings, J. Physiol. 19"7, 551 566, (1968).

3. J.S. Lim, Two-Dimensional Signal and Image Processing, Prentice Hall, New Jersey, (1990). 4. Y.Y. Tang, L.H. Yang, J. Liu and H. Ma, Wavelet Theory and its Application to Pattern Recognition, World

Scientific, New Jersey, (2000). 5. C. Chui, Editor, An Introduction to Wavelets, Volume 1, Academic Press, New York, (1992). 6. C. Chui, Editor, A Tutorial in Theory and Application, Academic Press, New York, (1992). 7. S. Mallat and S. Zhong, Characterization of signals from multiscale edges, IEEE Transactions on Pattern

Analysis and Machine Intelligence 14 (7), 710-732, (1992). 8. D.F. Walnut, An Introduction to Wavelet Analysis, Birkhauser, Massachusetts, (2002). 9. H.C. Andrews and B.R. Hunt, Digital Image Restoration, Prentice Hall, New Jersey, (1977).

10. D.H. Ballard, Parameter nets, Artificial Intelligence 22, 235-267, (1984). 11. D.H. Ballard and C.M. Brown, Computer Vision, Prentice Hall, New Jersey, (1982). 12. B.G. Batchelor, Pattern Recognition, Plenum Press, New York, (1978). 13. I. Daubechies, Ten Lectures on Wavelets, Society for Industrial and Applied Mathematics, Pennsylvania,

(1992). 14. L. Debnath, Wavelet Transforms and Their Applications, Birkhauser, Massachusetts, (2002). 15. R.C. Conzalez and P. Wintz, Digital Image Processing, Addison-Wesley, Massachusetts, (1987). 16. B.B. Hubbard, The World According to Wavelets, A.K. Peters, Massachusetts, (1996). 17. A.K. Jain, Fundamentals of Digital Image Processing, Prentice Hall, New Jersey, (1989). 18. T.H. Koornwinder, Wavelets: An Elementary Treatment of Theory and Applications, World Scientific, New

Jersey, (1993). 19. Y. Meyer, Wavelet Algorithms and Application, Translated by R. Ryan, SIAM, Pennslyvannia, (1993). 20. G. Nagy, State of the art in pattern recognition, Proc. IEEE 56, 836-862, (1968). 21. W. Pedrycz, Fuzzy sets in pattern recognition; Methodology and methods, Pattern Recognition 20 (1-2),

121-146, (1990). 22. W.K. Pratt, Digital Image Processing, John Wiley £: Sons, New York, (1991). 23. M. Ruslmi, G. Beylkin, R. Coifman, I. Daubechies, S. Matlat, Y. Meyer and I. Raphael, Editors, Wavelets

and their Applications, Jones and Bartlett, Massachusetts, (1992). 24. R.J. Schalkoff, Digital Image Processing and Computer Vision, John Wiley & Sons, New York, (1989). 25. C. Strange, Wavelet transforms versus Fourier transforms, Bulletin of the AMS 28 (2), 288-305, (1993).