DIP Lecture 3,4

Download as pdf or txt
Download as pdf or txt
You are on page 1of 40

Digital Image Processing

Image Enhancement in Spatial Domain


Pixel Operations and Histogram Processing
Image Enhancement
Process an image to make the result more suitable than the
original image for a specific application
–Image enhancement is subjective (problem /application
oriented)

Image enhancement methods:


Spatial domain: Direct manipulation of pixel in an image (on
the image plane)
Frequency domain: Processing the image based on modifying the
Fourier transform of an image

Many techniques are based on various combinations of methods


from these two categories
Image Enhancement
Basic Concepts

Spatial domain enhancement methods can be generalized as


g(x,y)=T[f(x,y)]
f(x,y): input image
g(x,y): processed (output) image
T[*]: an operator on f (or a set of input images),
defined over neighborhood of (x,y)

Neighborhood about (x,y): a square or rectangular


sub-image area centered at (x,y)
Basic Concepts
Basic Concepts
g(x,y) = T [f(x,y)]
Pixel/point operation:
Neighborhood of size 1x1: g depends only on f at (x,y)
T: a gray-level/intensity transformation/mapping function
Let r = f(x,y) s = g(x,y)
r and s represent gray levels of f and g at (x,y)
Then s = T(r)
Local operations:
g depends on the predefined number of neighbors of f at (x,y)
Implemented by using mask processing or filtering
Masks (filters, windows, kernels, templates) :
a small (e.g. 3×3) 2-D array, in which the values of the
coefficients determine the nature of the process
Arithmetic operations
• Image Addition
– Combines information in 2 or more images

7
Arithmetic operations
• Image Subtraction
– Used for motion detection and edge
detection

8
Arithmetic operations
• Image multiplication
– Multiplying image by a number greater than
one brightens the image
• Image division
– Dividing image by a number greater than
one darkens the image.

9
Common Pixel Operations

▪ Image Negatives
▪ Log Transformations
▪ Power-Law
Transformations
Image Negatives
▪ Reverses the gray level order
▪ For L gray levels the transformation function is
s =T(r) = (L - 1) - r
Image Scaling

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


Log Transformations
Function of s = cLog(1+r)
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”
Log Transformations
Power-Law Transformation
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)
Power-Law Transformation: Example
Power-Law Transformation: Example
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
Piecewise-Linear Transformation: Contrast Stretching
Contrast Stretching Example
Histograms
24-Sep-20 Tahira Aslam 24
24-Sep-20 Tahira Aslam 25
24-Sep-20 Tahira Aslam 26
24-Sep-20 Tahira Aslam 27
24-Sep-20 Tahira Aslam 28
24-Sep-20 Tahira Aslam 29
24-Sep-20 Tahira Aslam 30
24-Sep-20 Tahira Aslam 31
24-Sep-20 Tahira Aslam 32
Example Histogram
Example Histogram
Histogram Examples
Contrast Stretching through Histogram
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
24-Sep-20 Tahira Aslam 37
24-Sep-20 Tahira Aslam 38
Bit-plane Slicing

39
Bit-plane Slicing

24-Sep-20 40

You might also like