Вы находитесь на странице: 1из 68

Digital Image Processing

Lecture 4: Image Enhancement


II

Dr. Muhammad Amjad Iqbal

Pixel Operations for Image Enhancement

Common Pixel Operations

Image Negatives Log Transformations Power-Law Transformations

1/10/2014

Image Negatives
Reverses the gray level order For L gray levels the transformation function is s =T(r) = (L - 1) - r

1/10/2014

Image Scaling
s =T(r) = a.r (a is a constant)

1/10/2014

Log Transformations
Function of s = cLog(1+r)

1/10/2014

Log Transformations
Properties of log transformations
For lower amplitudes of input image the range of gray levels is expanded For higher amplitudes of input image the range of gray levels is compressed

Application:
This transformation is suitable for the case when the dynamic range of a processed image far exceeds the capability of the display device (e.g. display of the Fourier spectrum of an image) Also called dynamic-range compression / expansion
1/10/2014 7

Log Transformations

1/10/2014

Power-Law Transformation

1/10/2014

Power-Law Transformation
For < 1: Expands values of dark pixels, compress values of brighter pixels For > 1: Compresses values of dark pixels, expand values of brighter pixels If =1 & c=1: Identity transformation (s = r)

A variety of devices (image capture, printing, display) respond according to power law and need to be corrected
Gamma () correction The process used to correct the power-law response phenomena
1/10/2014 10

Power-Law Transformation

1/10/2014

11

Gamma Correction

1/10/2014

12

Power Law Example

1/10/2014

13

Power Law Example (cont)


= 0.6
1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0 0.2 0.4 0.6 0.8 1 Old Intensities
Transformed Intensities

1/10/2014

14

Power Law Example (cont)


= 0.4
1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0 0.2 0.4 0.6 0.8 1 Original Intensities

1/10/2014

Transformed Intensities

15

Power Law Example (cont)


= 0.3
1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0 0.2 0.4 0.6 0.8 1 Original Intensities

Transformed Intensities

1/10/2014

16

Power Law Example (cont)


The images to the right show a magnetic resonance (MR) image of a fractured human spine Different curves highlight different detail

s = r 0.6

s = r 0.4

1/10/2014

17

Power Law Example

1/10/2014

18

Power Law Example (cont)


= 5.0
1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0 0.2 0.4 0.6 0.8 1 Original Intensities

Transformed Intensities

1/10/2014

19

Power Law Transformations (cont)


An aerial photo of a runway is shown This time power law transforms are used to darken the image Different curves highlight different detail
1/10/2014

s = r 3.0

s = r 4.0
20

Piecewise-Linear Transformation
Contrast Stretching Goal:
Increase the dynamic range of the gray levels for low contrast images

Low-contrast images can result from


poor illumination lack of dynamic range in the imaging sensor wrong setting of a lens aperture during image acquisition
1/10/2014 21

Contrast Stretching Example

1/10/2014

22

Piecewise-Linear Transformation: Contrast Stretching

1/10/2014

23

Thresholding

1/10/2014

24

Gray Level Slicing


Highlighting a specific range of Gray levels in an image

First approach
Display a high value for all the gray levels in the range of interest Low value for all other gray levels This will produce a Binary Image

1/10/2014

25

Gray Level Slicing

2nd approach
Brightens the desired range of Gray Levels but preserves the Gray Levels of rest of the pixels

1/10/2014

26

Contrast Stretching

Contrast Stretching through Histogram


C If rmax and rmin are the maximum and minimum gray level of the input image and L is the total gray levels of output image The transformation function for contrast stretching will be

Histogram Equalization

Histogram Equalization

Histogram Equalization

Histogram Equalization

Histogram Equalization

Histogram Equalization

Histogram Equalisation(Summary)
Spreading out the frequencies in an image (or equalising the image) is a simple way to improve dark or washed out images The formula for histogram sk T ( rk ) equalisation is given where
rk: input intensity sk: processed intensity k: the intensity range (e.g 0.0 1.0) nj: the frequency of intensity j n: the sum of all frequencies

pr ( r j )
j 1

j 1

nj n

Example

Example: cdf

Example

Initial Image

Image After Equalization

Notice that the minimum value (52) is now 0 and the maximum value (154) is now 255.

Example

Histogram Equalization-Examples

Histogram Equalization-Examples

Histogram Equalization-Examples

Histogram Equalization-Examples

Images taken from Gonzalez & Woods, Digital Image Processing (2002)

Equalisation Transformation Function

Histogram Equalization-Examples

Histogram Equalization-Examples

Histogram Equalization-Examples

Histogram Equalization-Examples

Edge detection

Spatial Filtering for Image Sharpening


Background: to highlight fine detail in an image or to enhance blurred detail Applications: electronic printing, medical imaging, industrial inspection, autonomous target detection (smart weapons)...... Foundation: Blurring/smoothing is performed by spatial averaging (equivalent to integration) Sharpening is performed by noting only the gray level changes in the image that is the differentiation

Spatial Filtering for Image Sharpening


Operation of Image Differentiation Enhance edges and discontinuities (magnitude of output gray level >>0) De-emphasize areas with slowly varying gray-level values (output gray level: 0)

Mathematical Basis of Filtering for Image Sharpening First-order and Second-order Derivatives Approximation in Discrete-space Domain Implementation by Mask filtering

1st Derivative
The formula for the 1st derivative of a function is as follows:

f f ( x 1) f ( x) x
Its just the difference between subsequent values and measures the rate of change of the function

First and Second Order Derivatives

First and Second Order Derivatives

Example for Discrete Derivatives


Lets consider a simple 1 dimensional example

Example for Discrete Derivatives

Example for Discrete Derivatives

Flat Segment f=0 and f=0

Various Situations encountered by Derivatives

Step f=0 and f=0

Ramp

Ramp or step in 1D profile normally characterize an edge in the image f is non-zero on on-set and end of Ramp and produces thin edges f is non-zero along whole Ramp and produces thick edges

Thin Line

Isolated Point

Comparison between f" and f


f generally produces thicker edges in an image f" has a stronger response to fine detail f generally has a stronger response to a gray-level step f" produces a double response at step changes in gray level For image enhancement, f" is generally better suited than f Major application of f is for edge extraction; f used together with f" results in impressive enhancement effect

Applying First and 2nd Derivative using 1D Kernel

Enhancement by 2nd Derivative (Example)

Laplacian for Image Enhancement

Laplacian for Image Enhancement

Laplacian for Image Enhancement

Laplacian for Image Enhancement (Example)

Laplacian for Image Enhancement (Example)

Вам также может понравиться