Edge detection using wavelets

80
Project Report On Real Time Edge Detection using Wavelets Submitted by ASHANK PANWAR (0609131022) ROVINS RATHI (0609131088) SACHIN SINGH (0509131086) Under the Guidance of Mrs. SANGEETA MANGESH Submitted to the Department of Electronics & Communication Engineering in partial fulfillment of the requirements for the degree of Bachelor of Technology in Electronics & Communication Engineering JSS MAHAVIDYAPEETHA JSS ACADEMY OF TECHNICAL EDUCATION, NOIDA U.P. Technical University May, 2010

description

Project Report

Transcript of Edge detection using wavelets

Page 1: Edge detection using wavelets

Project Report On

Real Time Edge Detection using Wavelets

Submitted by

ASHANK PANWAR (0609131022)

ROVINS RATHI (0609131088)

SACHIN SINGH (0509131086)

Under the Guidance of

Mrs. SANGEETA MANGESH

Submitted to the Department of Electronics & Communication Engineering in partial fulfillment of the requirements

for the degree of Bachelor of Technology

in Electronics & Communication Engineering

JSS MAHAVIDYAPEETHA

JSS ACADEMY OF TECHNICAL EDUCATION, NOIDA

U.P. Technical University May, 2010

Page 2: Edge detection using wavelets

ii

DECLARATION

We hereby declare that this submission is our own work and that, to the best of our knowledge and belief, it contains no material previously published or written by another person nor material which to a substantial extent has been accepted for the award of any other degree or diploma of the university or other institute of higher learning, except where due acknowledgment has been made in the text.

1. ASHANK PANWAR

0609131022

Date:

2. ROVINS RATHI

0609131088

Date:

3 SACHIN SINGH

0509131086

Date:

Page 3: Edge detection using wavelets

iii

CERTIFICATE

This is to certify that Project Report entitled “Edge Detection using wavelets in real time” which

is submitted by ASHANK PANWAR, ROVINS RATHI, SACHIN SINGH in partial fulfillment

of the requirement for the award of degree B.Tech. In department of Electronics and

Communication of U.P. Technical University, is a record of the candidate own work carried out

by him under our supervision. The matter embodied in this thesis is original and has not been

submitted for the award of any other degree.

Date: Mrs. SANGEETA MANGESH

SUPERVISOR

Page 4: Edge detection using wavelets

iv

ACKNOWLEDGEMENT

It gives us a great sense of pleasure to present the report of the B.Tech Project undertaken during B.Tech

final year. We owe special debt of gratitude to Mrs Sangeeta Mangesh, Department of Electronics &

Communication, JSS Engineering College, Noida for her constant support and guidance throughout the

course of our work. Her sincerity, thoroughness and perseverance have been a constant source of

inspiration for us. It is only her cognizant efforts that our endeavors have seen light of the day.

We also do not like to miss the opportunity to acknowledge the contribution of all faculty members of the

department for their kind assistance and cooperation during the development of our project. Last but not

the least, we acknowledge our friends for their contribution in the completion of the project.

1. Signature:

Name : ASHANK PANWAR

Roll No: 0609131022

Date:

2. Signature:

Name: ROVINS RATHI

Roll No: 0609131088

Date:

3. Signature

Name: SACHIN SINGH

Roll No: 0509131086

Date:

Page 5: Edge detection using wavelets

v

ABSTRACT

This major project is a new approach to edge detection using wavelet transforms. This project briefly introduces the

development of wavelet analysis. Then it has worked on the methods & processes required to help us in the

completion of our major project which is “Edge Detection using wavelets in Real Time”. The classical edge

detectors work fine with high-quality pictures, but often are not good enough for noisy pictures because they cannot

distinguish edges of different significance. It uses a scale adaptive threshold along with a recursive decision process

to reveal the significant edges of all lengths and orientations and to localize them accurately even in low contrast

and very noisy images. The proposed wavelet based edge detection algorithm combines the coefficients of wavelet

transforms on a series of scales and significantly improves the results. Finally, a cascade algorithm is developed to

implement the wavelet based edge detector. Experimental results on both natural and noisy images are presented.

Here we also apply our algorithm for edge detection on finding misplaced or fallen bottle placed on the conveyor

belt as an industrial application. This multiscale edge detection algorithm can be used for several useful industrial

applications. Results are presented along with the project.

Page 6: Edge detection using wavelets

vi

TABLE OF CONTENTS PAGE DECLARATION..................................................................................................................... ii

CERTIFICATE ...................................................................................................................... iii

ACKNOWLEDGEMENT ..................................................................................................... iv

ABSTRACT ............................................................................................................................. v

TABLE OF CONTENTS ...................................................................................................... vi

LIST OF FIGURES ................................................................................................................ x

LIST OF SYMBOLS ............................................................................................................ xii

LIST OF ABBREVIATIONS ............................................................................................. xiii

CHAPTER 1 INTRODUCTION ........................................................................................... 1

1.1 Literature survey ............................................................................................................ 1

1.2 Introduction of the project ............................................................................................. 3

1.3 Applications of the project ............................................................................................. 3

CHAPTER 2 IMAGES ........................................................................................................... 5

2.1 What is an image? ............................................................................................................. 5

2.2 Coordinates conventions ................................................................................................... 5

2.3 Reading Images:................................................................................................................ 6

2.4 Displaying Images ............................................................................................................ 7

2.5 Writing Images.................................................................................................................. 7

2.6 Image Types ...................................................................................................................... 8

2.6.1 Intensity Images: ....................................................................................................... 10

2.6.2 Binary Images: .......................................................................................................... 10

CHAPTER 3 WAVELETS .................................................................................................. 11

3.1 What are wavelets? ......................................................................................................... 11

Page 7: Edge detection using wavelets

vii

3.2 Types of transforms ........................................................................................................ 12

3.2.1 Continuous wavelet transforms (Continuous Shift & Scale Parameters) .................. 12

3.2.1.1 Scaling..................................................................................................................13

3.2.1.2 Shifting .................................................................................................................14

3.2.1.3 Scale and Frequency ............................................................................................15

3.2.2 Discrete wavelet transforms (Discrete Shift & Scale parameters) ............................ 15

3.2.2.1 One-Stage Filtering: Approximations and Details ...............................................16

3.2.2.2 Multiple-Level Decomposition ............................................................................18

3.3 Number of Levels ........................................................................................................... 19

3.4 Wavelet Analysis ............................................................................................................ 19

3.5 What Can Wavelet Analysis Do? ................................................................................... 20

3.6 Wavelet Applications ...................................................................................................... 22

3.6.1 Scale Aspects ............................................................................................................. 22

3.6.2 Time Aspects ............................................................................................................. 23

3.6.3 Wavelet Decomposition as a Whole ......................................................................... 23

CHAPTER 4 EDGES ........................................................................................................... 25

4.1 What is edge and what is an edge detector? ................................................................... 25

4.2 Introduction of the classical edge detectors .................................................................... 25

4.3 Types of Edges ................................................................................................................ 26

4.4 Detection of Step Edges .................................................................................................. 26

4.5 Detection of Thin Roof Edges ........................................................................................ 26

4.6 Effects of Differentiation Operators on Edges................................................................ 27

4.7 Edge properties ............................................................................................................... 28

4.8 A Simple Edge model ..................................................................................................... 29

Page 8: Edge detection using wavelets

viii

4.9 Why edge detection is a non-trivial task? ....................................................................... 29

CHAPTER 5 IMAGE ENHANCEMENT .......................................................................... 31

5.1 Image Enhancement ........................................................................................................ 31

5.2 Basics of image editing ................................................................................................... 31

5.3 Editing programs ............................................................................................................. 32

5.4 Image Enhancement features .......................................................................................... 32

5.4.1 Selection .................................................................................................................... 32

5.4.2 Layers ........................................................................................................................ 33

5.4.3 Image size alteration .................................................................................................. 33

5.4.4 Cropping an image .................................................................................................... 33

5.4.5 Histogram .................................................................................................................. 34

5.4.6 Noise reduction .......................................................................................................... 35

5.4.7 Removal of unwanted elements ................................................................................ 35

5.4.8 Selective color change ............................................................................................... 36

5.4.9 Image orientation ....................................................................................................... 36

5.4.10 Perspective correction and distortion ...................................................................... 37

5.4.11 Lens correction ........................................................................................................ 38

5.4.12 Sharpening and softening images ............................................................................ 38

5.4.13 Selecting and merging of images ............................................................................ 38

5.4.14 Slicing of images ..................................................................................................... 39

5.4.15 Special effects .......................................................................................................... 39

5.4.16 Change color depth .................................................................................................. 40

5.4.17 Contrast change and brightening ............................................................................. 40

5.4.18 Color adjustments .................................................................................................... 41

Page 9: Edge detection using wavelets

ix

5.4.19 Printing .................................................................................................................... 42

CHAPTER 6 EDGE DETECTION USING WAVELETS ............................................... 43

6.1 Introduction ..................................................................................................................... 43

6.2 General rules of edge detection....................................................................................... 43

6.3 Mallat’s wavelet .............................................................................................................. 44

6.4 Construction of wavelets for edge detection ................................................................... 46

6.5 Edge detection with wavelet maxima ............................................................................. 47

CHAPTER 7 MUTISCALE EDGE DETECTION ALGORITHM ................................. 49

7.1 Introduction ..................................................................................................................... 49

7.2 Multiscale noise estimation............................................................................................. 50

7.3 Recursive decision process ............................................................................................. 52

7.4 Hierarchical construction of oriented means .................................................................. 54

7.5 Implementation ............................................................................................................... 56

CHAPTER 8 EDGES & THRESHOLDS........................................................................... 58

8.1 Introduction ..................................................................................................................... 58

8.2 Constant Threshold ......................................................................................................... 58

8.3 Hysteresis threshold ........................................................................................................ 59

8.4 Multiscale Correlation threshold..................................................................................... 59

CHAPTER 9 RESULTS ....................................................................................................... 62

9.1 Results ............................................................................................................................. 62

CHAPTER 10 CONCLUSION & FUTUREWORK ......................................................... 64

10.1 Conclusion .................................................................................................................... 64

APPENDIX ............................................................................................................................ 65

REFERENCES ...................................................................................................................... 67

Page 10: Edge detection using wavelets

x

LIST OF FIGURES

FIG NO. CONTENT PAGE NO.

2.1 Coordinate conventions in image processing toolbox…………..…………….6

2.2 Files supported imread………………………………………………..….........6

2.3 Image with low & high dynamic range……………………………….….........8

2.4 Intensity images..................................................................................................8

2.5 Binary images.....................................................................................................9

2.6 Indexed Images..................................................................................................9

2.7 RGB images......................................................................................................11

3.1 Meyer, morlet & Mexican hat wavelet.............................................................13

3.2 Scaling sinusoids...............................................................................................14

3.3 Scaling wavelets................................................................................................15

3.4 Shifting wavelets...............................................................................................15

3.5 Scaling in wavelets...........................................................................................16

3.6 One stage filtering.............................................................................................17

3.7 Downsampling..................................................................................................17

3.8 High freq. & low freq. Sampling......................................................................18

3.9 Wavelet decomposition....................................................................................18

3.10 Decomposition tree..........................................................................................19

3.11 Wavelet transform for analysis.........................................................................20

3.12 Wavelet Analysis..............................................................................................20

3.13 Sinusoid with discontinuity..............................................................................21

3.14 Wavelet coefficients.........................................................................................21

4.1 Different edges models.....................................................................................27

4.2 Step edge & Laplacian edges...........................................................................27

4.3 Concave & convex edges.................................................................................28

Page 11: Edge detection using wavelets

xi

5.1 Cropped images...............................................................................................34

5.2 Histogram of sunflower..................................................................................34

5.3 Removal of unwanted elements......................................................................35

5.4 Selective colour change..................................................................................36

5.5 Original colour of image.................................................................................36

5.6 Image orientation............................................................................................36

5.7 Perspective correction.....................................................................................37

5.8 Special effects of image..................................................................................39

5.9 Conversion of image from rgb to grayscale....................................................39

5.10 Contrast correction..........................................................................................40

5.11 Colour adjustment by photoshop....................................................................41

5.12 Colour retouched photo..................................................................................41

5.13 Printed image..................................................................................................42

6.1 Quadratic & cubic spline................................................................................46

6.2 Wavelet transform upto scale 26....................................................................48

7.1 Block diagram for multiscale edge detection.................................................51

7.2 Theoretical & empirical relation.....................................................................52

7.3 Oriented mean & base level initialization.......................................................56

7.4 Horizontal & vertical & oriented means.........................................................57

8.1 Threshold image..............................................................................................60

8.2 Hysteresis threshold........................................................................................61

8.3 Constant thresholds & hysteresis thresholds...................................................61

8.4 Multiscale correlation thresholds....................................................................62

9.1 Image edges from noisy & original image......................................................63

9.2 Image edges at different scales.......................................................................64

9.3 Comparison of edges......................................................................................64

Page 12: Edge detection using wavelets

xii

LIST OF SYMBOLS

f Norm of gradient

Θ Smoothing Function

L Belongs to

β Multiscale Threshold

µ Orientation

σ Blur scale

ω Angular Frequency

N No. of pixels

Page 13: Edge detection using wavelets

xiii

LIST OF ABBREVIATIONS

ECG ELECTROCARDIOGRAPHY

FBI FEDERAL BUREAU OF INVESTIGATION

GIMP GNU IMAGE MANIPULATION PROGRAM

STFT SHORT TIME FOURIER TRANSFORM

DWT DISCRETE WAVELET TRANSFORM

VCM VISION CONTROLLED MOTION

CCD CHARGE COUPLED DEVICES

MATLAB MATRIX LABORATORY

RGB RED GREEN BLUE

JPEG JOINT PHOTOGRAPIC EXPERTS GROUP

PNG PORTABLE NETWORK GRAPHICS

Page 14: Edge detection using wavelets

1

CHAPTER 1

INTRODUCTION

1.1 Literature survey

The study of wavelet analysis shows that this particular field of mathematics would not have

been developing so quickly were it not for the vast applications that required such a mathematical

tool. In St. Louis, Victor Wickerhauser was using this same mathematics to help the FBI store

fingerprints more economically; while at Yale, Ronald Coifman used it to coax a battered

recording of Brahms playing the piano into yielding its secrets. In France, Yves Meyer of the

University of Paris-Dauphina found himself talking to astronomers about how these new

techniques could be used to study the large-scale structure of the universe.

The technique of edge detection has long been studied by researchers in electrical engineering

and in mathematics. It was not until the work of Mallat and his colleagues that wavelet was

introduced into such studies. Mallat and his colleagues put their emphasis on decomposing and

reconstructing digital signals from their edge information. Here, we make improvements based

on some of the previous results, and develop a wavelet approach for the problem of edge

detection.

The concept of wavelet analysis has been developed since the late 1980’s. However, its idea can

be traced back to the Littlewood-Paley technique and Calderón-Zygmund theory in harmonic

analysis. Wavelet analysis is a powerful tool for time-frequency analysis. Fourier analysis is also

a good tool for frequency analysis, but it can only provide global frequency information, which is

independent of time. Hence, with Fourier analysis, it is impossible to describe the local properties

of functions in terms of their spectral properties, which can be viewed as an expression of the

Heisenberg uncertainty principle. In many applied areas like digital signal processing, time-

frequency analysis is critical. That is, we want to know the frequency properties of a function in a

local time interval. Engineers and mathematicians developed analytic methods that were adapted

Page 15: Edge detection using wavelets

2

to these problems, therefore avoiding the inherent difficulties in classical Fourier analysis. For

this purpose, Dennis Gabor introduced a “sliding-window” technique. He used a Gaussian

function g as a “window” function, and then calculated the Fourier transform of a function in the

“sliding window”. The analyzing function is

ga,b(x) = eiaxg(x − b), a,b R.

The Gabor transform is useful for time-frequency analysis. The Gabor transform was later

generalized to the windowed Fourier transform in which g is replaced by a “timelocal” function

called the “window” function. However, this analyzing function has the disadvantage that the

spatial resolution is limited by the fixed size of the Gaussian envelope In 1985, Yves Meyer

discovered that one could obtain orthonormal bases for L2(R) of the type ψj,k(x) = 2j/2ψ(2jx − k),

j,k Z,

and that the expression f = f, ψj,k > ψj,k,

for decomposing a function into these orthonormal wavelets converged in many function spaces.

The most preeminent books on wavelets are those of Meyer and Daubechies. Meyer focuses on

mathematical applications of wavelet theory in harmonic analysis; Daubechies gives a thorough

presentation of techniques for constructing wavelet bases with desired properties, along with a

variety of methods for mathematical signal analysis. A particular example of an orthonormal

wavelet system was introduced by Alfred Haar. However, the Haar wavelets are discontinuous

and therefore poorly localized in frequency. Stéphane Mallat made a decisive step in the theory

of wavelets in 1987 when he proposed a fast algorithm for the computation of wavelet

coefficients. He proposed the pyramidal schemes that decompose signals into subbands. These

techniques can be traced back to the 1970s when they were developed to reduce quantization

noise. The framework that unifies these algorithms and the theory of wavelets is the concept of a

multi-resolution analysis (MRA). An MRA is an increasing sequence of closed, nested subspaces

VjjZ that tends to L2(R) as j increases. Vj is obtained from Vj+1 by a dilation of factor 2. V0 is

spanned by a function φ that satisfies φ(x) = 2nφ(2x − n).

Equation is called the “two-scale equation”, and it plays an essential role in the theory

of wavelet bases. In chapter three, Mallat’s wavelet theories are discussed in more detail. In

1997, Chui and Wang further discussed the asymptotically optimal time frequency localization

Page 16: Edge detection using wavelets

3

by scaling functions and wavelets. In their paper they proved the convergence of the time-

frequency window sizes of cardinal polynomial B-wavelets, which are used in Mallat’s algorithm

and are important in many other wavelet applications.

1.2 Introduction of the project

The project is ‘Edge detection using wavelets in real time’ which is used in different fields

ranging from medicine to military operations. Initially the methods used for edge detection used

predefined operators like Sobel, Canny, Roberts, Prewitt & other methods also so their efficiency

are limited while wavelets being a new & unexplored field is making revolutionary changes to

the field of image processing. It also gives a significant variation by using the multiscale edge

detection algorithm so giving advantageous & useful results.

An edge in an image is a contour across which the brightness of the image changes abruptly. In

image processing, an edge is often interpreted as one class of singularities. In a function,

singularities can be characterized easily as discontinuities where the gradient approaches infinity.

However, image data is discrete, so edges in an image often are defined as the local maxima of

the gradient. Here we also use an application of this project that is to find the position of the

bottles that is misplaced or has fallen down from the conveyor belt.

1.3 Applications of the project

Some of the few applications of the edge detection using wavelets in real time are

• Biometrics

• Large-scale industrial manufacture

• Short-run unique object manufacture

• Safety systems in industrial environments

• Inspection of pre-manufactured objects (e.g. quality control, failure investigation)

Page 17: Edge detection using wavelets

4

• Visual stock control and management systems (counting, barcode reading, store interfaces for

digital systems)

• Control of Automated Guided Vehicles (AGVs)

• Automated monitoring of sites for security and safety

• Monitoring of agricultural production

• Quality control and refinement of food products

• Retail automation

• Consumer equipment control

• Medical imaging processes (e.g. Interventional Radiology)

• Medical remote examination and procedures

• Vision for Humanoid or Robot also called Robot Vision

• Provide Artificial Visual Sensing for the blind (e.g. Super Vision System, Artificial Eye

System)

Page 18: Edge detection using wavelets

5

CHAPTER 2

IMAGES

2.1 What is an image?

An image may be defined as a two-dimensional function, f(x, y), where x & y are spatial (plane)

coordinates, & the amplitudes of at any pair of coordinates(x, y) is called the intensity of the

image of that point. The term gray level is used often to refer to the intensity of the

monochromatic images. Color images are formed by a combination of individual 2-D images.

For example, in the RGB color system, a color image of consists of three(red, green & blue)

individual component images, For this reason, many of the techniques developed for

monochromatic images can be extended to color images by processing the three component

images individually. An image may be continuous with respect to the x- & y- coordinates, & also

in amplitude. Converting such an image to digital form requires that the coordinates, as the

amplitude, be digitized. Digitizing the coordinate values is called the sampling; digitizing the

amplitude values is called the quantization. Thus when x, y & the amplitude values of f are all

finite, discrete quantities we call the image a digital image.

2.2 Coordinates conventions

The result of sampling & quantization is a matrix of real numbers. An image f(x, y) is sampled so

that the resulting image has M rows & N columns. The values of (x y) are discrete quantities.

Image Processing Toolbox documentation refers to the coordinates in the fig. as Pixels.

Page 19: Edge detection using wavelets

6

Fig 2.1: Coordinate conventions used

2.3 Reading Images:

Images are read into the MATLAB environment using function imread, whose syntax is

Imread(‘filename’)

Fig 2.2: File Supported Imread

Page 20: Edge detection using wavelets

7

Here, filename is a string containing the complete name of the image file (including an

application extension). For example, the command line

>> f=imread(‘filename.jpg’);

2.4 Displaying Images

Images are displayed on the MATLAB desktop using function imshow, which has the basic

syntax:

Imshow (f, θ)

Where f is an image array & θ is the number of intensity levels used to display it. If θ is omitted it

defaults to 256 levels. If another image g is displayed using imshow, MATLAB replaces in the

screen with the new image. To keep the first image & output on second image we use function

figure as follows:

>> figure, imshow(g)

Using the statement

>> imshow(f) , figure, imshow(g)

Displays both the images.

2.5 Writing Images

Images are written to the disk using function IMWRITE, which has the following basic syntax:

imwrite(f, ‘filename’)

With this syntax the string contained in the filename must include a recognized file extension.

Alternatively the desired format can be specified explicitly with a third input argument. For

example the following command writes f to a tiff file named patient 10_run1:

>> imwrite(f,’patient10_run1’,’tif’);

Page 21: Edge detection using wavelets

8

Fig 2.3: (a)An image with low dynamic range (b) Image scaled using imshow

If filename contains no path information then imwrite saves the file in the current working

directory. A more general imwrite syntax applicable only to jpeg images is

Imwrite(f,’filename.jpg’,’quality’,q);

2.6 Image Types

The toolbox supports four types of images:

Fig 2.4: Intensity image

Page 22: Edge detection using wavelets

9

Fig 2.5: Binary image

Fig 2.6: Indexed image

Page 23: Edge detection using wavelets

10

Fig 2.7: RGB image

2.6.1 Intensity Images:

An intensity image is a data matrix whose values have been scaled to represent intensities. When

the elements of an intensity image are of class uint8, or class uint16, they have integer values in

the range [0,255] & [0, 65535], respectively. If the image is of class double, the values are

floating-point numbers. Values of scaled, class double intensity images are in the range [0, 1] by

convention.

2.6.2 Binary Images:

A binary image is an array of logic 0s & 1s. A numeric array is converted to binary using

functional logical. Thus if A is a numeric array consisting of 0s & 1s, we create a logical array B

using the statement

B=logical (A)

Page 24: Edge detection using wavelets

11

CHAPTER 3

WAVELETS

3.1 WHAT ARE WAVELETS

A wavelet is a wave-like oscillation with amplitude that starts out at zero, increases, and then

decreases back to zero. It can typically be visualized as a "brief oscillation" like one might see

recorded by a seismograph or heart monitor. Generally, wavelets are purposefully crafted to have

specific properties that make them useful for signal processing. Wavelets can be combined, using

a "shift, multiply and sum" technique called convolution, with portions of an unknown signal to

extract information from the unknown signal.

For example, a wavelet could be created to have a frequency of Middle C and a short duration of

roughly a 32nd note. If this wavelet were to be convolved at periodic intervals with a signal

created from the recording of a song, then the results of these convolutions would be useful for

determining when the Middle C note was being played in the song. This concept of resonance is

at the core of many practical applications of wavelet theory.

A wavelet is a mathematical function used to divide a given function or continuous-time signal

into different scale components. Usually one can assign a frequency range to each scale

component. Each scale component can then be studied with a resolution that matches its scale. A

wavelet transform is the representation of a function by wavelets. The wavelets are scaled and

translated copies (known as "daughter wavelets") of a finite-length or fast-decaying oscillating

waveform (known as the "mother wavelet"). Wavelet transforms have advantages over traditional

Fourier transforms for representing functions that have discontinuities and sharp peaks, and for

accurately deconstructing and reconstructing finite, non-periodic and/or non-stationary signals.

Wavelet transforms are classified into discrete wavelet transforms (DWTs) and continuous

wavelet transforms (CWTs). Note that both DWT and CWT are continuous-time (analog)

transforms. They can be used to represent continuous-time (analog) signals. CWTs operate over

Page 25: Edge detection using wavelets

every possible scale and translation whereas DWTs use a specific subset of scale and translation

values or representation grid.

3.2 TYPES OF TRANSFORMS

3.2.1 Continuous wavelet transforms (Continuous Shift & Scale Parameters)

In continuous wavelet transforms,

family of frequency bands (or similar subspaces of the

signal may be represented on every frequency band of the form [

f>0. Then, the original signal can be reconstructed by a suitable integration over all the resulting

frequency components.

The frequency bands or subspaces (sub

subspace in turn is in most situations generated by the shifts of one generating function

the mother wavelet. For the example of the scale one frequency band [1,2] this function is

with the (normalized) sinc function

Fig 3.1(a)Meyer

The subspace of scale a or frequency band

called child wavelets)

every possible scale and translation whereas DWTs use a specific subset of scale and translation

TYPES OF TRANSFORMS

Continuous wavelet transforms (Continuous Shift & Scale Parameters)

transforms, a given signal of finite energy is projected on a continuous

family of frequency bands (or similar subspaces of the Lp function space

e represented on every frequency band of the form [f,2f] for all positive frequencies

. Then, the original signal can be reconstructed by a suitable integration over all the resulting

The frequency bands or subspaces (sub-bands) are scaled versions of a subspace at scale

subspace in turn is in most situations generated by the shifts of one generating function

. For the example of the scale one frequency band [1,2] this function is

sinc function. Other example mother wavelets are:

(b)Morlet

(c)Mexican Hat

or frequency band is generated by the functions (sometimes

,

12

every possible scale and translation whereas DWTs use a specific subset of scale and translation

Continuous wavelet transforms (Continuous Shift & Scale Parameters)

a given signal of finite energy is projected on a continuous

. For instance the

] for all positive frequencies

. Then, the original signal can be reconstructed by a suitable integration over all the resulting

e scaled versions of a subspace at scale 1. This

subspace in turn is in most situations generated by the shifts of one generating function ,

. For the example of the scale one frequency band [1,2] this function is

is generated by the functions (sometimes

Page 26: Edge detection using wavelets

13

where a is positive and defines the scale and b is any real number and defines the shift. The pair

(a,b) defines a point in the right halfplane .The projection of a function x onto the

subspace of scale a then has the form

with wavelet coefficients ! """"""""" .

3.2.1.1 Scaling

We've already alluded to the fact that wavelet analysis produces a time-scale view of a signal,

and now we're talking about scaling and shifting wavelets. What exactly do we mean by scale in

this context?

Scaling a wavelet simply means stretching (or compressing) it. To go beyond colloquial

descriptions such as "stretching," we introduce the scale factor, often denoted by the letter If

we're talking about sinusoids, for example, the effect of the scale factor is very easy to

Fig 3.2: Scaling Sinusoids

The scale factor works exactly the same with wavelets. The smaller the scale factor, the more

"compressed" the wavelet.

Page 27: Edge detection using wavelets

14

Fig 3.3: Scaling wavelets

It is clear from the diagram that, for a sinusoid, the scale factor is related (inversely) to the radian

frequency. Similarly, with wavelet analysis, the scale is related to the frequency of the signal.

3.2.1.2 Shifting

Shifting a wavelet simply means delaying (or hastening) its onset. Mathematically, delaying a

function by k is represented by :

Fig 3.4: Shifting Wavelets

Page 28: Edge detection using wavelets

15

3.2.1.3 Scale and Frequency

Notice that the scales in the coefficients plot (shown as y-axis labels) run from 1 to 31. Recall

that the higher scales correspond to the most "stretched" wavelets. The more stretched the

wavelet, the longer the portion of the signal with which it is being compared, and thus the coarser

the signal features being measured by the wavelet coefficients.

Fig 3.5: Wavelets Scaled

Thus, there is a correspondence between wavelet scales and frequency as revealed by wavelet

analysis:

* Low scale a compressed wavelet Rapidly changing details High frequency.

* High scale a Stretched wavelet slowly changing, coarse features Low frequency.

3.2.2 Discrete wavelet transforms (Discrete Shift & Scale parameters)

It is computationally impossible to analyze a signal using all wavelet coefficients, so one may

wonder if it is sufficient to pick a discrete subset of the upper halfplane to be able to reconstruct a

signal from the corresponding wavelet coefficients. One such system is the affine system for

some real parameters a>1, b>0. The corresponding discrete subset of the halfplane consists of all

the points (am,namb)with integers m,n#$%. The corresponding baby wavelets are now given as

ψm,n(t) = a − m / 2ψ(a − mt − nb).

A sufficient condition for the reconstruction of any signal x of finite energy by the formula

&' &' '(&(

Page 29: Edge detection using wavelets

16

is that the functions &') * +#,% form a tight frame of -%..

3.2.2.1 One-Stage Filtering: Approximations and Details

For many signals, the low-frequency content is the most important part. It is what gives the signal

its identity. The high-frequency content, on the other hand, imparts flavor or nuance. Consider

the human voice. If you remove the high-frequency components, the voice sounds different, but

you can still tell what's being said. However, if you remove enough of the low-frequency

components, you hear gibberish. In wavelet analysis, we often speak of approximations and

details. The approximations are the high-scale, low-frequency components of the signal. The

details are the low-scale, high-frequency components. The filtering process, at its most basic

level, looks like this:

Fig 3.6: One Stage Filtering

The original signal, S, passes through two complementary filters and emerges as two signals.

Unfortunately, if we actually perform this operation on a real digital signal, we wind up with

twice as much data as we started with. Suppose, for instance, that the original signal S consists of

1000 samples of data. Then the resulting signals will each have 1000 samples, for a total of 2000.

These signals A and D are interesting, but we get 2000 values instead of the 1000 we had. There

exists a more subtle way to perform the decomposition using wavelets. By looking carefully at

the computation, we may keep only one point out of two in each of the two 2000-length samples

Page 30: Edge detection using wavelets

17

to get the complete information. This is the notion of downsampling. We produce two sequences

called cA and cD.

Fig 3.7: Downsampling

The process on the right, which includes downsampling, produces DWT coefficients. To gain a

better appreciation of this process, let's perform a one-stage discrete wavelet transform of a

signal. Our signal will be a pure sinusoid with high-frequency noise added to it. Here is our

schematic diagram with real signals inserted into it:

Fig 3.8: High Frequency & low frequency sampling

The MATLAB® code needed to generate s, cD, and cA is

s = sin(20.*linspace(0,pi,1000)) + 0.5.*rand(1,1000);

[cA,cD] = dwt(s,'db2'); where db2 is the name of the wavelet we want to use for the analysis.

Page 31: Edge detection using wavelets

18

Notice that the detail coefficients cD are small and consist mainly of a high-frequency noise,

while the approximation coefficients cA contain much less noise than does the original signal

[length(cA) length(cD)]

ans = 501 501

We may observe that the actual lengths of the detail and approximation coefficient vectors are

slightly more than half the length of the original signal. This has to do with the filtering process,

which is implemented by convolving the signal with a filter. The convolution "smears" the signal,

introducing several extra samples into the result.

3.2.2.2 Multiple-Level Decomposition

The decomposition process can be iterated, with successive approximations being decomposed in

turn, so that one signal is broken down into many lower resolution components. This is called the

wavelet decomposition tree.

Fig 3.9: Wavelet Decomposition

Looking at a signal's wavelet decomposition tree can yield valuable information.

Page 32: Edge detection using wavelets

19

Fig 3.10: Decomposition Tree

3.3 Number of Levels

Since the analysis process is iterative, in theory it can be continued indefinitely. In reality, the

decomposition can proceed only until the individual details consist of a single sample or pixel. In

practice, you'll select a suitable number of levels based on the nature of the signal, or on a

suitable criterion such as entropy.

3.4 Wavelet Analysis

Wavelet analysis represents the next logical step: a windowing technique with variable-sized

regions. Wavelet analysis allows the use of long time intervals where we want more precise low-

frequency information, and shorter regions where we want high-frequency information.

Page 33: Edge detection using wavelets

20

Fig 3.11: Wavelet transform for analysis

Here's what this looks like in contrast with the time-based, frequency-based, and STFT views of a

signal:

Fig 3.12: Wavelet analysis

You may have noticed that wavelet analysis does not use a time-frequency region, but rather a

time-scale region.

3.5 What Can Wavelet Analysis Do?

One major advantage afforded by wavelets is the ability to perform local analysis -- that is, to

analyze a localized area of a larger signal. Consider a sinusoidal signal with a small discontinuity

-- one so tiny as to be barely visible. Such a signal easily could be generated in the real world,

perhaps by a power fluctuation or a noisy switch.

Page 34: Edge detection using wavelets

21

Fig 3.13: Sinusoid with discontinuity

A plot of the Fourier coefficients (as provided by the fft command) of this signal shows nothing

particularly interesting: a flat spectrum with two peaks representing a single frequency. However,

a plot of wavelet coefficients clearly shows the exact location in time of the discontinuity.

Fig 3.14: Wavelet Coefficients

Wavelet analysis is capable of revealing aspects of data that other signal analysis techniques

miss, aspects like trends, breakdown points, discontinuities in higher derivatives, and self-

similarity. Furthermore, because it affords a different view of data than those presented by

traditional techniques, wavelet analysis can often compress or de-noise a signal without

appreciable degradation.

Indeed, in their brief history within the signal processing field, wavelets have already proven

themselves to be an indispensable addition to the analyst's collection of tools and continue to

enjoy a burgeoning popularity today.

Page 35: Edge detection using wavelets

22

3.6 Wavelet Applications

Wavelets have scale aspects and time aspects; consequently every application has scale and time

aspects. To clarify them we try to untangle the aspects somewhat arbitrarily. For scale aspects,

we present one idea around the notion of local regularity. For time aspects, we present a list of

domains. When the decomposition is taken as a whole, the de-noising and compression processes

are center points.

3.6.1 Scale Aspects

As a complement to the spectral signal analysis, new signal forms appear. They are less regular

signals than the usual ones. The cusp signal presents a very quick local variation. Its equation is

with t close to 0 and 0 < r <1. The lower the r sharper the signal. To illustrate this notion

physically, imagine you take a piece of aluminum foil; the surface is very smooth, very regular.

You first crush it into a ball, and then you spread it out so that it looks like a surface. The

asperities are clearly visible. Each one represents a two-dimension cusp and analog of the one

dimensional cusp. If you crush again the foil, more tightly, in a more compact ball, when you

spread it out, the roughness increases and the regularity decrease.

Several domains use the wavelet techniques of regularity study:

* Biology for cell membrane recognition, to distinguish the normal from the pathological

membranes

* Metallurgy for the characterization of rough surfaces

* Finance (which is more surprising), for detecting the properties of quick variation of values

* In Internet traffic description, for designing the services size

Page 36: Edge detection using wavelets

23

3.6.2 Time Aspects

Ø Let's switch to time aspects. The main goals are

Ø Rupture and edges detection

Ø Study of short-time phenomena as transient processes

As domain applications, we get

Ø Industrial supervision of gear-wheel

Ø Checking undue noises in craned or dented wheels, and more generally in nondestructive

control quality process

Ø Detection of short pathological events as epileptic crises or normal ones as evoked

potentials in EEG (medicine)

Ø SAR imagery

Ø Automatic target recognition

Ø Intermittence in physics

3.6.3 Wavelet Decomposition as a Whole

Many applications use the wavelet decomposition taken as a whole. The common goals concern

the signal or image clearance and simplification, which are parts of de-noising or compression.

We find many published papers in oceanography and earth studies. One of the most popular

successes of the wavelets is the compression of FBI fingerprints. When trying to classify the

applications by domain, it is almost impossible to sum up several thousand papers written within

the last 15 years. Moreover, it is difficult to get information on real-world industrial applications

from companies. They understandably protect their own information. Some domains are very

productive. Medicine is one of them. We can find studies on micro-potential extraction in EKGs,

on time localization of His bundle electrical heart activity, in ECG noise removal. In EEGs, a

quick transitory signal is drowned in the usual one. The wavelets are able to determine if a quick

signal exists, and if so, can localize it. There are attempts to enhance mammograms to

discriminate tumors from calcifications. Another prototypical application is a classification of

Magnetic Resonance Spectra. The study concerns the influence of the fat we eat on our body fat.

Page 37: Edge detection using wavelets

24

The type of feeding is the basic information and the study is intended to avoid taking a sample of

the body fat. Each Fourier spectrum is encoded by some of its wavelet coefficients. A few of

them are enough to code the most interesting features of the spectrum. The classification is

performed on the coded vectors.

Page 38: Edge detection using wavelets

25

CHAPTER 4

EDGES

4.1 What is edge and what is an edge detector?

An edge in an image is a contour across which the brightness of the image changes abruptly. In

image processing, an edge is often interpreted as one class of singularities. In a function,

singularities can be characterized easily as discontinuities where the gradient approaches infinity.

However, image data is discrete, so edges in an image often are defined as the local maxima of

the gradient. This is the definition we will use here.

Edge detection is an important task in image processing. It is a main tool in pattern recognition,

image segmentation, and scene analysis. An edge detector is basically a high-pass filter that can

be applied to extract the edge points in an image. This topic has attracted many researchers and

many achievements have been made. In this paper, we will explain the mechanism of edge

detectors from the point of view of wavelets and develop a way to construct edge detection filters

using wavelet transforms. 4.2 Introduction of the classical edge detectors

Many classical edge detectors have been developed over time. They are based on the principle of

matching local image segments with specific edge patterns. The edge detection is realized by the

convolution with a set of directional derivative masks. The popular edge detection operators are

Roberts, Sobel, Prewitt, Frei-Chen, and Laplacian operators. They are all defined on a 3 by 3

pattern grid, so they are efficient and easy to apply. In certain situations where the edges are

highly directional, some edge detector works especially well because their patterns fit the edges

better.

Page 39: Edge detection using wavelets

26

4.3 Types of Edges

• Step edge • Concave slope edge • Convex slope edge • Roof edge • Valley edge • Staircase edge

4.4 Detection of Step Edges

Edges are detected as local maxima of the energy summed over eight equally spaced directions

and nine different scales (see next section). Local maxima were detected by a modification of the

well-known non maximal suppression algorithm (performed, in each point, along the direction

perpendicular to the filter providing the highest response). Such modification consists of an

energy- driven thinning which removes possible double edges, i.e., boundaries with a thickness

larger than one pixel, which may occur using the standard non maximal suppression.

4.5 Detection of Thin Roof Edges

It is well known, that the detection of thin details in real images, as the thin bars shown in is best

obtained by using both even and odd filters, when the output of even filters dominates at the

center of the bar and the output of odd filters reduces and eliminates spurious maxima near the

bar boundaries. If only even filters are used, multiple maxima are detected at the center of the bar

and at its boundaries. In this section, it will be shown that the detection of thin bars, however, is

best obtained considering only the energy along the direction of maximal response and not the

energy summed over all directions, like it was done instead for the detection of step edges.

Page 40: Edge detection using wavelets

27

4.6 Effects of Differentiation Operators on Edges

In this section we present some models of edges, and ex-amine their behavior in the case of the

gradient or the first directional derivative in the gradient direction, and in the case of the

Laplacian. We limit our study to step, concave slope, convex slope, roof, valley and staircase

edges. Peaks are implicitly considered in our work, since after smoothing, a peak will be similar

to a roof or a valley. These models cover the majority of edges which can be generated by

physical contours of the scene, hence their importance to represent an image.

We carry out this study in the discrete case, without noise, and considering a small scale of

smoothing to avoid its effect on edges. For the sake of simplicity the edge pro-files illustrated in

Figures are plotted as continuous functions. At the step edge the module of the gradient

edge

point c)

a) b)

d) e) f) g)

Models of ideal edges. The edge point in each model is indicated by an arrow. Fig 4.1: a) Step. b) Concave slope. c) Convex slope. d) Roof. e) Valley. f) Staircase. g) Peak.

has a maximum which we call maximum, and the Laplacian yields a zero-crossing which we call

zero-crossing.

edge point L

zero-crossing L

a) b) c)

Fig 4.2: a) Step edge. b) The gradient image. c) The Laplacian image. At concave slope and convex slope edges, the first directional derivative is a step whose

inflection point locates the edge. In the case of concave slopes (resp. convex slopes) the

Laplacian generates a positive maximum (resp. a negative minimum) which we call

maximum(resp. minimum).

Page 41: Edge detection using wavelets

28

At symmetric roof and valley edges, the module of the gradient has a minimum equal to zero

which we call zero, and the Laplacian provides a negative minimum in the case of a roof and a

positive maximum in the case of a valley. If roof and valley edges are asymmetrical, the module

of the gradient of each is a positive minimum which we call minimum. The response of the

Laplacian operator to these edges is similar to the symmetrical case.

At a staircase edge, the module of the gradient is often a positive minimum and the Laplacian

yields a zero-crossing.

It is well known that at a step edge, the gradient direction is perpendicular to its tangent. Usually,

the gradient modulus of a concave slope, convex slope, roof, valley and staircase is not zero. In

fact, in realistic images the width of a staircase is not large and the roofs/valleys are not

symmetric. Generally the gradient direction is perpendicular to the tangents of the concave slope,

convex slope and staircase edges, and less often to the tangents of the roof and valley edges.

4.7 Edge properties

The edges extracted from a two-dimensional image of a three-dimensional scene can be classified

as either viewpoint dependent or viewpoint independent. A viewpoint independent edge typically

reflects inherent properties of the three-dimensional objects, such as surface markings and

surface shape. A viewpoint dependent edge may change as the viewpoint changes, and typically

reflects the geometry of the scene, such as objects occluding one another.

A typical edge might for instance be the border between a block of red color and a block of

yellow. In contrast a line (as can be extracted by a ridge detector) can be a small number of pixels

of a different color on an otherwise unchanging background. For a line, there may therefore

usually be one edge on each side of the line.

Edges play quite an important role in many applications of image processing, in particular for

machine vision systems that analyze scenes of man-made objects under controlled illumination

conditions. During recent years, however, substantial (and successful) research has also been

made on computer vision methods that do not explicitly rely on edge detection as a pre-

processing step.

Page 42: Edge detection using wavelets

29

4.8 A Simple Edge model

Although certain literature has considered the detection of ideal step edges, the edges obtained

from natural images are usually not at all ideal step edges. Instead they are normally affected by

one or several of the following effects:

• Focal blur caused by a finite depth-of-field and finite point spread function.

• Penumbral blur caused by shadows created by light sources of non-zero radius.

• shading at a smooth object

and a number of researchers have used a Gaussian smoothed step edge (an error function) as the

simplest extension of the ideal step edge model for modeling the effects of edge blur in practical

applications.Thus, a one-dimensional image f which has exactly one edge placed at x = 0 may be

modeled as:

/ 01 2 034 5678 5

94:; < =; < 03

At the left side of the edge, the intensity is

03 >?@ABCD / , and right of the edge it is

01 >?@ABD /. The scale parameter σ is called the blur scale of the edge.

4.9 Why edge detection is a non-trivial task

To illustrate why edge detection is not a trivial task, let us consider the problem of detecting

edges in the following one-dimensional signal. Here, we may intuitively say that there should be

an edge between the 4th and 5th pixels.

Page 43: Edge detection using wavelets

30

5 7 6 4 152 148 149

If the intensity difference were smaller between the 4th and the 5th pixels and if the intensity

differences between the adjacent neighboring pixels were higher, it would not be as easy to say

that there should be an edge in the corresponding region. Moreover, one could argue that this

case is one in which there are several edges.

5 7 6 41 113 148 149

Hence, to firmly state a specific threshold on how large the intensity change between two

neighboring pixels must be for us to say that there should be an edge between these pixels is not

always a simple problem. Indeed, this is one of the reasons why edge detection may be a non-

trivial problem unless the objects in the scene are particularly simple and the illumination

conditions can be well controlled.

Page 44: Edge detection using wavelets

31

CHAPTER 5

IMAGE ENHANCEMENT

5.1 Image Enhancement

Image enhancement encompasses the processes of altering images, whether they be digital

photographs, traditional analog photographs, or illustrations. Traditional analog image editing is

known as photo retouching, using tools such as an airbrush to modify photographs, or editing

illustrations with any traditional art medium. Graphic software programs, which can be broadly

grouped into vector graphics editors, raster graphics editors, and 3d modelers, are the primary

tools with which a user may manipulate, enhance, and transform images. Many image editing

programs are also used to render or create computer art from scratch.

5.2 Basics of image editing

Raster images are stored in a computer in the form of a grid of picture elements, or pixels. These

pixels contain the image's color and brightness information. Image editors can change the pixels

to enhance the image in many ways. The pixels can be changed as a group, or individually, by the

sophisticated algorithms within the image editors. The domain of this article primarily refers to

bitmap graphics editors, which are often used to alter photographs and other raster graphics.

However, vector graphics software, such as Adobe Illustrator or Inkscape, are used to create and

modify vector images, which are stored as descriptions of lines, Bézier splines, and text instead

of pixels. It is easier to rasterize a vector image than to vectorize a raster image; how to go about

vectorizing a raster image is the focus of much research in the field of computer vision. Vector

images can be modified more easily, because they contain descriptions of the shapes for easy

rearrangement. They are also scalable, being rasterizable at any resolution.

Page 45: Edge detection using wavelets

32

5.3 Editing programs

Due to the popularity of digital cameras, image editing programs are readily available. Minimal

programs, that perform such operations as rotating and cropping, are often provided within the

digital camera itself, while others are returned to the user on a compact disc (CD) when images

are processed at a discount store. The more powerful programs contain functionality to perform a

large variety of advanced image manipulations. Popular raster-based digital image editors include

Adobe Photoshop, GIMP, Corel Photo-Paint, Paint Shop Pro and Paint.NET.

Besides programs that mainly concentrate on editing one image at a time, such as those listed

above, there exist many batch image processing tools that let one resize, convert, watermark, or

otherwise edit images.

5.4 Image Enhancement features

Listed below are some of the most used capabilities of the better graphic manipulation programs.

The list is by no means all inclusive. There are a myriad of choices associated with the

application of most of these features.

5.4.1 Selection

One of the prerequisites for many of the applications mentioned below is a method of selecting

part(s) of an image, thus applying a change selectively without affecting the entire picture. Most

graphics programs have several means of accomplishing this, such as a marquee tool, lasso,

vector-based pen tools as well as more advanced facilities such as edge detection, masking, alpha

compositing, and color and channel-based extraction.

Page 46: Edge detection using wavelets

33

5.4.2 Layers

Another feature common to many graphics applications is that of Layers, which are analogous to

sheets of transparent acetate (each containing separate elements that make up a combined

picture), stacked on top of each other, each capable of being individually positioned, altered and

blended with the layers below, without affecting any of the elements on the other layers. This is a

fundamental workflow which has become the norm for the majority of programs on the market

today, and enables maximum flexibility for the user while maintaining non-destructive editing

principles and ease of use.

5.4.3 Image size alteration

Image editors can resize images in a process often called image scaling, making them larger, or

smaller. High image resolution cameras can produce large images which are often reduced in size

for Internet use. Image editor programs use a mathematical process called resampling to calculate

new pixel values whose spacing is larger or smaller than the original pixel values. Images for

Internet use are kept small, say 640 x 480 pixels which would equal 0.3 megapixels.

5.4.4 Cropping an image

Digital editors are used to crop images. Cropping creates a new image by selecting a desired

rectangular portion from the image being cropped. The unwanted part of the image is discarded.

Image cropping does not reduce the resolution of the area cropped. Best results are obtained

when the original image has a high resolution. A primary reason for cropping is to improve the

image composition in the new image.

Page 47: Edge detection using wavelets

34

5.4.5 Histogram

Image editors have provisions to create an image histogram of the image being edited. The

histogram plots the number of pixels in the image (vertical axis) with a particular brightness

value (horizontal axis). Algorithms in the digital editor allow the user to visually adjust the

brightness value of each pixel and to dynamically display the results as adjustments are made.

Improvements in picture brightness and contrast can thus be obtained.

Fig 5.2:(a)Sunflower image

(b)Histogram of Sunflower image

Fig 5.1 (a) Uncropped image from camera

(b) Lilly cropped from larger image

Page 48: Edge detection using wavelets

35

5.4.6 Noise reduction

Image editors may feature a number of algorithms which can add or remove noise in an image.

JPEG artifacts can be removed; dust and scratches can be removed and an image can be de-

speckled. Noise reduction merely estimates the state of the scene without the noise and is not a

substitute for obtaining a "cleaner" image. Excessive noise reduction leads to a loss of detail, and

its application is hence subject to a trade-off between the undesirability of the noise itself and that

of the reduction artifacts.

Noise tends to invade images when pictures are taken in low light settings. A new picture can be

given an 'antiquated' effect by adding uniform monochrome noise.

5.4.7 Removal of unwanted elements

Most image editors can be used to remove unwanted branches, etc, using a "clone" tool.

Removing these distracting elements draws focus to the subject, improving overall composition.

Fig 5.3: (a)Notice the branch in the original

(b)The eye is drawn to the center of the globe

Page 49: Edge detection using wavelets

5.4.8 Selective color change

Some image editors have color swapping abilities to selectively change the color of specific items

in an image, given that the selected items are within a specific color range.

Fig 5.4:

5.4.9 Image orientation

Fig 5.6: Image orientation:

Some image editors have color swapping abilities to selectively change the color of specific items

an image, given that the selected items are within a specific color range.

An example of selective color change, the original is on the left.

Fig 5.5: The original car is on the right.

Image orientation: left–original; center–30° CCW rotation; right–flopped .

36

Some image editors have color swapping abilities to selectively change the color of specific items

flopped .

Page 50: Edge detection using wavelets

37

Image editors are capable of altering an image to be rotated in any direction and to any degree.

Mirror images can be created and images can be horizontally flipped or vertically flopped. A

small rotation of several degrees is often enough to level the horizon, correct verticality (of a

building, for example), or both. Rotated images usually require cropping afterwards, in order to

remove the resulting gaps at the image edges.

5.4.10 Perspective correction and distortion

Some image editors allow the user to distort (or "transform") the shape of an image. While this

might also be useful for special effects, it is the preferred method of correcting the typical

perspective distortion which results from photographs being taken at an oblique angle to a

rectilinear subject. Care is needed while performing this task, as the image is reprocessed using

interpolation of adjacent pixels, which may reduce overall image definition. The effect mimics

the use of a perspective correction lens, which achieves a similar correction in-camera without

loss of definition.

Fig 5.7: Perspective correction: left–original, uncorrected

right–perspective distortion removed.

Page 51: Edge detection using wavelets

38

5.4.11 Lens correction

Photo manipulation packages have functions to correct images for various lens distortions

including pincushion, fisheye and barrel distortions. The corrections are in most cases subtle, but

can improve the appearance of some photographs.

5.4.12 Sharpening and softening images

Graphics programs can be used to both sharpen and blur images in a number of ways, such as

unsharp masking or deconvolution. Portraits often appear more pleasing when selectively

softened (particularly the skin and the background) to better make the subject stand out. This can

be achieved with a camera by using a large aperture, or in the image editor by making a selection

and then blurring it. Edge enhancement is an extremely common technique used to make images

appear sharper, although purists frown on the result as appearing unnatural.

5.4.13 Selecting and merging of images

Many graphics applications are capable of merging one or more individual images into a single

file. The orientation and placement of each image can be controlled.

When selecting a raster image that is not rectangular, it requires separating the edges from the

background, also known as silhouetting. This is the digital version of cutting out the image.

Clipping paths may be used to add silhouetted images to vector graphics or page layout files that

retain vector data. Alpha compositing allows for soft translucent edges when selecting images.

There are a number of ways to silhouette an image with soft edges including selecting the image

or its background by sampling similar colors, selecting the edges by raster tracing, or converting

a clipping path to a raster selection. Once the image is selected, it may be copied and pasted into

another section of the same file, or into a separate file. The selection may also be saved in what is

known as an alpha channel.

Page 52: Edge detection using wavelets

39

A popular way to create a composite image like this one is to use transparent layers. The

background image is used as the bottom layer, and the image with parts to be added are placed in

a layer above that. Using an image layer mask, all but the parts to be merged are hidden from the

layer, giving the impression that these parts have been added to the background layer. Performing

a merge in this manner preserves all of the pixel data on both layers to more easily enable future

changes in the new merged image.

5.4.14 Slicing of images

A more recent tool in digital image editing software is the image slicer. Parts of images for

graphical user interfaces or web pages are easily sliced, labeled and saved separately from whole

images so the parts can be handled individually by the display medium. This is useful to allow

dynamic swapping via interactivity or animating parts of an image in the final presentation.

5.4.15 Special effects

Fig 5.8: An example of some special effects that can be added to a picture.

Image editors usually have a list of special effects that can create unusual results. Images may be

Page 53: Edge detection using wavelets

40

skewed and distorted in various ways. Scores of special effects can be applied to an image which

include various forms of distortion, artistic effects, geometric transforms and texture effects, or

combinations thereof.

5.4.16 Change color depth

Fig 5.9: An example of converting an image from color to grayscale.

It is possible, using software, to change the color depth of images. Common color depths are 2, 4,

16, 256, 65.5 thousand and 16.7 million colors. The JPEG and PNG image formats are capable of

storing 16.7 million colors (equal to 256 luminance values per color channel). In addition,

grayscale images of 8 bits or less can be created, usually via conversion and down-sampling from

a full color image.

5.4.17 Contrast change and brightening

Fig 5.10: An example of contrast correction. Left side of the image is untouched.

Image editors have provisions to simultaneously change the contrast of images and brighten or

darken the image. Underexposed images can often be improved by using this feature. Recent

advances have allowed more intelligent exposure correction whereby only pixels below a

Page 54: Edge detection using wavelets

particular luminosity threshold are brightened, thereby brightening underexposed shadows

without affecting the rest of the image. The exact transformation that is applied to each color

channel can vary from editor to editor. GIMP applies the

5.4.18 Color adjustments

Fig 5.11

Fig 5.12

The color of images can be altered in a variety of ways. Colors can be faded in and out, and tones

can be changed using curves or other tools. The color balance can be improved, which is

important if the picture was shot indoors with daylight film, or shot

balance incorrectly set. Special effects, like sepia and grayscale can be added to a image. In

addition, more complicated procedures such as the mixing of color channels are possible using

more advanced graphics editors.

particular luminosity threshold are brightened, thereby brightening underexposed shadows

without affecting the rest of the image. The exact transformation that is applied to each color

channel can vary from editor to editor. GIMP applies the following formula:

Fig 5.11: An example of color adjustment using Photoshop

Fig 5.12: Color retouched photo (cycles every 3 seconds)

The color of images can be altered in a variety of ways. Colors can be faded in and out, and tones

can be changed using curves or other tools. The color balance can be improved, which is

important if the picture was shot indoors with daylight film, or shot on a camera with the white

balance incorrectly set. Special effects, like sepia and grayscale can be added to a image. In

addition, more complicated procedures such as the mixing of color channels are possible using

more advanced graphics editors.

41

particular luminosity threshold are brightened, thereby brightening underexposed shadows

without affecting the rest of the image. The exact transformation that is applied to each color

The color of images can be altered in a variety of ways. Colors can be faded in and out, and tones

can be changed using curves or other tools. The color balance can be improved, which is

on a camera with the white

balance incorrectly set. Special effects, like sepia and grayscale can be added to a image. In

addition, more complicated procedures such as the mixing of color channels are possible using

Page 55: Edge detection using wavelets

42

The red-eye effect, which occurs when flash photos are taken when the pupil is too widely open

(so that light from the flash that passes into the eye through the pupil reflects off the fundus at the

back of the eyeball), can also be eliminated at this stage.

5.4.19 Printing

Fig 5.13: Control printed image by changing ppi.

Controlling the print size and quality of digital images requires an understanding of the pixels-

per-inch (ppi) variable that is stored in the image file and sometimes used to control the size of

the printed image. Within the Image Size dialog (as it is called in Photoshop), the image editor

allows the user to manipulate both pixel dimensions and the size of the image on the printed

document. These parameters work together to produce a printed image of the desired size and

quality. Pixels per inch of the image, pixel per inch of the computer monitor, and dots per inch on

the printed document are related, but in use are very different. The Image Size dialog can be used

as an image calculator of sorts. For example, a 1600 x 1200 image with a ppi of 200 will produce

a printed image of 8 x 6 inches. The same image with a ppi of 400 will produce a printed image

of 4 x 3 inches. Change the ppi to 800, and the same image now prints out at 2 x 1.5 inches. All

three printed images contain the same data (1600 x 1200 pixels) but the pixels are closer together

on the smaller prints, so the smaller images will potentially look sharp when the larger ones do

not. The quality of the image will also depend on the capability of the printer.

Page 56: Edge detection using wavelets

43

CHAPTER 6

EDGE DETECTION USING WAVELETS

6.1 Introduction

A remarkable property of the wavelet transform is its ability to characterize the local regularity of

functions. For an image f(x, y), its edges correspond to singularities of f(x, y), and thus are

related to the local maxima of the wavelet transform modulus. Therefore, the wavelet transform

is an effective method for edge detection.

6.2 General rules of edge detection

Edge detectors are modified gradient operators. Since an edge is characterized by having a

gradient of large magnitude, edge detectors are approximations of gradient operators. Because

noise influences the accuracy of the computation of gradients, usually an edge detector is a

combination of a smoothing filter and a gradient operator. An image is first smoothed by the

smoothing filter and then its gradient is computed by the gradient operator. The 2-normof the

gradient is

In order to simplify computation, in image processing us often use the 1-norm

instead. Their discrete forms are

Page 57: Edge detection using wavelets

44

respectively. In image processing, the following two ways are used to define edges. (1) Local

maxima definition. Let f(x, y) H2(Ω). A point is called an edge point of the image

f(x, y), if has a (strictly) local maximum at (x, y), i.e in a

neighborhood of (x, y). An edge curve in an image is a continuous curve on which all points are

edge points. The set of all edge points of f(x, y) is called an edge image of f(x, y). (2) Threshold

definition. Let f(x, y) H2(Ω). Assume that max (x,y)Ω kf(x, y)k = M. Choose K, 0 < K < M,

as the edge threshold. If then (x, y) is called an edge point of f(x, y).

6.3 Mallat’s wavelet

We first define a smoothing function φ(x), then we build the wavelet ψ(x), which is associated

with φ(x). We know that the Fourier transform of the smoothing function φ(x) can be written as

an infinite product

where () is a 2periodic differentiable function such that

We define a wavelet ψ(x) whose Fourier transform ψ(ω) is given by

where G(ω) is a 2π periodic function.

Page 58: Edge detection using wavelets

45

Let the smoothing function θ(x) be such that ψ(x) is the first-order derivative of θ(x).

A family of 2π periodic functions H(ω) and G(ω), that satisfy these constrains, is given By

The Fourier transformθ(ω) of the primitive is therefore

prove that ψ(x) is a quadratic spline with compact support, whereas θ(x) is a cubic spline whose

integral is equal to 1

Fig 6.1: Quadratic & Cubic spline

Now the wavelet is expanded to 2-D. Define

Since ψ(x) = , these two wavelets can be rewritten as

Page 59: Edge detection using wavelets

46

The functions θ1(x, y) and θ2(x, y) are numerically close enough so that they can be considered

to be equal to a single function θ(x, y) in a first approximation.

6.4 Construction of wavelets for edge detection

We assume the smoothing function θ(x) is twice differentiable and define, respectively, ψa(x) and

ψb(x) as the first- and second-order derivatives of θ(x)

the functions ψa(x) and ψb(x) can be considered to be wavelets because their integral is equal to 0.

A wavelet transform is computed by convolving the signal with a dilated wavelet. The wavelet

transform of f(x) at the scale s and position x, computed with respect to the wavelet ψa(x), is

defined by

The wavelet transform of f (x) with respect to ψb(x) is

Page 60: Edge detection using wavelets

47

Therefore, the wavelet transforms Wasf(x) and Wb s f(x) are, respectively, the first and second

derivative of the signal smoothed at the scale s. The local extrema of Wa s f(x) thus correspond to

the zeros of Wb s f (x) and to the inflection points of f θs(x).

It is straight forward that

Hence, edge points can be located from the two components, W1 s f(x, y) andW2 s f(x, y), of the

wavelet transform.

Higher degree differentiations of θ also comply with the definition of wavelets in

6.5 Edge detection with wavelet maxima

In a signal, there are usually four kinds of edges, which can be indicated in one dimension

Page 61: Edge detection using wavelets

48

Wavelet transform of different types of edges throughout scales :

Fig 6.2 (a)Original signal; (b)Wavelet transform computed upto scale 26; (c)At each scale, each dirac indicates the position of a modulus location.

The edges between 0 and 100 are step edges; the edge between 100 and 200 is a smoothed step

edge; The edge between 200 and 300 is a Dirac edge; and the edges between 350 and 650 are

fractal edges. Fig. 3.2(b) shows the wavelet transform of this signal on different edges in dyadic

scales. Fig. 3.2(c) shows the modulus maxima which indicate the location of the edges. By taking

the wavelet transform, we can locate all four kinds of edges. Here, we will explain the reason by

presenting some theorems. In an image, all edges are not created equal. Some are more

significant, and some are blurred and insignificant. The edges of more significance are usually

more important and more likely to be kept intact by wavelet transforms. The insignificant edges

are sometimes introduced by noise and preferably removed by wavelet transforms. In

mathematics, the sharpness of an edge can be described with Lipschitz exponent. Local Lipschitz

regularity can be efficiently measured by wavelet transforms.

Page 62: Edge detection using wavelets

49

CHAPTER 7

MUTISCALE EDGE DETECTION ALGORITHM

7.1 INTRODUCTION

Our goal is to simultaneously extract edges of all lengths, in both natural and noisy images. Let

I(x; y) denote a continuous function representing image intensities given in a two-dimensional

domain. We denote by oriented means the family of averages of I(x; y) along rectangular patches

of a given center location x = (x; y), length L, width w, and orientation µ. Typically in our

implementation w is set to a small constant, yielding elongated oriented means. The family of

oriented means can be obtained via integrals of the form

Our approach utilizes responses of differences of oriented means (briefly denoted responses).

This family of responses is defined as

With s ¸ w=2 to avoid overlap. D defines an average difference of neighboring oriented means of

the same orientation. Given a collection of responses, our first task is to determine which

response is significant. This is achieved by applying a scale adaptive threshold determined by

measuring the magnitude of the noise in the image and by considering the length and width of the

measured response. Next we examine the set of significant responses at each length. While some

of these responses may indeed indicate the presence of an edge of the appropriate length, others

may be due to scattered collections of shorter edges. We therefore apply a recursive decision

Page 63: Edge detection using wavelets

process to distinguish between these two

a data structure for efficient computation of oriented means.

7.2 Multiscale noise estimation

Our first task is to identify differences of oriented means that elicit significant responses. In this

section we derive a scale adaptive threshold that takes into account the properties of the noise as

well as the length and width of our filter. Below we

significantly across the image and that the pixel noise is normally distributed as

Suppose we apply differences of oriented means

noise. Denote by DL;w the discrete

two averages of wL=2 normal distributions. Consequently,

DL;w » N(0; ¾2 L ), where ¾

realedges and those that are due to noise, we wish to estimate the chance that given a real number

process to distinguish between these two cases. Finally, our algorithm relies on a framework and

a data structure for efficient computation of oriented means.

Fig 7.1: BLOCK DIAGRAM

Multiscale noise estimation

Our first task is to identify differences of oriented means that elicit significant responses. In this

section we derive a scale adaptive threshold that takes into account the properties of the noise as

well as the length and width of our filter. Below we assume that the noise does not vary

significantly across the image and that the pixel noise is normally distributed as

Suppose we apply differences of oriented means D(x; L;w; s; µ) to an image composed of white

the discrete form of D(x; L;w; s; µ), so DL;w is the average difference of

2 normal distributions. Consequently, DL;w itself distributes normally,

¾2 L = ¾2=(wL). In order to differentiate between responses due to

and those that are due to noise, we wish to estimate the chance that given a real number

50

Finally, our algorithm relies on a framework and

Our first task is to identify differences of oriented means that elicit significant responses. In this

section we derive a scale adaptive threshold that takes into account the properties of the noise as

assume that the noise does not vary

significantly across the image and that the pixel noise is normally distributed as N(0; ¾2).

) to an image composed of white

is the average difference of

itself distributes normally,

). In order to differentiate between responses due to

and those that are due to noise, we wish to estimate the chance that given a real number

Page 64: Edge detection using wavelets

51

t À ¾L, a value d drawn from the distribution DL;w » N(0; ¾2 L ) satisfies d < t, i.e., p(d <

t)= : Therefore, we first estimate the following integral for

With this estimate, we obtain

Suppose we produce O(N) responses of length L, where\ N is the number of pixels in the image.

To differentiate between true edge responses and noise responses, we would like to determine an

adaptive threshold t(w; L;N) such that with high probability the values of all noise responses d

obtained for a noise image will fall in the range [¡t; t]. According to ,this means (1 ¡ ²)N = O(1),

which implies 1 ¡ ²N = O(1), in other words to assure high-probability we demand

. Plugging the definition of into the latter relation and taking the natural

logarithm leads to the following approximate relation

Fig 7.2: Theoretical & Empirical relation

Page 65: Edge detection using wavelets

52

where the approximation is due to the relation under the assumption

This approximation yields the relation

which means that a response which exceeds t(L;w;N) can potentially indicate the existence of a

real edge. This is the scale-adaptive threshold that we have used throughout our experiments.

Clearly, it can be very useful only if we are able estimate σ the standard deviation of the pixel

noise. We suggest estimating σ in the following simple way: for each pixel we calculate the

minimal standard deviation obtained from the collection of 3 £ 3 windows containing the pixel.

We then construct a histogram summarizing the empirical distribution of this minimal standard

deviation obtained for all the pixels. σ is determined as the 90th percentile value of this

histogram. We have further confirmed this adaptive threshold empirically. We generated

synthetic white noise images (200 £ 200 pixels) with different values of standard deviation σ and

measured for a width w = 4 the maximal response overall length-L responses, for L = 2; 4; 8; 16;

32; 64. Figure shows that the ratio obtained between the maximal response and σ is comparable

to the theoretical estimate of the ratio,

7.3 Recursive decision process

A response D(x; L;w; s; µ) of length L (and fixed w) is considered significant if it exceeds the

length adaptive threshold, i.e., D ¸ TL := t(L;w;N). However, while the threshold is designed to

eliminate responses due to noise,

long responses may still exceed the threshold due to scattered, short edges of high contrast. In

this section we describe a recursive procedure whose objective is to distinguish between

responses due to long edges from responses due to scattered sub-edges. A natural way to

determine the composition of a response is to consider sub-portions of the edge and test whether

they too give rise to a significant response. For a response of length L consider an arbitrary sub-

edge of length cL (0 < c < 1). Based on our analysis, such a response is considered significant if

Page 66: Edge detection using wavelets

53

it exceeds the threshold TcL. However, since TcL > TL, requiring every portion of an edge to

exceed its respective threshold would amount to requiring the complete length-L edge to exceed

the higher threshold TcL, making the scale-adaptive threshold useless. A more relaxed approach

is to require each sub-edge of length cL to pass the threshold for the complete edge TL. This

approach too is unsatisfactory since, due to noise, short portions of a long edge may fall below

the threshold. We address this problem by requiring that most of the sub-edges will pass some

lower threshold and that the remaining gaps will be short relative to the length of the edge. We

therefore define two parameters, ® and ¯ (0 · ®; ¯ · 1). We set ®TL to be a low threshold for

length-L responses. Namely, responses of length L that exceed ®TL and do not exceed TL are

considered nearly significant, i.e., they are not significant enough to form an edge on their own,

but they can form sub-portions of longer edges. In addition, we set ¯L to be a threshold on the

total gap size for length-L edges, i.e., a length-L edge cannot be considered significant if it

contains sub-portions of total length > ¯L that do not exceed their respective low threshold. With

such a long gap the response cannot be marked as an edge even if it exceeds its corresponding

threshold TL. We implement these principles in a recursive procedure as follows. We set w and s

to constants and begin with the set of responses D(x; L;w; s; µ) obtained for filters of some

predetermined short length, e.g., L = 1. We classify each response to one of the following three

classes: (1) significant (D > TL) (2) nearly-significant (®TL < D · TL) and (3) non-significant (D

· ®TL). For the first two classes the total gap size is set to “0”, while for the latter the gap size is

set to “L”. We proceed by sequentially considering lengths of powers of 2. The classification of

every length-L response at location x, D(x; L;w; s; µ), is affected by the classification of its

associated length-L=2 responses, D(x ± (L=4)(cos µ; sin µ); L/2;w; s; µ) as described below. In

addition, the total gap size is set to be the sum of gap sizes associated with these responses.

• A length-L response D is classified significant if it exceeds the respective threshold, D > TL, and its total gap size is below ¯L. In this case the response is marked as a potential edge and its gap size is reset to zero.

• A length-L response D is classified nearly-significant if ®TL < D · TL and its total gap size is below ¯L. In this case, its gap size is not updated.

• A length-L response D is classified non-significant if D · ®TL or if its total gap size exceeds ¯L. In this case its total gap size is reset to L. Marked potential edges are further tested for statistical significance.

Page 67: Edge detection using wavelets

54

We consider the intensity profiles along the two sides of a potential edge and denote by σlocal the

maximum of the two empirical standard deviations on either side. We then remove edges for

which σlocal, typically c = 1. This condition generalizes by replacing the global

noise σ with a local estimate of the noise, σlocal, yielding a scale-dependent local threshold. This

test allows us to be less strict with the selection of ® and ¯. Finally, we apply a process of

angular non-maximal suppression followed by spatial non-maximal suppression at each length L.

The non-maximal suppression is a necessary step to ensure well-localized edges, expressed by a

single response. Moreover, we perform an inter-scale suppression, to ensure that each edge is

identified with its maximal perceptual length. This inter- and intra-scale decision process along

with the scale-adaptive threshold allow us to overcome noise without prior smoothing, and

therefore to reveal and accurately localize very noisy, low-contrast edges.

7.4 Hierarchical construction of oriented means

We construct our differences of oriented means by adding and subtracting width-1 oriented

means of the appropriate length. The family of width-1 oriented means, F(x; L;w; µ) is defined

over an infinite set of locations, lengths, and orientations, but under minimal smoothness

assumptions of I(x; y) it is possible to obtain any oriented mean in this family from only a finite

collection of oriented means. Oriented means at interim locations, lengths, and orientations can

then be computed by interpolation with an accuracy determined by the spatial and angular

resolutions. Following the minimal spatial and angular resolutions depend on the length L as

follows.

• The minimal spatial resolution in the direction of integration is inversely proportional to the integration length. In particular, when doubling the integration length, the number of evaluation points may be halved.

• The spatial resolution perpendicular to the direction of integration is independent of the integration length.

• The minimal angular resolution is proportional to the integration length. In particular, if the integration length is doubled, the number of angles computed per site must also be doubled.

Page 68: Edge detection using wavelets

55

A direct consequence of these observations is that the total number of integrals at any length L is

independent of L. Figure depicts the common direct approach to approximating discrete oriented

means of orientation θ≤EF. Using the trapezoid rule, the oriented mean for, e.g., the line

segment depicted in Figure, is given by the

Fig 7.3: Left panel: Direct calculation of oriented mean (w = 1;L = 4): an interpolation from the given data points to the red points is followed by

the trapezoid rule. Right panel: Base level initialization: stencil of four length-1 integrals for each pixel (left) cover the whole grid (right).

sum over the three interior points (obtained by interpolation from nearby data points) plus the

average of the endpoints, divided by four. Similar calculation applies for oriented means with EF≤θ≤GE

F . However, this direct approach is quite expensive to approximate many oriented means.

In the remainder of this section we follow and describe a fast, hierarchical recursive calculation

of “all significantly different” oriented means in a discrete image. In the context of a discrete

image, we define the length of an oriented mean on a uniform grid as the length of its maximal

projection onto the x- and y-axis, where the length units are pixels. The hierarchical construction

is as follows. At the base level, for each pixel four length-1 oriented means are calculated (see

Figure). The total number of oriented means at this level is therefore 4N. Recursively, given 4N

oriented means of length L we proceed to computing new 4N oriented means of length 2L.

Following the principles outlined above, the angular resolution should be doubled. Consequently,

the new oriented means can be divided into two equally sized sets. Half of the new oriented

means follow the same directions of those of the previous level, while the other half of the

oriented means follow intermediate directions. The first set of oriented means can be computed

simply by taking the average of two, length-L oriented means with one coinciding endpoint (see

Figure). The second set of oriented means can be obtained by interpolation of four length-L

oriented means of nearby directions. These four oriented means form a tight parallelogram

around the desired length-2L integral. This is illustrated in Figure, where the average of the four

Page 69: Edge detection using wavelets

56

length-1 oriented means is used to construct a length-2 oriented mean. This can be viewed as first

linearly interpolating the two nearest directions to approximate the new direction at length-1, then

creating a length-2 oriented mean by averaging two adjacent interpolated oriented means. It

should be emphasized that the numerical error introduced by this fast calculation, relative to the

slow, direct approach, is smaller than the error induced by discretizing I(x; y). The algorithm is

very efficient, it calculates “all significantly different” oriented means in O(N log ½), where N is

the number of pixels in the image and ½ is the length of the longest oriented mean, typically

ρ≤O(√N).

Fig 7.4: Left panel: Building integrals of length-2 from integrals of length-1, for existing directions (left), by taking the average of length-1

adjacent integrals (dashed lines) in that direction, and for a new direction (right), by averaging four nearest integrals (dashed lines). Right panel: The red lines denote length-4 vertically oriented means, which are calculated at each 2nd row (pink rows). The blue lines denote length-4

horizontally oriented means, which are calculated at each 2nd column (blueish columns). 7.5 Implementation

For our implementation we maintain a hierarchical data structure of the angular and spatial

resolutions as follows. At the base level, for each pixel length-1 oriented means at four directions

are calculated. The angular resolution of length-2L oriented means is twice the angular resolution

of length-L oriented means. The spatial resolution is halved as the length is doubled as follows.

Length-L vertically oriented means (EF≤θ≤GEF ) are calculated at every (L/2)th- row, at each pixel in

this row. Length-L horizontally oriented means (jµ · 4 j) are calculated at every (L/2)th- column,

at each pixel in this column. In this manner, each length-L oriented mean has an overlap of length

L/2 with another length-L oriented mean of the same orientation, in order to improve accuracy.

As a result, at each scale (length) the number of oriented means is 8N, except for the shortest

level (length-1) for which 4N oriented means are calculated. Note that at each length only 4N of

Page 70: Edge detection using wavelets

57

the 8N oriented means are used to construct the subsequent level. The grid setting for L /4 is

illustrated in Figure. Our recursive decision process is evoked during the construction of oriented

means after the construction of every Length, maintaining the low complexity of the algorithm.

For this decision process we associate with each length-L response the two (if the longer response

follows an orientation of the previous level) or four (if the longer response is of a “new”

orientation) length-L/2 responses from which it was generated. Finally, the local standard

deviation test can be applied by accessing the raw pixels, assuming only a sparse set of responses

are considered significant. Alternatively, σlocal can be recursively accumulated by computing in

addition oriented means for the squared intensities, I2(x; y), doubling the overall complexity.

Page 71: Edge detection using wavelets

58

CHAPTER 8

EDGES & THRESHOLDS

8.1 Introduction

Although the maxima of the modulus of the discrete wavelet transform are a good approximation

of the edges in an image, even in the absence of noise often there are many false edges as can be

seen in Figure 3. Therefore a criterion must be determined to separate the “real” edges from the

“false” edges. A threshold on the intensity of the modulus maxima is a good criterion. We shall

now discuss three different ways to threshold the maxima.

8.2 Constant Threshold

The constant thresholding is implemented such that for a modulus maximum point uj,p on the

image, it is an edge point if and only if Mjf[uj,p] ≥T for some a priori determined real value T (in

my implementation TL[0, 1] since all coefficients are normalized to the unit interval). Figure

shows the results from a constant threshold. Constant thresholding of the modulus of the M-Z

DWT is the most common technique for distinguishing false from true edges and works well in

practice.

Page 72: Edge detection using wavelets

59

Fig 8.1: Un-thresholded image (left) and thresholded image (right)

8.3 Hysteresis threshold

We can go a step further and implement a dual constant threshold, known as a hysteresis

threshold. In this case a modulus maximum point uj,p is an edge point if and only if

Tlow _ Mjf[uj,p]≤Thigh. However since we are looking for maxima points, precisely those large

moduli are the ones that would most likely be real edges, thus the hysteresis threshold might

eliminate some true edges. Figure shows the results from the hysteresis threshold, and if we

compare the latter to Figure we can see that some “noisy” (false) edges were removed and the

edges retained their characteristics. However, in an image like Figure we can see that the

hysteresis threshold causes Lena’s hat to “break” – one of the edges is threshold out at the top

right of the image.

8.4 Multiscale Correlation threshold

The previous two methods of thresholding both required an a priori decision to be made – picking

the values of the thresholds. In general, we would like to be able to pick the threshold based on

the image and edge information. Naturally, different resolution modulus maxima will have some

Page 73: Edge detection using wavelets

60

degree of correlation since they represent the same edge information. Hence, we shall propose an

algorithm for thresholding that takes advantage of the correlation. Let the threshold T be such

that T = T(m, j), i.e. a function of the coordinate mLZ2 and the resolution level j. We construct

T(m, j) as follows

1. T(m, j) = 1/θ(Uj , Uj+1) for j < J and T(m, j) = 1/θ(Uj , U1) for j = J

2. If θ(Uj , Uj+1) = 0 for some m, then T(m, j) = β.

3. When computing the edge points at resolution level 2j threshold each modulus maximum

point uj,p using the value T(uj,p, j).

Fig 8.2: Two different hysteresis thresholds

Fig 8.3: Edges of Lena using constant threshold (right) and hysteresis threshold (left)

Page 74: Edge detection using wavelets

61

Fig 8.4: Multiscale correlation threshold at resolutions 21 (left) and 22 (right)

where J is the maximum level of decomposition, Uj [m] is a two dimensional matrix with

elements equal to 1 at the edge points uj,p and 0 otherwise, and θ(·, ·) is a matrix of the two

dimensional correlation coefficients of the two arguments. The parameter β allows us to “tweak”

the multiscale correlation threshold. The simplest assumption would be that β = 1, then all point

which do not exhibit correlation cannot be edge points. But more realistically we do not want to

ignore all those maxima, so setting β to a value close to 1 would a better choice. In general, β

would have to be determined empirically and used the “tweak” the algorithm.

The results of using the multiscale correlation threshold can be seen in Figure 6. In the pictures

shown we used β= 1. Compared to the other thresholds – Figures 3 and 4 – the edge curves are

better defined, i.e. they are smoother and less noisy. However towards the edges of the image we

lost all edge information because of the assumption that β = 1.

Page 75: Edge detection using wavelets

62

CHAPTER 9

RESULTS

9.1 Results

Some of the few images are shown below which are added with gaussian noise & also edges are

taken from the images by adding noise & without noise to show the effect of noise on the images

respectively.

(a)Original image (b) Noisy image

(c)Edges from noisy images (d) Edges without noise

Fig 9.1: Image & its Edges

Page 76: Edge detection using wavelets

Here are the edges of the image at different scales & also this scaling helps in removing the effect

of noise.

Fig 9.3: COMPARISONS

Also the edges of the bottles placed on a conveyor belt can be seen which clearly point out the

bottle which is misplaced or fallen down.

Here are the edges of the image at different scales & also this scaling helps in removing the effect

Fig 9.2: Edges at different scales

COMPARISONS BETWEEN EDGES DUE TO CONVENTIONAL METHODS & WAVELETS

Also the edges of the bottles placed on a conveyor belt can be seen which clearly point out the

bottle which is misplaced or fallen down.

63

Here are the edges of the image at different scales & also this scaling helps in removing the effect

BETWEEN EDGES DUE TO CONVENTIONAL METHODS & WAVELETS

Also the edges of the bottles placed on a conveyor belt can be seen which clearly point out the

Page 77: Edge detection using wavelets

64

CHAPTER 10

CONCLUSION & FUTUREWORK

10.1 Conclusion

We have presented an algorithm for edge detection suitable for both natural as well as noisy

images. Our method utilizes efficient multiscale hierarchy of responses measuring the difference

of oriented means of various lengths and orientations. We use a scale-adaptive threshold along

with a recursive decision process to reveal the significant edges at all scales and orientations and

to localize them accurately.

Making the image periodic in order to convolve it for the wavelet transform results in distortions

at the lower frequency levels, because the convolutions begin to wrap around from one side of

the image to the other. At the lowest frequency scales, the wavelet maxima are unusable. It would

have been better to use a different method of extending the image, such as simply placing it in a

bed of zeros, and discounting the resulting edge from the results. As a method of multiscale edge

detection, wavelet analysis works on some levels but falls short on others. It works because it

finds the edges and their angles, but in this regard it is very similar to doing Canny edge detection

on multiple levels of scale. As shown in the 1-D case, it is possible to glean more information

about the type of edge from the evolution across scales, but difficult to accomplish in the 2-D

case.

At the application a video of bottles on the conveyor belt is moving whose edge is detected with

the help of SIMULINK using the multiscale algorithm with the help of wavelets.

Page 78: Edge detection using wavelets

65

APPENDIX

SIMULINK

Simulink, developed by The MathWorks, is a commercial tool for modeling, simulating and

analyzing multidomain dynamic systems. Its primary interface is a graphical block diagramming

tool and a customizable set of block libraries. It offers tight integration with the rest of the

MATLAB environment and can either drive MATLAB or be scripted from it. Simulink is widely

used in control theory and digital signal processing for multidomain simulation and design.

Page 79: Edge detection using wavelets

66

Add-on products

A number of MathWorks and third-party hardware and software products are available for use

with Simulink. For example, Stateflow extends Simulink with a design environment for

developing state machines and flow charts.

Coupled with Real-Time Workshop, another product from The MathWorks, Simulink can

automatically generate C source code for real-time implementation of systems. As the efficiency

and flexibility of the code improves, this is becoming more widely adopted for production

systems, in addition to being a popular tool for embedded system design work because of its

flexibility and capacity for quick iteration. Real-Time Workshop Embedded Coder creates code

efficient enough for use in embedded systems.

xPC Target together with x86-based real-time systems provides an environment to simulate and

test Simulink and Stateflow models in real-time on the physical system. Other add-ons support

specific embedded targets, including Infineon C166, Motorola 68HC12, Motorola MPC 555, TI

C2000, and TI C6000.

With Simulink HDL Coder, also from The MathWorks, Simulink and Stateflow can

automatically generate synthesizable VHDL and Verilog. The systematic test tool TPT cannot

only be used for the formal test process to stimulate Simulink models but also during the

development phase where the developer generates inputs to test the system. By the substitution of

the Constant and Signal generator blocks of Simulink the stimulation becomes reproducible.

SimEvents adds a library of graphical building blocks for modeling queuing systems to the

Simulink environment. It also adds an event-based simulation engine to the time-based

simulation engine in Simulink.

Page 80: Edge detection using wavelets

67

REFERENCES

1. J. C. Goswami, A. K. Chan, 1999, “Fundamentals of wavelets: theory, algorithms, and

applications,” John Wiley & Sons, Inc.

2. Rafael C. Gonzalez, Richard E. Woods, 2002, “Digital Image Processing,” Prentice Hall.

3. M. Ruskai, G. Beylkin, R. Coifman, I. Daubechies, S. Mallat, Y. Meyer, L. Raphael,

1992, “Wavelets and Their Applications,” Boston, MA: Jones and Bartlett.

4. C. K. Chui, 1992, “Wavelets: A tutorial in Theory and Applications,” Academic Press.

5. Wikipedia.“LipschitzContinuity,” http://en.wikipedia.org/wiki/Lipschitz_continuity

6. R.Polikar–TheWaveletTutorial.

http://users.rowan.edu/~polikar/WAVELETS/WTtutorial.html

7. P.M. de Zeeuw: Wavelet and image fusion, CWI, Amsterdam, http:/www.cwi.nl/~pauldz/

(1998)

8. T. J. Ali, P. Akhtar, and M. I. Bhatti: Modeling of spherical image objects using wavelets

and strings, First International Conference on Computer, Control & Communication, pp.

77-85, (November 2007)

9. Li, Jun, "A Wavelet Approach to Edge detection" M.S. Dissertation, Sam Houston State

University, 2003.