• No results found

UNIT-II: Image Enhancement in Spatial Domain

N/A
N/A
Protected

Academic year: 2022

Share "UNIT-II: Image Enhancement in Spatial Domain"

Copied!
85
0
0

Loading.... (view fulltext now)

Full text

(1)

UNIT-II: Image Enhancement in Spatial Domain

Presented by:

Shahnawaz Uddin

DIGITAL IMAGE

PROCESSING (WLE-306)

(2)
(3)
(4)

Spatial domain process

where is the input image, is the processed image, and T is an operator on f,

defined over some neighborhood of

)]

, ( [ )

,

( x y T f x y

g

) , ( x y

f

g(x, y)

) , (x y

Intensity Transformations and Spatial Filtering

Intensity transformations operate on single pixel of an image, principally for the purpose of contrast manipulation

& image thresholding

Spatial Filtering deals with performing operations, such as image sharpening by working in a neighborhood of every pixel in an image

(5)

Neighborhood about a point

Intensity Transformations and

Spatial Filtering

(6)

Gray-level transformation function

where r is the gray level of f(x, y) and s is the gray level of g(x, y) at any point (x, y)

)

(r

T

s

(7)

Contrast enhancement

For example, a thresholding function

(8)

Masks (filters, kernels, templates, windows)

A small 2-D array in which the values of the mask coefficients determine the nature of the process

(9)

Some Basic Gray Level

Transformations

(10)
(11)

Image negatives

Enhance white or gray details

r L

s   1 

(12)

Log transformations:

where, c is a constant, and r≥0

This transformation maps a narrow range of low intensity values into a wider range of output levels and opposite is true of higher values of input levels, (i.e., to expand the values of dark pixels while

compressing the higher values in an image)

Compress the dynamic range of images with large variations in pixel values

The inverse logarithm transformation does the inverse of the log transformation

) 1

log( r c

s  

(13)

From the range 0- to the range 0 to 6.2

10

6

5 .

1 

(14)

Power-law transformations:

or

maps a narrow range of dark input values into a wider range of output values, while maps a

narrow range of bright input values into a wider range of output values

: gamma, gamma correction

cr

ssc ( r   )

 1

 1

(15)
(16)

Monitor, 2 . 5

(17)
(18)
(19)
(20)

Piecewise-linear transformation functions

The form of piecewise functions can be arbitrarily complex

(21)

Contrast stretching

(22)

Gray-level slicing

(23)
(24)

Bit-plane slicing

(25)
(26)
(27)
(28)
(29)

Histogram Processing

Histogram

where rk is the kth gray level and nk is the number of pixels in the image having gray level rk

Normalized histogram

k

k

n

r

h ( ) 

n n

r

p (

k

) 

k

/

(30)
(31)

Histogram Equalization

1 0

),

(

T r r L s

1 0

),

1(

T s s L r

Here, we focus our attention on transformations of the from

that produce an output intensity level s for every pixel in the input image having intensity r. We assume that:

(a)T(r) is monotonically increasing function in 0<= r <= L-1 and (b) 0<= T(r) <= L-1 for 0<= r <= L-1

In some formulations, we use the inverse

in which case, we change condition (a) to (a’)

(a’) T(r) is strictly monotonically

increasing function in 0<= r <= L-1

(32)
(33)

Probability density functions (PDF)

ds r dr p

s

p

s

( ) 

r

( )

T r L

r

p

r

w dw s ( ) ( 1 )

0

( )

) ( )

1 (

) ( )

1 ) (

(

0

p w dw L p r

dr L d

dr r dT dr

ds

r r

r

   

 

 

1 ) 1

(  

s L

p

s

(34)
(35)

1 ,...,

2 , 1 , 0

, )

1 (

) ( )

1 (

) (

0 0

  

L n k

L n r

p L

r T s

k

j k j

j

j r k

k

For the discrete form of transformation, the histogram equalization transformation is given by:

(36)
(37)

Inverse Transformation from s back to r is denoted by

(38)
(39)
(40)

The method used to generate a processed image that has a specified histogram is called histogram matching/specification.

T r L

r

p

r

w dw s ( ) ( 1 )

0

( )

L

z

p

z

t dt s z

G ( ) ( 1 )

0

( )

)]

( [ )

(

1

1

s G T r

G

z

) ( z

p

z is the desired PDF

Histogram Matching (Specification)

(41)

1 ,...,

2 , 1 , 0

, )

1 (

) ( )

1 (

) (

0 0

  

L n k

L n r

p L

r T s

k

j k j

j

j r k

k

1 ,...,

2 , 1 , 0

, )

( )

1 (

) (

0

 

L k

s z

p L

z G

v

k

k

i

i z k

k

1 ,...,

2 , 1 , 0

)], (

1

[  

G

T r k L

z

k k

(42)
(43)

Histogram matching

Obtain the histogram of the given image, T(r)

Precompute a mapped level for each level

Obtain the transformation function G from the given

Precompute for each value of

Map to its corresponding level ; then map level into the final level

) ( z p

z

s

k

r

k

z

k

s

k

r

k

s

k

s

k

z

k

(44)
(45)

Example 3.8: A simple example of

histogram matching/specification

(46)

Histogram Matching (Specification)

(47)
(48)
(49)
(50)
(51)
(52)
(53)

Local enhancement

Histogram using a local neighborhood, for example 7*7 neighborhood

(54)

Histogram using a local 3*3 neighborhood

(55)

Fundamentals of Spatial Filtering

The Mechanics of Spatial Filtering

(56)

Image size:

Mask size:

and

and

N M

n m

 

a

a s

b

b t

t y

s x

f t s w y

x

g ( , ) ( , ) ( , )

2 / ) 1

( 

m

a b  ( n  1 ) / 2 1

,..., 2

, 1 ,

0 

M

x y  0 , 1 , 2 ,..., N  1

(57)
(58)

Spatial Correlation and Convolution

(59)
(60)
(61)

Vector Representation of Linear Filtering

(62)

Generating Spatial Filter Masks

(63)

Smoothing Spatial Filters

Smoothing Linear Filters

Noise reduction

Smoothing of false contours

Reduction of irrelevant detail that is smaller than the filter mask

Blurring the edges in an image

(64)

9

1 9

1

16

1 9

1

i

i i

i

and R z

z R

To reduce the blurring effect during smoothing filtering

(65)

 

 

a

a s

b

b t a

a s

b

b t

t s w

t y

s x

f t s w y

x g

) , (

) ,

( ) , ( )

,

(

(66)
(67)
(68)

Order-statistic (Non-linear) spatial filters

median filter: Replace the value of a pixel by the median of the gray levels in the

neighborhood of that pixel

Noise-reduction

(69)
(70)

Note:

(71)

Sharpening Spatial Filters

Foundation

The first-order derivative

The second-order derivative

) ( )

1

( x f x

x f

f   

) ( 2 )

1 (

) 1

2

(

2

x f x

f x

x f

f     

(72)
(73)
(74)

Use of second derivatives for enhancement-The Laplacian

Development of the method

) , ( 2 )

, 1 (

) , 1

2

(

2

y x f y

x f y

x x f

f     

2 2 2

2 2

y f x

f f

 

 

) , ( 2 )

1 ,

( )

1 ,

2

(

2

y x f y

x f y

x y f

f     

(75)

) , ( 4 )]

1 ,

(

) 1 ,

( )

, 1 (

) , 1 (

2

[

y x f y

x f

y x f y

x f y

x f f

 

 

positive is

mask Laplacian

the of

t coefficien center

the if

) , ( )

, (

negative is

mask Laplacian

the of

t coefficien center

the if

) , ( )

, ( )

, (

2 2

y x f y

x f

y x f y

x f y

x

g

(76)

Note:

(77)
(78)
(79)

Simplifications

)]

1 ,

(

) 1 ,

( )

, 1 (

) , 1 (

[ )

, ( 5

) , ( 4 )]

1 ,

(

) 1 ,

( )

, 1 (

) , 1 (

[ )

, ( )

, (

y x f

y x f y

x f y

x f y

x f

y x f y

x f

y x f y

x f y

x f y

x f y

x

g

(80)
(81)

Unsharp masking and highboost filtering

Unsharp masking

Substract a blurred version of an image from the image itself

: The image, : The blurred image

) , ( )

, ( )

,

( x y f x y f x y

g

mask

 

) , ( x y

f f ( x , y ) ) , (

* )

, ( )

,

( x y f x y k g x y

g  

mask

, k  1

(82)

High-boost filtering

) , (

* )

, ( )

,

( x y f x y k g x y

g  

mask

, k  1

(83)
(84)
(85)

Salt-and-pepper noise in an image

References

Related documents

These gains in crop production are unprecedented which is why 5 million small farmers in India in 2008 elected to plant 7.6 million hectares of Bt cotton which

This curve shows the relationship between of input current (I E ) to input voltage (V BE ) for three output voltage voltage (V BE ) for three output voltage (V CB )

• By replacing the value of every pixel in an image by the average of the intensity levels in the neighborhood defined by the filter mask. • Reduced “sharp” transition

This value is well within the accept- able range for octahedral Fe(II) complexest6• The magnetic moments of the present Co(II) complexes lie in the range 3·75-4·9 BM.. While the

Instead of performing the color space transformation, a suitable technique is used to determine the R (red), G (green) and B (blue) values of the input image matrix and use it

A more recent process developed by Union Carbide for the selective flotation separation of scheelite from a low grade (approx. 0-5% WO3) tungsten ore containing appreciable

In frequency domain the filtering action is done by mapping the spatial domain into the frequency domain by taking fourier transform of the image function.. By mapping the image

Row Values remains the same Column Values of RGB space reversed with respect to input video As Webcam is in our opposite direction,so to synchronize with input