digital image processing - sharif university of...

48
Digital Image Processing IMAGE ENHANCEMENT Hamid R. Rabiee Fall 2015

Upload: ngonhu

Post on 28-Apr-2018

219 views

Category:

Documents


2 download

TRANSCRIPT

Digital Image Processing

IMAGE ENHANCEMENT

Hamid R. Rabiee

Fall 2015

Outline

Point operations

Histogram modeling

Spatial operations

Transform operations

Multispectral image enhancement

2

Point operations

Zero memory operations

Given gray-level is mapped to a gray-level according

to a transformation

3

𝒖 ∈ [𝟎, 𝑳] 𝒗 ∈ [𝟎, 𝑳]

𝒗 = 𝒇(𝒖)

Point operations

Contrast stretching

Noise clipping and thresholding

Gray scale reversal

Gray-level window slicing

Bit extraction

Range compression

Contrast stretching 4

Original image Enhanced image

𝒗 = 𝒇(𝒖)

Image histogram

𝑢

𝑣

Transformation function

Noise clipping and thresholding 5

𝑢

𝑣

Contrast stretching clipping thresholding

Clipping 6

Original image Enhanced image

𝒗 = 𝒇(𝒖)

Image histogram

𝑢

𝑣

Transformation function

Thresholding 7

Original image Image after thresholding 𝒗 = 𝒇(𝒖)

Image histogram

𝑢

𝑣

Transformation function

Thresholding 8

Original image Image after thresholding 𝒗 = 𝒇(𝒖)

Image histogram

𝑢

𝑣

Transformation function

Thresholding 9

Original image Image after thresholding

Image histogram

Transformation function

?

Digital negative 10

Original image Image after digital negative

Transformation function

Gray-level window slicing 11

Original image Image after window slicing

Transformation function

Transformation function

With background

Gray-level window slicing 12

Original image Image after window slicing

Transformation function

Without background

Bit extraction 13 Example:

intensity = 132

8 7 6 5 4 3 2 1

1 0 0 0 0 1 0 0

Original

image 1 2

3 4 5

6 7 8

Bit extraction 14

Can be used for image compression

Reconstruction using bits number 6, 7, and 8 Reconstruction using bits number 7 and 8

Range compression 15

image 2-D Fourier transform Log of 2-D Fourier transform

Dynamic range very large

Can be compressed via the logarithmic transformation to be more visible

Enhances the low pixel values at the expense of loss of information in the high

pixel values

Range compression 16

image 2-D Fourier transform Log of 2-D Fourier transform

What if the compressing image has important high valued pixels?

Range compression 17

image 2-D Fourier transform

What if the compressing image has important high valued pixels?

? Desired output must be

something like this

Scale down the Fourier image before

applying the logarithmic transform

Histogram modeling 18

Histogram-modeling techniques modify an image so that its

histogram has a desired shape

Useful in stretching the low-contrast levels of images with narrow

histograms

Histogram modeling

Histogram equalization

Histogram modification

Histogram specification

Histogram equalization 19

Desired output image histogram: Uniform histogram

is the estimated probability distribution of discrete random variable ,

(indicating image pixel value) is determined using the histogram of the image

is the cumulative probability distribution of which is uniformly

distributed over

Corresponding output pixel value of each pixel value is , which is

followed by a normalization bellow to lie in

is the smallest value of between all obtained values

Histogram equalization 20

Original image Equalized image

Original image Equalized image

histogram Approximation of

uniform histogram

histogram Approximation of

uniform histogram

Histogram modification 21

Instead of cumulative probability distribution we can use other

distributions, such as

And apply a normalization

This approach is called histogram modification

Histogram modification 22

With in

Original image Modified image

histogram Modified histogram

Histogram specification 23

Desired output histogram: Any arbitrary histogram!

: Probability distribution of input image pixel value, approximated from it’s

histogram

: Probability distribution of output image pixel value, approximated from

desired output histogram

If and :

to obtain output value corresponding to input value :

First: Find such that for the smallest value of

Then:

Histogram specification 24

Original image Specified image

histogram Specified histogram

Desired output image histogram: Any arbitrary histogram!

Desired histogram

Spatial operations 25

Spatial operations

Spatial averaging and spatial low-pass filtering

Directional smoothing

Median filtering

Other smoothing techniques

Unsharp masking and crispening

Spatial low-pass, high-pass, and band-pass filtering

Inverse contrast ratio mapping and statistical scaling

Magnification and interpolation (Zooming)

Spatial averaging and spatial low-pass filtering 26

Each pixel is replaced by a weighted average of its neighborhood pixel

A common class has all equal weights

Why is it low-pass filtering?

Original image 3 * 3 average filter Image with Guassian noise

Directional smoothing 27

Directional averaging filter can be used to protect the edges from blurring

is selected such that the difference between input pixel value and the

average value of the pixels in the neighborhood window corresponding to

. is minimum

Median filter 28

Input pixel is replaced by the median of the pixels contained in a window

around the pixel

Original image 3 * 3 median filter Image with binary noise

Other smoothing techniques 29

Can we use averaging filter to remove binary noise?

Yes, but we need a threshold to determine whether we should replace the

pixel value with the averaged value or not

For additive Gaussian noise more sophisticated smoothing algorithms

are possible

What if image noise is multiplicative?

Unsharp masking and crispening 30

Unsharp masking is used commonly in printing industry for crispening the edges

An unsharp or low-pass filtered signal of the image subtracted form the image,

or equally high-pass signal or gradient of the image is obtained

The result is added to the original signal with a factor to crispen the edges

A commonly used gradient function is the discrete Laplacian:

2-D signal:

1-D signal:

Unsharp masking and crispening 31

Example of 1-D signal

Result of crispening

Original signal

Discrete Laplacian

Spatial low-pass, high-pass, and band-pass filtering 32

As mentioned earlier, spatial averaging is low-pass filter, because it somoothes the image

edges

Spatial averaging,

Low-pass filter

High-pass filter

Original signal

Band-pass filter

Spatial low-pass, high-pass, and band-pass filtering 33

Original image Low-pass filter,

k1 = 10

High-pass filter,

k2 = 10

Band-pass filter,

k1 = 10, k2 = 20

Inverse contrast ratio mapping and statistical scaling 34

Inverse contrast ratio transformation

Where and are the local mean and standard deviation of

. measured over a neighborhood window

Generally high contrast ratio for an object results in more

detectability of it. Therefor this transformation enhances week edges.

A special case for this transformation is also called

statistical scaling

35

Original image Inverse contrast ratio transformation,

with k = 3, and

followed by a log transformation

Inverse contrast ratio mapping and statistical scaling

Magnification and interpolation (Zooming) 36

Replication

Each pixel in each row is repeated one, then each resulting row is repeated

Equally: Interlace the image by rows and columns of zeros and then convolve

the result with

Linear interpolation

Straight line is first fitted in between pixels along a row. Then pixels along each

column are interpolated along a straight line

Equally: Interlace the image by rows and columns of zeros and then convolve

the result with

Zooming by replication 37

Original image and selected part Zooming Zooming again

Zooming by interpolation 38

Original image and selected part Zooming Zooming again

Transform operations 39

Transform operations

Generalized linear filtering

Root filtering

Generalized Cepstrum and homomorphic filtering

In the transform operation enhancement techniques, zero-memory

operations are performed on a transformed image, followed by the inverse

transformation

Generalized linear filtering 40

In this case the zero-memory transform domain operation is a pixel-by-pixel

multiplication

is called a zonal mask

Example:

DFT zonal mask

Spatial low-pass, high-pass, and band-pass filtering 41

Original image Low-pass filter,

a = 25

High-pass filter,

b = 40

Band-pass filter,

a = 25, b = 40

DFT transformation

Root filtering 42

The transform coefficient can be written as

In root filtering the zero-memory operation is

Generalized cepstrum and homomorphic

filtering 43

In this case the zero-memory operation is

Multispectral image enhancement 44

Multispectral image

enhancement

Intensity ratios

Log-ratios

Principal components

In multispectral imaging given a sequence of images, it is desired to

combine these images to generate a single or a few display images that

are representative of their features.

Intensity ratios 45

Define the ratios

This method gives combinations for the ratios

So, the result is a multispectral image with spectral bands

Log-ratios 46

Taking the log of both sides of pervious equation

Log-ratio gives a better display when the dynamic range of is

very large

Principal components 47

We define

Matrix is determined from the autocorrelation matrix of the ensemble of

vectors . The rows of , which are eigenvectors of

the autocorrelation matrix are arranged in decreasing order of their

associated eigenvalues

is resulting multispectral image

End of Lecture 8

Thank You! Reference: Jain book