image enhancement

19
&<+,PDJH(QKDQFHPHQWS Image Enhancement Introduction Enhancement by point processing Simple intensity transformation Histogram processing Spatial filtering Smoothing filters Sharpening filters Enhancement in the frequency domain Pseudo-color image processing &<+,PDJH(QKDQFHPHQWS 1. Introduction The principal objective of image enhancement is to process a given image so that the result is more suitable than the original image for a specific application. It accentuates or sharpens image features such as edges, boundaries, or contrast to make a graphic display more helpful for display and analysis. The enhancement doesn't increase the inherent information content of the data, but it increases the dynamic range of the chosen features so that they can be detected easily. Image Enhancement Point operation Spatial operation Transform operation Pseudocoloring y contrast stretchin g y Noise clippin g y Window slicin g y Histo g ram modelin g y Noise smoothin g y Median filterin g y LP, HP & BP filterin g y Zoomin g y Linear filterin g y Root filterin g y Homomorphic filterin g y False colorin g y Pseudocolorin g

Upload: deven-sahu

Post on 07-Aug-2015

311 views

Category:

Art & Photos


3 download

TRANSCRIPT

Page 1: Image Enhancement

&<+�,PDJH(QKDQFHPHQW�S��

Image Enhancement

• Introduction

• Enhancement by point processing• Simple intensity transformation• Histogram processing

• Spatial filtering• Smoothing filters• Sharpening filters

• Enhancement in the frequency domain

• Pseudo-color image processing

&<+�,PDJH(QKDQFHPHQW�S��

1. Introduction

• The principal objective of image enhancement is toprocess a given image so that the result is moresuitable than the original image for a specificapplication.

• It accentuates or sharpens image features such asedges, boundaries, or contrast to make a graphicdisplay more helpful for display and analysis.

• The enhancement doesn't increase the inherentinformation content of the data, but it increases thedynamic range of the chosen features so that theycan be detected easily.

Image Enhancement

Point operation Spatial operation Transform operation Pseudocoloring

y contrast stretchingy Noise cl ippingy Window s l ic ingy Histogram model ing

y Noise smooth ingy Median f i l ter ingy LP, HP & BP f i l ter ingy Zooming

y Linear f i l teringy Root f i l teringy Homomorphic f i l ter ing

y False color ingy Pseudocolor ing

Page 2: Image Enhancement

&<+�,PDJH(QKDQFHPHQW�S��

• The greatest difficulty in image enhancement isquantifying the criterion for enhancement and,therefore, a large number of image enhancementtechniques are empirical and require interactiveprocedures to obtain satisfactory results.

• Image enhancement methods can be based on eitherspatial or frequency domain techniques.

Spatial domain enhancement methods:

• Spatial domain techniques are performed to theimage plane itself and they are based on directmanipulation of pixels in an image.

• The operation can be formulated as g(x,y) =T[f(x,y)], where g is the output, f is the input imageand T is an operation on f defined over someneighborhood of (x,y).

• According to the operations on the image pixels, itcan be further divided into 2 categories: Pointoperations and spatial operations (including linearand non-linear operations).

&<+�,PDJH(QKDQFHPHQW�S��

Frequency domain enhancement methods:

• These methods enhance an image f(x,y) byconvoluting the image with a linear, positioninvariant operator.

• The 2D convolution is performed in frequencydomain with DFT.

Spatial domain: g(x,y)=f(x,y)*h(x,y)Frequency domain:G(w1,w2)=F(w1,w2)H(w1,w2)

Page 3: Image Enhancement

&<+�,PDJH(QKDQFHPHQW�S��

2. Enhancement by point processing

• These processing methods are based only on theintensity of single pixels.

2.1 Simple intensity transformation:

(a). Image negatives:

• Negatives of digital images are useful in numerousapplications, such as displaying medical images andphotographing a screen with monochrome positivefilm with the idea of using the resulting negatives asnormal slides.

• Transform function T : g(x,y)=L-f(x,y), where L isthe max. intensity.

&<+�,PDJH(QKDQFHPHQW�S��

Original

Negative

Page 4: Image Enhancement

&<+�,PDJH(QKDQFHPHQW�S��

(b). Contrast stretching

• Low-contrast images can result from poorillumination, lack of dynamic range in the imagesensor, or even wrong setting of a lens apertureduring image acquisition.

• The idea behind contrast stretching is to increase thedynamic range of the gray levels in the image beingprocessed.

&<+�,PDJH(QKDQFHPHQW�S��

Original

Processed image

• Special case: If r1=r2=0, s1=0 and s2=L-1, then it isactually a thresholding that creates a binary images.

Page 5: Image Enhancement

&<+�,PDJH(QKDQFHPHQW�S��

(c). Compression of dynamic range

• Sometimes the dynamic range of a processed imagefar exceeds the capability of the display device, inwhich case only the brightest parts of the images arevisible on the display screen.

• An effective way to compress the dynamic range ofpixel values is to perform the following intensitytransformation function:

s = c log(1+|r|)

where c is a scaling constant, and the logarithmfunction performs the desired compression.

Transform function

&<+�,PDJH(QKDQFHPHQW�S���

Original Processed output

(d) Gray-level slicing

• Highlighting a specific range of gray levels in animage often is desired. Applications includeenhancing features such as masses of water insatellite imagery and enhancing flaws in x-rayimages.

Page 6: Image Enhancement

&<+�,PDJH(QKDQFHPHQW�S���

• Example 1:

A transformation function that highlights a range[A,B] of intensities while diminishing all othersto a constant.

�D�

�E� �F�

)LJ���� �D��7UDQVIHU�IXQFWLRQ���E��2ULJLQDO�LPDJH���F�

3URFHVVLQJ�RXWSXW�

&<+�,PDJH(QKDQFHPHQW�S���

• Example 2:

A transformation function that highlights a range[A,B] of intensities but preserves all others.

Page 7: Image Enhancement

&<+�,PDJH(QKDQFHPHQW�S���

2.2 Histogram processing:

• The histogram of a digital image with gray levels inthe range [0,L-1] is a discrete function p(rk)=nk/n,where rk is the kth gray level, nk is the number ofpixels in the image with that gray level, n is the totalnumber of pixels in the image, and k=0,1..L-1.

• P(rk) gives an estimate of the probability ofoccurrence of gray level rk.

• The shape of the histogram of an image gives ususeful information about the possibility for contrastenhancement.

• A histogram of a narrow shape indicates littledynamic range and thus corresponds to an imagehaving low contrast.

&<+�,PDJH(QKDQFHPHQW�S���

Page 8: Image Enhancement

&<+�,PDJH(QKDQFHPHQW�S���

(a) Histogram equalization

• The objective is to map an input image to an outputimage such that its histogram. is uniform after themapping.

• Let r represent the gray levels in the image to beenhanced and s is the enhanced output with atransformation of the form s=T(r).

• Assumption:1. T(r) is single-valued and monotonically

increasing in the interval [0,1], which preservesthe order from black to white in the gray scale.

2. 1)(0 ≤≤ rT for 10 ≤≤ r , which guarantees themapping is consistent with the allowed range ofpixel values.

• If Pr(r) and T(r) are known and T-1(s) satisfiescondition (a), the pdf of the transformed gray levels

is )(1

)(P)(PsTr

rs ds

drrs

−=

=

• If ∫==r

r dwwrTs0

)(P)( for 10 ≤≤ r , then we have

)(P rdr

dsr= and hence 1)(P =ss for 10 ≤≤ s .

&<+�,PDJH(QKDQFHPHQW�S���

• Using a transformation function equal to thecumulative distribution of r produces an imagewhose gray levels have a uniform density, whichimplies an increase in the dynamic range of thepixels.

• In order to be useful for digital image processing,eqns. should be formulated in discrete form:

n

nr kkr =)(P and ∑==

=

k

j

j

kkn

nrTs

0)( , where k=0,1...L-1

• A plot of )(P kr r versus rk is actually a histogram,and the technique used for obtaining a uniformhistogram is known as histogram equalization orhistogram linearization.

Page 9: Image Enhancement

&<+�,PDJH(QKDQFHPHQW�S���

• Example: Equalizing an image of 6 gray levels.

Index k 0 1 2 3 4 5

Normalized Inputlevel, rk/5

0.0 0.2 0.4 0.6 0.8 1.0

Freq. Count of rk, nk 4 7 2 1 0 1

Probability P(rk) =nk/n

4/15 7/15 2/15 1/15 0/15 1/15

∑===

k

j

jkk n

nrTs

0)(

4/15= 0.27

11/15= 0.73

13/15= 0.87

14/15= 0.93

14/15= 0.93

15/15= 1.00

Quantized sk 0.2 0.8 0.8 1.0 1.0 1.0

0.00.20.40.60.81.0

0.20.80.81.01.01.0

Tr k s k

472101

472101

freq0.0:0.2:0.4:0.6:0.8:1.0:

040092

freq0.0:0.2:0.4:0.6:0.8:1.0:

)LJ����([DPSOH�RI�KLVWRJUDP�HTXDOL]DWLRQ

&<+�,PDJH(QKDQFHPHQW�S���

Original image

Histogram

Page 10: Image Enhancement

&<+�,PDJH(QKDQFHPHQW�S���

Equalized image

Histogram

&<+�,PDJH(QKDQFHPHQW�S���

(b) Histogram specification

• Histogram equalization only generates anapproximation to a uniform histogram.

• Sometimes the ability to specify particularhistogram shapes capable of highlighting certaingray-level ranges in an image is desirable.

• Procedures:

1. Determine the transformation )( kk rTs = that canequalize the original image's histogram pr(r).

2. Determine the transformation )( kk bGs = that canequalize the desired image's histogram pb(b).

3. Perform transformation ))((1krTG− .

• The principal difficulty in applying the histogramspecification method to image enhancement lies inbeing able to construct a meaningful histogram.

Page 11: Image Enhancement

&<+�,PDJH(QKDQFHPHQW�S���

(c) Local enhancement

• It is often necessary to enhance details over smallareas.

• The number of pixels in these areas may havenegligible influence on the computation of a globaltransformation, so the use of global histogramspecification does not necessarily guarantee thedesired local enhancement.

• Procedures:1. Define a square or rectangular neighborhood

and move the center of this window from pixelto pixel.

2. Determine the histogram equalization orhistogram specification transformation functionwith the histogram of the windowed image ateach location.

3. Map the gray level centers in the window withthe transformation function.

4. Move to an adjacent pixel location and theprocedure is repeated.

&<+�,PDJH(QKDQFHPHQW�S���

�D� �E�

)LJ����,PDJH�EHIRUH�DQG�DIWHU�ORFDO�HQKDQFHPHQW�

Page 12: Image Enhancement

&<+�,PDJH(QKDQFHPHQW�S���

3. Spatial Filtering:

• The use of spatial masks for image processing iscalled spatial filtering.

• The masks used are called spatial filters.

)LJ���� 7RS�� FURVV� VHFWLRQV� RI� EDVLF� VKDSHV� IRU� FLUFXODUO\

V\PPHWULF� IUHTXHQF\� GRPDLQ� ILOWHU�� %RWWRP�� FURVV

VHFWLRQV� RI� FRUUHVSRQGLQJ� VSDWLDO� GRPDLQ� ILOWHUV�� �D�

ORZSDVV���E��EDQGSDVV�DQG��F��KLJKSDVV�ILOWHUV�

&<+�,PDJH(QKDQFHPHQW�S���

• The basic approach is to sum products between themask coefficients and the intensities of the pixelsunder the mask at a specific location in the image.(2D convolution)

∑ ∑ −−=−= −

d

di

d

djyixfjiwyxR ),(),(),(

where (2d+1)X(2d+1) is the mask size, w(i,j)'s areweights of the mask, f(x,y) is input pixel atcoordinates (x,y), R(x,y) is the output value at (x,y).

*

• If the center of the mask is at location (x,y) in theimage, the gray level of the pixel located at (x,y) isreplaced by R, the mask is then moved to the nextlocation in the image and the process is repeated.This continues until all pixel locations have beencovered.

Page 13: Image Enhancement

&<+�,PDJH(QKDQFHPHQW�S���

3.1. Smoothing filter:

• Smoothing filters are used for blurring and for noisereduction.

• Blurring is used in preprocessing steps, such asremoval of small details from an image prior toobject extraction, and bridging of small gaps in linesor curves.

• Noise reduction can be accomplishing by blurringwith a linear filter and also by nonlinear filtering.

(a). Low pass filtering

• The key requirement is that all coefficients arepositive.

• Neighborhood averaging is a special case of LPFwhere all coefficients are equal.

• It blurs edges and other sharp details in the image.

• Example:

111

111

111

9

1

&<+�,PDJH(QKDQFHPHQW�S���

(b). Median filtering

• If the objective is to achieve noise reduction insteadof blurring, this method should be used.

• This method is particularly effective when the noisepattern consists of strong, spike-like componentsand the characteristic to be preserved is edgesharpness.

• It is a nonlinear operation.

• For each input pixel f(x,y), we sort the values of thepixel and its neighbors to determine their medianand assign its value to output pixel g(x,y).

Page 14: Image Enhancement

&<+�,PDJH(QKDQFHPHQW�S���

2ULJLQDO�ZLWK��D��VSLNH�QRLVH��E��ZKLWH�QRLVH

0HGLDQ�ILOWHULQJ�RXWSXW

/RZ�SDVV�ILOWHULQJ�RXWSXW

&<+�,PDJH(QKDQFHPHQW�S���

3.2. Sharpening Filters

• To highlight fine detail in an image or to enhancedetail that has been blurred, either in error or as anatural effect of a particular method of imageacquisition.

• Uses of image sharpening vary and includeapplications ranging from electronic printing andmedical imaging to industrial inspection andautonomous target detection in smart weapons.

(a). Basic highpass spatial filter

• The shape of the impulse response needed toimplement a highpass spatial filter indicates that thefilter should have positive coefficients near itscenter, and negative coefficients in the outerperiphery.

• Example : filter mask of a 3x3 sharpening filter

−−−−−−−−

111

181

111

9

1

• The filtering output pixels might be of a gray levelexceeding [0,L-1].

Page 15: Image Enhancement

&<+�,PDJH(QKDQFHPHQW�S���

• The results of highpass filtering involve some formof scaling and/or clipping to make sure that the graylevels of the final results are within [0,L-1].

(b). Derivative filters.

• Differentiation can be expected to have the oppositeeffect of averaging, which tends to blur detail in animage, and thus sharpen an image and be able todetect edges.

• The most common method of differentiation inimage processing applications is the gradient.

• For a function f(x,y), the gradient of f at coordinates(x',y') is defined as the vector

)','(

)','(

yxy

fx

f

yxf

∂∂∂∂

=∇

• Its magnitude can be approximated in a number ofways, which result in a number of operators such asRoberts, Prewitt and Sobel operators for computingits value.

&<+�,PDJH(QKDQFHPHQW�S���

Example: masks of various operators

0

0

0

0

0 0 0

0

0

0

0 0 0

0

0

0

1

1

11 1 1

1 1

1

1

2

2

-1

-2

-1

-1

-1

-1

-1 -1 -1

-1 -2 -1

Prewitt

Roberts

Sobel

11

-1 -1

Page 16: Image Enhancement

&<+�,PDJH(QKDQFHPHQW�S���

6REHO��9� 6REHO���+�

6REHO

)LJ���� (GJH�GHWHFWLRQ�ZLWK�YDULRXV�RSHUDWRUV��2XWSXWV�DUH

QRUPDOL]HG��

&<+�,PDJH(QKDQFHPHQW�S���

3UHZLWW

5REHUW

)LJ����&RQW���� (GJH�GHWHFWLRQ�ZLWK�YDULRXV�RSHUDWRUV��2XWSXWV

DUH�QRUPDOL]HG��

Page 17: Image Enhancement

&<+�,PDJH(QKDQFHPHQW�S���

4. Enhancement in the frequency domain:

• We simply compute the Fourier transform of theimage to be enhanced, multiply the result by a filtertransfer function, and take the inverse transform toproduce the enhanced image.

Spatial domain: g(x,y)=f(x,y)*h(x,y)�

Frequency domain:G(w1,w2)=F(w1,w2)H(w1,w2)

Lowpass filtering

• Edges and sharp transitions in the gray levelscontribute to the high frequency content of itsFourier transform, so a lowpass filter smoothes animage.

• Formula of ideal LPF

else

DvuDifvuH o≤

=

),(

0

1),(

�D� �E�

)LJ�����D��,GHDO�/3)���E��%XWWHUZRUWK�/3)�

&<+�,PDJH(QKDQFHPHQW�S���

Highpass filtering

• A highpass filter attenuates the low frequencycomponents without disturbing the high frequencyinformation in the Fourier transform domain cansharpen edges.

• Formula of ideal HPF function

else

DvuDifvuH o≤

=

),(

1

0),(

�D� �E�

)LJ�����D��,GHDO�+3)���E��%XWWHUZRUWK�+3)�

Page 18: Image Enhancement

&<+�,PDJH(QKDQFHPHQW�S���

5. Pseudo color image processing

• In automated image analysis, color is a powerfuldescriptor that often simplifies object identificationand extraction from a scene.

• Human eye performs much better in discerningshades of color than gray scale.

• A monochrome image can be enhanced by usingcolors to represent different gray levels orfrequencies.

Gray level to color transformation

• To perform 3 independent transformations on thegray level of any input pixel. The three results arethen fed separately into the R, G, B guns of a colormonitor.

Redtransformat ion

Greentransformat ion

Bluetransformat ion

imagef(x,y)

IR(x,y)

IG (x,y)

IB(x,y)

)LJ����� )XQFWLRQDO� EORFN� GLDJUDP� IRU� SVHXGR�FRORU

LPDJH�SURFHVVLQJ�

&<+�,PDJH(QKDQFHPHQW�S���

• This method produces a composite image whosecolor content is modulated by the nature of thetransformation functions.

�D� �E�

)LJ����7ZR�H[DPSOHV�RI�WUDQVIRUPDWLRQ�IXQFWLRQV

• These sinusoidal functions contain regions ofrelatively constant value around the peaks as well asregions that change rapidly near the valleys.

• Changing the phase and frequency of eachsinusoidal can emphasize ranges in the gray scale.

• A small change in the phase between the 3transformations produces little change in pixelswhose gray levels correspond to peaks in thesinusoidals (i.e. Case of ),(),(),( yxIyxIyxI BGR ≈≈ ).

Page 19: Image Enhancement

&<+�,PDJH(QKDQFHPHQW�S���

• Pixels with gray level values in the steep section ofthe sinusoids are assigned a much stronger colorcontent as a result of significant differences betweenthe amplitudes of the 3 sinusoids caused by thephase displacement between them.(i.e. Case of ),(),(),( yxIyxIyxI BGR ≠≠ )

&<+�,PDJH(QKDQFHPHQW�S���

�D�

�E� �F�

)LJ����� 3VHXGR�FRORU� HQKDQFHPHQW� E\� XVLQJ� WKH� JUD\�OHYHO� WR

FRORU� WUDQVIRUPDWLRQV�� �D��2ULJLQDO� LPDJH�� �E�� DQG� �F�

UHVXOWV� REWDLQHG� ZLWK� WUDQVIRUPDWLRQ� IXQFWLRQV� �D�

DQG��E��UHVSHFWLYHO\�