wavelet applications in image denoising using matlab

Post on 22-Mar-2017

33 Views

Category:

Engineering

6 Downloads

Preview:

Click to see full reader

TRANSCRIPT

P. Nirmala devi AP(SLG)/ECE

KEC

Digital Image Processing is the use of computer algorithms to perform image processing on digital images.

Advantages over analog image processing: - Allows a much wider range of algorithms to be applied to the input data - Avoid problems such as the build-up of noise and signal distortion during processing.

05/02/23KEC/EIE/DIP

Two principal application areas:

◦ Improvement of pictorial information for human

interpretation

◦ Processing of image data for storage, transmission and representation for autonomous machine perception

05/02/23KEC/EIE/DIP

◦An digital image may be defined as a

two-dimensional quantity f(x,y) x and y are spatial coordinates and f is intensity or gray level at that

point

05/02/23KEC/EIE/DIP

Low-level IP Image preprocessing to reduce noise, contrast

enhancement, image sharpening Both inputs and outputs are images

Mid-level IP Segmentation and description The inputs are generally images, but outputs are attributes extracted from those images

(e.g., edges,contours… )High-level IP

Making sense of an ensemble of recognized objects

05/02/23KEC/EIE/DIP

Goal:◦ To Remove noise◦ To Preserve useful information

Applications:◦ Medical signal/image analysis (ECG, CT, MRI etc.)◦ Data mining ◦ Radio astronomy image analysis

05/02/23KEC/EIE/DIP

Visually unpleasantBad for compressionBad for analysis

05/02/23KEC/EIE/DIP

05/02/23KEC/EIE/DIP

Images are often contaminated by noise during

i) acquisition ii) storage iii)transmission

Effect: Degradation at the quality of the images

05/02/23KEC/EIE/DIP

The sources of noise in digital images arise during image acquisition (digitization) and transmission

◦ Imaging sensors can be affected by ambient conditions

◦ Interference can be added to an image during transmission

05/02/23KEC/EIE/DIP

05/02/23KEC/EIE/DIP

thermal imaging electrical interference

ultrasound imagingphysical interference

05/02/23KEC/EIE/DIP

Simplified assumptions Noise is independent of signal

Noise types Independent of spatial location

Impulse noise Additive white Gaussian noise

Spatially dependent Periodic noise

Definition: is considered to be any measurement that is not part of the phenomena of interest.

Images are affected by different types of noise:

Gaussian noise

Salt and Pepper noise

Poisson Noise

Speckle Noise

05/02/23KEC/EIE/DIP

Impulse noise Characterized by some portion of image pixels that are corrupted, leaving the remaining pixels unchanged. (Salt & Pepper Noise) Additive noise A value from a certain distribution is added to each image pixel, for example, a Gaussian distribution. Multiplicative noise The intensity of the noise varies with the signal intensity (e.g., speckle noise).

05/02/23KEC/EIE/DIP

WjHi

jiXjiY

1,1

),(0

255),(

Definition

Each pixel in an image has the probability of p/2 (0<p<1) being contaminated by either a white dot (salt) or a black dot (pepper)

with probability of p/2

with probability of p/2

with probability of 1-p

noisy pixels

clean pixels

X: noise-free image, Y: noisy image

05/02/23KEC/EIE/DIP

05/02/23KEC/EIE/DIP

128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128

128 128 255 0 128 128 128 128 128 128 128 128 128 128 0 128 128 128 128 0 128 128 128 128 128 128 128 128 128 128 128 128 0 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 0 128 128 128 128 255 128 128 128 128 128 128 128 128 128 128 128 128 128 255 128 128 128 128 128 128 128 255 128 128

05/02/23KEC/EIE/DIP

Noisy image Y

filteringalgorithm

Can we make the denoised image X as closeto the noise-free image X as possible?

^denoisedimage

05/02/23KEC/EIE/DIP

225 225 225 226 226 226 226 226 225 225 255 226 226 226 225 226 226 226 225 226 0 226 226 255 255 226 225 0 226 226 226 226 225 255 0 225 226 226 226 255 255 225 224 226 226 0 225 226 226 225 225 226 255 226 226 228 226 226 225 226 226 226 226 226

0 225 225 226 226 226 226 226 225 225 226 226 226 226 226 226 225 226 226 226 226 226 226 226 226 226 225 225 226 226 226 226 225 225 225 225 226 226 226 226 225 225 225 226 226 226 226 226 225 225 225 226 226 226 226 226 226 226 226 226 226 226 226 226

Sorted: [0, 0, 0, 225, 225, 225, 226, 226, 226]

05/02/23KEC/EIE/DIP

Noisy image Y denoisedimage

3-by-3 window

WjHiNjiN

jiNjiXjiY

1,1),,0(~),(

),,(),(),(2

DefinitionEach pixel in an image is disturbed by a Gaussian random variableWith zero mean and variance 2

X: noise-free image, Y: noisy image

05/02/23KEC/EIE/DIP

05/02/23KEC/EIE/DIP

Numerical Example 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128

128 128 129 127 129 126 126 128 126 128 128 129 129 128 128 127 128 128 128 129 129 127 127 128 128 129 127 126 129 129 129 128 127 127 128 127 129 127 129 128 129 130 127 129 127 129 130 128 129 128 129 128 128 128 129 129 128 128 130 129 128 127 127 126

05/02/23KEC/EIE/DIP

A different type of noise in the coherent imaging of objects caused by errors in data transmission

Speckle noise follows a gamma distribution

Presence of speckle is undesirable damages radiometric resolution affects the tasks of human interpretation and scene

analysis.

KEC/EIE/DIP

Image Denoising Techniques

Spatial Domain Denoising• Conventional AND Adaptive filtering

•Frequency Domain Denoising• Wiener Filtering

•Wavelet Domain Denoising • Wavelet thresholding: Hard vs. Soft • Wavelet-domain shrinking

05/02/23

Spatial filters are designed to highlight or suppress specific features in an image, based on their spatial frequency.

Linear Filters - Mean Filters

Non Linear Filters - Median Filters

05/02/23KEC/EIE/DIP

A common filtering involves moving a 'window' of a few pixels in dimension (e.g. 3x3, 5x5, etc.) over each pixel in the image, applying a mathematical calculation using the pixel values under that window, and replacing the central pixel with the new value.

05/02/23KEC/EIE/DIP

Image of CHURN FarmDaedalus 1268 ATM

05/02/23KEC/EIE/DIP

A low-pass filter is designed to emphasise larger, homogeneous areas of similar tone and reduce the smaller detail in an image. Thus, low-pass filters generally serve to smooth the appearance of an image.

05/02/23KEC/EIE/DIP

A high-pass filter does the opposite, and serves to sharpen the appearance of fine detail in an image.

05/02/23KEC/EIE/DIP

05/02/23KEC/EIE/DIP

05/02/23KEC/EIE/DIP

05/02/23KEC/EIE/DIP

Wide windows do not provide good localization at high frequencies.

05/02/23KEC/EIE/DIP

Use narrower windows at high frequencies.

05/02/23KEC/EIE/DIP

Narrow windows do not provide good localization at low frequencies.

05/02/23KEC/EIE/DIP

Use wider windows at low frequencies.

05/02/23KEC/EIE/DIP

05/02/23KEC/EIE/DIP

05/02/23KEC/EIE/DIP

Overcomes the preset resolution problem of the STFT by using a variable length window:

◦ Use narrower windows at high frequencies for better time resolution.

◦ Use wider windows at low frequencies for better frequency resolution.

05/02/23KEC/EIE/DIP

05/02/23KEC/EIE/DIP

05/02/23KEC/EIE/DIP

05/02/23KEC/EIE/DIP

05/02/23KEC/EIE/DIP

05/02/23KEC/EIE/DIP

There are many different wavelets:

MorletHaar Daubechies

05/02/23KEC/EIE/DIP

Sparsity: for functions typically found in practice, many of the coefficients in a wavelet representation are either zero or very small.

Linear-time complexity: many wavelet transformations can be accomplished in O(N) time.

05/02/23KEC/EIE/DIP

• Adaptability: wavelets can be adapted to represent a wide variety of functions (e.g., functions with discontinuities, functions defined on bounded domains etc.).– Well suited to problems involving images, open

or closed curves, and surfaces of just about any variety.

– Can represent functions with discontinuities or corners more efficiently (i.e., some have sharp corners themselves).

05/02/23KEC/EIE/DIP

05/02/23KEC/EIE/DIP

Properties of Wavelets (cont’d)

•Multiresolution analysis :

•Multiresolution analysis: representation of a signal (e.g., an images) in more than one resolution/scale.

•Features that might go undetected at one resolution may be easy to spot in another.

• Noise filtering

• Image compression– Fingerprint compression

• Image fusion

• Recognition

• Image Matching and Retrieval

05/02/23KEC/EIE/DIP

One Stage Filtering gives Approximations and details:

• The low-frequency content is the mostimportant part in many applications, andgives the signal its identity.This part is called “Approximations”

• The high-frequency gives the ‘flavor’, andis called “Details”

05/02/23KEC/EIE/DIP

Perceptually flat regions should be flat

Image boundaries should be preserved (neither blurred or sharpened)

Texture details should not be lost

Global contrast should be preserved

No artifacts should be generated

05/02/23KEC/EIE/DIP

Different sources and type of noises

How strong is the noise?

Locally, it is hard to distinguish◦ Texture vs. noise◦ Object boundary vs. structural noise

05/02/23KEC/EIE/DIP

We need to distinguish spatially-localized events (edges) from noise components

Wavelet denoising attempts to remove the noise present in the signal while preserving the signal characteristics, regardless of its frequency content.

What are essential features of the data, and what features are “noise”?

To know more about noise components

05/02/23KEC/EIE/DIP

05/02/23KEC/EIE/DIP

ForwardTransform

InverseTransform

Denoisingoperation

e.g.,KLTDCTWT

e.g.,Linear Wiener filteringNonlinear Thresholding

Noisysignal

denoisedsignal

05/02/23KEC/EIE/DIP

DWT of the image is calculated

Resultant coefficients are passed through threshold testing

The coefficients < threshold are removed, others shrinked

Resultant coefficients are used for image reconstruction with IWT.

05/02/23KEC/EIE/DIP

Methods Used

◦Universal Thresholding◦Visu Shrink◦Sure Shrink◦Bayes Shrink

05/02/23KEC/EIE/DIP

Wavelet thresholding (first proposed by Donoho) is a signal estimation technique that exploits the capabilities of wavelet transform for signal denoising.

It removes noise by killing coefficients that are insignificant relative to some threshold.

Types◦ Universal or Global Thresholding

Hard Soft

◦ SubBand Adaptive Thresholding

05/02/23KEC/EIE/DIP

TnYTnYTnYTnYTnY

nX|][|0

][][][][

][~

KEC/EIE/DIP

otherwise

TnYifnYnX

0|][|][

][~

DWT IWTThresholdingY X~

Soft thresholding

Hard thresholding

Noisysignal

denoisedsignal

05/02/23

05/02/23KEC/EIE/DIP

The hard thresholding operator is defined as

D(U, λ) = U for all |U|> λ

Hard threshold is a “keep or kill” procedure and is more intuitively appealing.

The transfer function of the same is shown here.

The soft thresholding operator is defined as

D(U, λ) = sgn(U)max(0, |U| - λ)

Soft thresholding shrinks coefficients above the threshold in absolute value.

The transfer function of the same is shown here.

The threshold

(N being the signal length, σ being the noise variance) is well known in wavelet literature as the Universal threshold.

NUNIV ln2

05/02/23KEC/EIE/DIP

Apply Donoho’s universal threshold,

M is the number of pixels. The threshold is usually high, overly

smoothing.

Mlog2

05/02/23KEC/EIE/DIP

Subband adaptive, a different threshold is calculated for each detail subband.

Choose the threshold that will minimize the unbiased estimate of the risk:

This optimization is straightforward, order the wavelet coefficients in terms of magnitude and choose the threshold as the wavelet coefficient that minimizes the risk.

05/02/23KEC/EIE/DIP

Adaptive data-driven thresholding method

Assume that the wavelet coefficients in each subband is distributed as a Generalized Gaussian Distribution (GGD)

Find the threshold that minimized the Bayesian risk.

05/02/23KEC/EIE/DIP

WAVELET TOOLBOX

05/02/23KEC/EIE/DIP

Function Name Purpose

dwt2 - Single-level decomposition

[cA, cH,cV,cD] = dwt2(X, 'wname')

Wavedec2 - Multilevel 2-D wavelet decomposition

[C,S] = wavedec2(X, N, 'wname')

05/02/23KEC/EIE/DIP

[cA1,cH1,cV1,cD1] = dwt2(X,'bior3.7');

This generates the coefficient matrices of the level-one approximation (cA1)

and horizontal, vertical and diagonal details (cH1,cV1,cD1, respectively).

05/02/23KEC/EIE/DIP

Type: [C,S] = wavedec2(X,2,'bior3.7'); where X is the original image matrix, and 2 is the

level of decomposition. The coefficients of all the components of a

second-level decomposition (that is, the second-level approximation and the first two levels of detail) are returned concatenated into one vector, C. Argument S is a bookkeeping matrix that keeps track of the sizes of each component.

05/02/23KEC/EIE/DIP

Function Name Purpose

detcoef2 - Extraction of detail coefficients

D = detcoef2(C, S, 'wname', N)[H,V,D] = detcoef2('all', C,S,N)

appcoef2 - Extraction of approximation coefficients

A = appcoef2(C,S,’wname’,N)

05/02/23KEC/EIE/DIP

To extract the level 2 approximation coefficients from C:

cA2 = appcoef2(C,S,'bior3.7',2);

05/02/23KEC/EIE/DIP

cH2 = detcoef2('h',C,S,2); cV2 = detcoef2('v',C,S,2); cD2 = detcoef2('d',C,S,2); cH1 = detcoef2('h',C,S,1); cV1 = detcoef2('v',C,S,1); cD1 = detcoef2('d',C,S,1);

[or]

05/02/23KEC/EIE/DIP

[cH2,cV2,cD2] = detcoef2('all',C,S,2); [cH1,cV1,cD1] = detcoef2('all',C,S,1); where the first argument ('h', 'v', or 'd')

determines the type of detail (horizontal, vertical, diagonal) extracted,

and the last argument determines the level.

05/02/23KEC/EIE/DIP

Function Name Purpose

ddencmp - Provide default values for denoising and compression[THR,SORH,KEEPAPP,CRIT] = ddencmp(IN1,IN2,X)

wdencmp - Wavelet de-noising and compression

[XC,CXC,LXC,PERF0,PERFL2] = wdencmp('gbl',X,'wname',N,THR,SORH,KEEPAPP)

05/02/23KEC/EIE/DIP

Function Name Purpose wthcoef2 Wavelet

coefficient thresholding 2-D

NC = wthcoef2('type',C, S, N, T, SORH)

05/02/23KEC/EIE/DIP

Function Name Purpose

idwt2 - Single-level reconstruction

X = idwt2(cA, cH, cV,cD, 'wname') waverec2 - Full reconstruction

X = waverec2(C,S, 'wname') wrcoef2 - Selective reconstruction

X = wrcoef2('type',C,S,'wname',N)

05/02/23KEC/EIE/DIP

To find the inverse transform: Xsyn = idwt2(cA1,cH1,cV1,cD1,'bior3.7');

This reconstructs or synthesizes the original image from the coefficients of the level 1 approximation and details.

05/02/23KEC/EIE/DIP

To reconstruct the level 2 approximation from C:

A2 = wrcoef2('a',C,S,'bior3.7',2);

05/02/23KEC/EIE/DIP

To reconstruct the level 1 and 2 details from C, type:

H1 = wrcoef2('h',C,S,'bior3.7',1); V1 = wrcoef2('v',C,S,'bior3.7',1); D1 = wrcoef2('d',C,S,'bior3.7',1); H2 = wrcoef2('h',C,S,'bior3.7',2); V2 = wrcoef2('v',C,S,'bior3.7',2); D2 = wrcoef2('d',C,S,'bior3.7',2);

05/02/23KEC/EIE/DIP

To reconstruct the original image from the wavelet decomposition structure:

X0 = waverec2(C,S,'bior3.7');

This reconstructs or synthesizes the original image from the coefficients C of the multilevel decomposition.

05/02/23KEC/EIE/DIP

GUI FOR WAVELET ANALYSIS

05/02/23KEC/EIE/DIP

Starting the 2-D Wavelet Analysis Tool.

From the MATLAB prompt, type: wavemenu

The Wavelet Tool Main Menu appears

05/02/23KEC/EIE/DIP

05/02/23KEC/EIE/DIP

Click the Wavelet 2-D menu item. From the File menu, choose the Load Image option. Load the required Image ANALYZING AN IMAGE Using the Wavelet and Level menus located to

the upper right, determine the wavelet family, the wavelet type, and the number of levels to be used for the analysis.

Click the Analyze button. Click on any decomposition component in the lower

right window.

05/02/23KEC/EIE/DIP

Click the Visualize button.

Using Tree Mode Features.

Choose Tree from the View Mode menu.

05/02/23KEC/EIE/DIP

Saving Information to Disk

05/02/23KEC/EIE/DIP

05/02/23KEC/EIE/DIP

From the Select thresholding method menu, choose any item.

Set the thresholding mode.

Use the Sparsity slider to adjust the threshold value

Click the De-noise button.

05/02/23KEC/EIE/DIP

◦Determination of a global optimal threshold

◦Spatially adjusting threshold based on local statistics

Challenges with wavelet thresholding

05/02/23KEC/EIE/DIP

It’s possible to remove the noise with little loss of details.

The idea of wavelet denoising based on the assumption that the amplitude, rather than the location, of the spectra of the signal to be as different as possible for that of noise.

05/02/23KEC/EIE/DIP

THANK YOU

05/02/23KEC/EIE/DIP

top related