Professional Documents
Culture Documents
DIP Lec5
DIP Lec5
PROCESSING
LECTURE # 5
IMAGE ENHANCEMENT IN
SPATIAL DOMAIN-I
3 Topics to
Cover
Image Enhancement
Contrast Stretching
Gray level Slicing
Bit Plane Slicing
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
6
Image Enhancement
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)
Pixel/point operation: The simplest operation in the image processing occurs when the
neighborhood is simply the pixel itself
Thresholding
Local operations:
Image Image
Smoothing Sharpening
12
Global Operations
Global operations:
An operation on an image that will manipulate the images as a
whole
Example:: Histogram Equalization
Gray level Transformation functions [1-
3]
13
Linear function
Logarithm function
Power-law function
Color, positive picture (A) and negative (B), monochrome positive picture (C) and negative
(D)
16
Image Negative
Reverses the gray level order
The output grey value s is related to the input grey value as follows:
s =T(r) = (L - 1) – r
Gray level transformation function for obtaining the image negative of an image
Negative images are useful for enhancing white or grey detail embedded in dark regions of an
image
17
Logarithmic Transformation [2]
Logarithmic Transformations can be used to brighten the intensities of an image. More often, it is used
to increase the detail (or contrast) of lower intensity values.
They are especially useful for bringing out detail in Fourier transforms
The constant c is usually used to scale the range of the log function to match the input domain.
It can also be used to further increase contrast—the higher the c, the brighter the image will appear. Used this way,
the log function can produce values too bright to be displayed.
24
Power Law Transformation
The images shows the Magnetic Resonance image of a fractured human spine
Different curves highlight different details
1 1 1
0 0 0
. . .
9 9 9
0 0 0
. . .
8 8 8
0 0 0
. . .
7 7 7
0 0 0
. . .
6 0 0.2 0.4 0.6 0.8 1 6 0 0.2 0.4 0.6 1 6 0 0.2 0.4 0.6 1
0 Old Intensities 0 0.8 0 0.8
Original Original
. . Intensities . Intensities
5 5 5
0 0 0
. . .
4 4 4
0 0 0
25
Power Law Transformation
An aerial photo of a runway is shown
This time Power Law Transform is used to darken the image
γ = 5.0
1
0.
9
0.
8
0.
7
0.
6
0.
5
0.
4
0. 0 0.2 0.4 0.6 0.8 1
3 Original Intensities
0.
2
0.
1
0
27
Contrast Stretching: Example
Figure below shows a typical transformation used for contrast stretching. The locations of
points (r1, s1) and (r2, s2) control the shape of the transformation function.
If r1=s1, r2=s2
Transformation= Linear
If (r1,s1)= (rmin,
0)
(r2,s2)= (rmax, L-1) functio
Transformation
stretches the levels n linearly from original range to full range [0, L-1]
Bit-plane 7 Bit-plane 6
Multiplication/Division
Scaling
Shading
Convolution
AND / OR operations
To remove the unnecessary area of an image through mask
operations
NOT operation
A common variant of the operator simply allows a specified constant to be added to every
pixel.
Image Addition
33
How It Works?
The addition of two images is performed straightforwardly in a single pass. The output pixel values are given by:
If the pixel values in the input images are actually vectors rather than scalar values (e.g. for color images) then
the individual components (e.g. red, blue and green components) are simply added separately to produce the
output value.
Image Averaging for Noise Reduction
34
Image Averaging for Noise Reduction
35
Image Subtraction
36
Takes two images as input and produces a third image whose pixel values are those of the first image
minus the corresponding pixel values from the second image
Variants
It is also often possible to just use a single image as input and subtract a constant value from all the
pixels
Just output the absolute difference between pixel values, rather than the straightforward signed
output.
Image Subtraction
37
If the operator calculates absolute differences, then it is impossible for the output pixel
values to be outside the range
In rest of the two cases the pixel value may become negative
The result of image subtraction may come in the range of -255 to +255
One scheme can be to add 255 to every pixel and then divide by 2
2nd Method
Like other image arithmetic operators, multiplication comes in two main forms.
The first form takes two input images and produces an output image in which the pixel values are just
those of the first image, multiplied by the values of the corresponding values in the second image.
The second form takes a single input image and produces output in which each pixel value is
multiplied by a specified constant.
How It Works
The multiplication of two images is performed in the obvious way in a single pass using the formula:
There are many specialist uses for scaling. In general, though, given a scaling factor greater than
one, scaling will brighten an image. Given a factor less than one, it will darken the image.
For instance, shows a picture of model robot that was taken under low lighting conditions.
Simply scaling every pixel by a factor of 3, we obtain the one shown in the middle which is much clearer.
However, when using pixel multiplication, we should make sure that the calculated pixel values
don't exceed the maximum possible value. If we, for example, scale the above image by a factor of 5 using
an 8-bit representation, we obtain the one shown in last. All the pixels which, in the original image, have a
value greater than 51 exceed the maximum value and are (in this implementation) wrapped around from 255
back to 0.
Image Multiplication
44
Multiplication also provides a good way of "shading" artwork. You can use it to
introduce a sense of diffuse lighting into your painting.
Image Multiplication
45
Multiplication provides a good way to color line drawings. Here you can
really see the "black times anything is black, white times anything is that
thing unchanged" rule in action.
Logic Operations
46
When Logical operation performs on gray-level images, the pixel values are
processed as string of binary numbers
Intermediate values are processed the same way changing all 1’s to 0’s
and vice versa
The AND and OR operations are used for masking; that is for selecting sub-images in an
image as mentioned in the figure 3.27
2.http://www.cs.uregina.ca/Links/class-info/425/Lab3/
3.http://www.tutorialspoint.com/dip/Gray_Level_Transformations.htm
For any query Feel Free to
50
ask