1. Trang chủ
  2. » Công Nghệ Thông Tin

Digital Image Processing: Image Enhancement - Duong Anh Duc

78 87 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 78
Dung lượng 2,17 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Digital Image Processing: Image Enhancement - Duong Anh Duc presents about Image Enhancement; Point Operations; Image Negative; Contrast Stretching; Compression of Dynamic Range; Image Averaging for noise reduction; Some Averaging Filters; Some Typical Histograms.

Trang 1

Digital Image Processing

Image Enhancement

Trang 2

– Spatial domain: operate on the original image

g ( m , n ) = T [ f ( m , n )]

– Frequency domain: operate on the DFT of the original image

Trang 3

Image Enhancement Techniques

Point Operations Mask Operations Transform Operations Coloring Operations

• Median Filtering

• Sharpening operations

• Derivative operations

• Histogram operations

• Low pass Filtering

• Hi pass Filtering

• Band pass Filtering

• Homomorphic Filtering

• Histogram operations

• False Coloring

• Full color Processing

Trang 4

Point Operations

 Output pixel value g ( m , n ) at pixel ( m , n ) depends only on the input

pixel value at f ( m , n ) at ( m , n ) (and not on the neighboring pixel values)

 We normally write s = T ( r ), where s is the output pixel value and r is the input pixel value

Trang 5

Image Negative

T(r) = s = L-1-r, L: max grayvalue

Trang 6

Negative Image

Trang 7

Contrast Stretching

 Increase the dynamic range of grayvalues in the input image

 Suppose you are interested in stretching the input intensity values in the interval [ r1, r2]:

 Note that ( r - r ) < ( s - s ) The grayvalues in the range [ r , r ] is stretched into

Trang 8

only interested in the

shape of the objects

and on on their actual

grayvalues

Trang 9

Contrast Stretching

Trang 10

1

1

, 1 ,

, 0

r r

r r

r r

r

r r

r r

r T

g

Trang 11

Contrast Stretching

Gamma correction

Trang 12

Compression of Dynamic

Range

 When the dynamic range of the input

grayvalues is large compared to that of the display, we need to “compress” the grayvalue range - example: Fourier

transform magnitude

 Typically we use a log scale

Trang 13

Compression of Dynamic

Range

in log scale

Trang 14

Compression of Dynamic

Range

Graylevel Slicing : Highlight a specific

range of grayvalues

Trang 16

Compression of Dynamic

Range

Bitplane Slicing : Display the different

bits as individual binary images

Trang 17

Compression of Dynamic

Range

Trang 18

Image Subtraction

 In this case, the difference between two

“similar” images is computed to highlight

or enhance the differences between

them:

g ( m,n ) = f 1 ( m,n ) -f 2 ( m,n )

 It has applications in image segmentation

and enhancement

Trang 19

Example: Mask mode radiography

f1(m, n): Image before dye injection

f2(m, n): Image after dye injection

g(m, n): Image after dye injection,

followed by subtraction

Trang 20

Image Averaging for noise

reduction

 Noise is any random (unpredictable)

phenomenon that contaminates an image

Noise

Trang 21

Image Averaging for noise

reduction

 The noise h ( m , n ) at each pixel ( m , n ) is modeled

as a random variable

 Usually, h ( m , n ) has zero-mean and the noise values

at different pixels are uncorrelated

 Suppose we have M observations { gi( m , n )}, i= 1, 2, …,

M , we can (partially) mitigate the effect of noise by

“averaging”

M i

g M

n m

g

1

, 1

,

Trang 22

Image Averaging for noise

reduction

 In this case, we can show that:

 Therefore, as the number of observations

increases ( M ), the effect of noise

tends to zero

n

m M

n m g

n m f

n m g

E

, Var

1 ,

Var

, ,

Trang 23

Image Averaging Example

Noise Variance = 0.05

Trang 24

Image Averaging Example

Trang 25

Image Averaging Example

Trang 26

Image Averaging Example

Trang 27

Some Averaging Filters

Trang 28

 The histogram of a digital image with

grayvalues r 0 , r 1 , …, r L-1 is the discrete function

 The function p(r k ) represents the fraction of

the total number of pixels with grayvalue r k

appearance of the image

image

in    pixels

#   total

  e  with valu pixels

#  

n r

k

Trang 29

 If we consider the grayvalues in the image

as realizations of a random variable R , with some probability density, histogram

provides an approximation to this probability density In other words,

Pr[ R=r k ] p(r k )

Trang 30

Some Typical Histograms

information for contrast enhancement

Trang 31

Some Typical Histograms (cont.)

information for contrast enhancement

Trang 32

Example: Histogram Stretching

The original image displayed

The stretched image

0 5000

10000

The histogram of the original image

0 5000 10000

The stretched histogram

Trang 33

Histogram Equalization

Idea: find a non-linear transformation

g = T(f )

to be applied to each pixel of the input

image f(x,y), such that a uniform distribution

of gray levels in the entire range results for

the output image g(x,y).

Trang 34

T ( r ), based on the histogram of the input image, which will enhance the image.

T ( r ) is a monotonically increasing function for 0 r 1

(preserves order from black to white)

T ( r ) maps [0,1] into [0,1] (preserves the range of

allowed grayvalues)

Trang 35

Histogram Equalization

Trang 36

Histogram Equalization

 Let us denote the inverse transformation by r =

T - 1 ( s ) We assume that the inverse transformation also satisfies the above two conditions

and output image as random variables in the

interval [0, 1]

 Let p in ( r ) and p out ( s ) denote the probability density

of the grayvalues in the input and output images

Trang 37

Histogram Equalization

 If p in ( r ) and T ( r ) are known, and T - 1 ( s ) satisfies

condition 1, we can write (result from probability theory):

transformation T (.) such that the grayvalues in the output is uniformly distributed in [0, 1], i.e

p ( s )=1, 0 s 1

s T r

in out

ds

dr r

p s

p

1

Trang 38

r dw

w p

r T

Trang 39

Histogram Equalization

 Note that this is the cumulative distribution function (CDF) of p in ( r ) and satisfies the

previous two conditions

 From the previous equation and using the fundamental theorem of calculus,

r

p dr

ds

in

Trang 40

Histogram Equalization

 Therefore, the output histogram is given by

 The output probability density function is

uniform, regardless of the input

1 0

for   , 1 1

r p s

p

s T r

s T r in

in out

Trang 41

Histogram Equalization

 Thus, using a transformation function

equal to the CDF of input grayvalues r ,

we can obtain an image with uniform

grayvalues.

 This usually results in an enhanced image, with an increase in the dynamic range of

pixel values

Trang 42

Example: Histogram Equalization

Original image Pout after histogram equalization

Trang 43

Example: Histogram Equalization

Trang 44

Histogram Equalization

 For images with discrete grayvalues, we

have

L : Total number of graylevels

n k : Number of pixels with grayvalue rk

n : Total number of pixels in the image

1 0

  and  ,

1 0

k

Trang 45

Histogram Equalization

 The discrete version of the previous

transformation based on CDF is given by:

1 0

for     

,

0

L k

r

p n

n r

i k

k

Trang 47

Example(cont.)

Trang 48

 Notice that there are

only five distinct

195.0

7

689.0

7

681.0

7

565.0

7

344.0

7

119.0

7 in 1

in 0

in

7 in 7

7

6 in 1

in 0

in 6

6 6

5 in 1

in 0

in 5

5 5

4 in 1

in 0

in 4

4 4

3 in 1

in 0

in 3

3 3

2 in 1

in 0

in 2

2 2

1 in 0

in 1

1 1

0 in 0

0 0

r p r

p r p r p r

T s

r p r

p r p r p r

T s

r p r

p r p r p r

T s

r p r

p r p r p r

T s

r p r

p r p r p r

T s

r p r p r p r p r

T s

r p r p r p r

T s

r p r p r

T s

Trang 50

 Note that the histogram of output image is only

approximately, and not exactly, uniform This should not be surprising, since there is no result that claims uniformity in the discrete case.

Trang 51

Example(cont.)

Trang 52

Histogram of original image Histogram of equalized image

Trang 53

Example(cont.)

Trang 54

Histogram of original image Histogram of equalized image

Trang 55

Example(cont.)

Trang 56

Histogram of original image Histogram of equalized image

Trang 57

Example(cont.)

Trang 58

Histogram of original image Histogram of equalized image

Trang 59

Histogram Equalization

desirable results, particularly if the given histogram

is very narrow It can produce false edges and

regions It can also increase image “graininess”

and “patchiness.”

Trang 60

Histogram Specification

pixels are (in theory) uniformly distributed among all graylevels.

may want a transformation that yields an output

image with a prespecified histogram This

grayvalues

Trang 61

Histogram Specification

 Suppose, the input image has probability density pin( r ) We want to find a transformation z = H ( r ), such that the

probability density of the new image obtained by this

transformation is pout( z ), which is not necessarily uniform.

 First apply the transformation

This gives an image with a uniform probability density.

* 1

0

,

in

r o

r dw

w p

r T s

Trang 62

Histogram Specification

 If the desired output image were available, then the following transformation would

generate an image with uniform density:

 From the grayvalues we can obtain the

grayvalues z by using the inverse

transformation, z = G -1 ( ).

*

* 1

w p

z G

Trang 63

will generate an image with the specified density

will generate an image with the specified density pout( z ),

from an input image with density pin( r )

 For discrete graylevels, we have

1 0

for      ,

and  

1 0

for      ,

out

0

L k

z p

z G

L

k n

n r

T s

k

i k

k

k i

i k

k

Trang 64

Histogram Specification

 If the transformation z k G ( z k ) is

one-to-one, the inverse transformation s k G -1 ( s k ), can be easily determined, since we are

dealing with a small set of discrete

grayvalues.

 In practice, this is not usually the case (i.e.,

z k G ( z k ) is not one-to-one) and we assign grayvalues to match the given histogram, as closely as possible.

Trang 65

Ex.: Histogram Specification

Trang 66

Ex.: Histogram Specification

 It is desired to transform this image into a new image,

using a transformation z=H ( r ) = G-1[ T(r )], with histogram as

Trang 67

Ex.: Histogram Specification

 The transformation T ( r ) was obtained earlier (reproduced below):

Trang 68

Ex.: Histogram Specification

the transformation

G as before

100.1

7

685.0

7

565.0

7

235.0

7

115.0

000.0

000.0

000.0

7

6 out 1

out 0

out 6

6 6

5 out 1

out 0

out 5

5 5

4 out 1

out 0

out 4

4 4

3 out 1

out 0

out 3

3 3

2 out 1

out 0

out 2

2 2

1 out 0

out 1

1 1

0 out 0

0 0

z p z

p z p z p z

G

z p z

p z p z p z

G

z p z

p z p z p z

G

z p z

p z p z p z

G

z p z

p z p z p z

G

z p z p z p z p z

G

z p z p z p z

G

z p z p z

Trang 69

Ex.: Histogram Specification

 Notice that G is not invertible But we will do the best possible by setting

G-1(0) = ? (This does not matter since s 0)

G-1(1/7) = 3/7

G-1(2/7) = 4/7 (This does not matter since s 2/7)

G-1(3/7) = 4/7 (This is not defined, but we use a close match)

G-1(4/7) = ? (This does not matter since s 4/7)

G-1(5/7) = 5/7

G-1(6/7) = 6/7

G-1(1) = 1

Trang 70

Ex.: Histogram Specification

 Combining the two transformation T and G-1, we get our

Trang 71

Ex.: Histogram Specification

 Applying the transformation H to the original image yields

an image with histogram as below:

Trang 72

Ex.: Histogram Specification

Trang 73

Ex.: Histogram Specification

 Again, the actual histogram of the output

image does not exactly but only

approximately matches with the specified

histogram This is because we are dealing with discrete histograms.

Trang 74

Original image and its histogram

Trang 75

Histogram equalized image Actual histogram of output

Trang 76

Histogram specified image, Actual Histogram, and Specified Histogram

Trang 77

Enhancement Using

Local Histogram

 Used to enhance details over small portions of the image

 Define a square or rectangular neighborhood, whose center moves from pixel to pixel

neighborhood for each point and apply a histogram

equalization or histogram specification transformation to the center pixel

 Non-overlapping neighborhoods can also be used to reduce computations But this usually results in some artifacts (checkerboard like pattern)

Trang 78

Enhancement Using

Local Histogram

enhancement is the statistical moments associated with the histogram (recall that the histogram can be thought of as a probability density function)

variance to determine the local

brightness/contrast of a pixel This information can then be used to determine what, if any

transformation to apply to that pixel

non-uniform in the sense that a different

transformation is applied to each pixel

Ngày đăng: 30/01/2020, 09:20

TỪ KHÓA LIÊN QUAN

w