Digital Image Processing
Week # 3
Lecture # 7-9
1
Intensity Transformation
The Basics
• Spatial domain techniques work directly on the pixels as opposed to, for example, frequency
domain, which work in a transformed domain (for instance Fourier)
• Spatial domain processing is more efficient, needs less computaitons
• g(x,y)=T[f(x,y)]
Neighborhood operation:
• For the pixels at the corners of the image, normal practice is to omit the missing neighbors or
to pad zeros.
• Smallest possible neighborhood is of size 1x1 i.e. the pixel itself.
Intensity Transformation: Contrast Stretching
• The transformation produces higher contrast than the original by
darkening the intensity levels below m and brightening the levels above m
• Thresholding: Produces a binary image. Pixels above a threshold are
designated as ‘1’ and the others are declared ‘0’
Images Negative and Identity Image (Linear Operations)
• The negative of an image with intensity levels in the range [0,L-1] is
obtained: s=L-1-r -> linear operation
• This processing is used to get an image negative
• Particularly useful in enhancing the white or gray detail embedded in dark
regions of an image
• For an 8 bpp (bits per pixel) image L-1=255
• Identity image: s=r
Log Transformation (Dynamic Range Compression)
• The log transformation corresponds to the operation: s = c log (1+r)
• ‘c’ is a constant
• The transformation maps a narrow range of low intensity inputs into a wider
range of output levels and vice versa for the higher values of input.
• The logarithmic transformation compresses the dynamic range of images with
large variations in pixel values
• The most common application for the dynamic range compression is for the display of
the Fourier Transform.
• The maximum magnitude value of its Fourier Transform is 7.9x10^6, and the second
largest value is approximately 10 times smaller. If we simply linearly scale this image,
we obtain the middle figure.
• Due to the large dynamic range, we can only recognize the largest value in the center
of the image. All remain values appear as black on the screen. If we instead apply the
logarithmic operator to the Fourier image, we obtain the third image.
• Here, smaller pixel values are enhanced and therefore the image shows significantly
more details.
• The logarithmic operator enhances the low intensity pixel values, while compressing
high intensity values into a relatively small pixel range. Hence, if an image contains
some important high intensity information, applying the logarithmic operator might
lead to loss of information.
• Thus, a logarithmic transform is appropriate when we want to enhance the low
pixel values at the expense of loss of information in the high pixel values
• Subject was photographed in front of a bright background. The dynamic range of
the film material is too small, so that the gray levels on the subject's face are
clustered in a small pixel value range. A logarithmic transform spreads them over a
wider range, while the higher values are compressed
• Applying logarithmic transform is less appropriate, because most of its
details are contained in the high pixel values.
• This image shows that a lot of information is lost during the transform
Power-Law (Gamma) Transformation
• Power-law transformations have the basic form:
•
• Two important observations:
• (1) For fractional values of gamma: A narrow range of dark input values
are mapped into a wider range of output values. Opposite is true for
higher input intensities. Enhances the darker pixels
• (2) For gamma>1: Narrow range of high input intensities are mapped to a
wider range of output values. Opposite is true for the lower input
intensities. Enhances the brighter pixels.
• An Illustrated Example:
DIP Lecture 7-9.pdf
DIP Lecture 7-9.pdf
Contrast Manipulation: Another Application of Gamma
Correction
DIP Lecture 7-9.pdf
Piece-wise Linear Transformation Function
• A complementary approach to the methods discussed in the previous three sections is to
use piecewise linear functions. The principal advantage of piecewise linear functions over
the types of functions we have discussed thus far is that the form of piecewise functions can
be arbitrarily complex. In fact, as we will see shortly, a practical implementation of some
important transformations can be formulated only as piecewise functions. The principal
disadvantage of piecewise functions is that their specification requires considerably more
user input.
• Contrast stretching Low-contrast images can result from poor illumination, lack of dynamic
range in the imaging sensor, or even wrong setting of a lens aperture during image
acquisition. The idea behind contrast stretching is to increase the dynamic range of the gray
levels in the image being processed.
• The locations of points (r1, s1) and (r2, s2) control the
shape of the transformation
• If r1=s1 and r2=s2, the transformation is a linear function
that produces no changes in gray levels.
• If r1=r2, s1=0 and s2=L-1, then the transformation becomes
a thresholding function and will result in a binary image.
• Intermediate values of r1, s1 and r2, s2 produce
various degrees of spread in the gray levels of the output
image
• Figure shows an 8-bit image with low contrast. Fig. 3.10(c) shows the result of
contrast stretching, obtained by setting (r1, s1) =(r_min, 0) and (r2, s2)=(r_max,L-1)
where r_min and r_max denote the minimum and maximum gray levels in the
image, respectively. Thus, the transformation function stretched the levels linearly
from their original range to the full range [0, L-1]. Finally, Fig. 3.10(d) shows the
result of using the thresholding function defined previously, with r1=r2=m, the
mean gray level in the image
Piece-wise Linear Transformations Contd……
• Intensity Level Slicing: The objective is to highlight a specific range of intensities.
• Applications: Enhancing masses of water in satellite images, highlighting flaws in
X-ray images.
• Two main approaches are adopted
• (1) Represent the intensities in region of interest (ROI) with one value (say white)
and the rest with the other value (say, black). Result is a binary image.
• (2) Brighten or darken the intensities in ROI and leave others unchanged
• A little twist in part (c) above, the interest lies in the original intensities of the ROI so we kept the higher
intensities as is and transformed the mid-gray intensities to black
Piece-wise Linear Transformations Contd……
• Bit-plane Slicing: To highlight the contribution made to the total image
appearance by specific bits.
• Application: Image compression
• Assuming that each pixel is represented by 8 bits, the image is composed
of eight 1-bit planes.
• Plane 1 contains the least significant bit and plane 8 contains the most
significant bit.
• Useful for analyzing the relative importance played by each bit of the
image.
• Only the higher order bits (top four) contain visually significant data. The
other bit planes contribute the more subtle details
• Plane 8 corresponds exactly with an image thresholded at gray level 127.
We map all intensities between 0-127 to 0 and map all levels between
128-255 to 1.
DIP Lecture 7-9.pdf
DIP Lecture 7-9.pdf
Image Reconstruction using Bit-planes
• 
• We multiply nth significant bit by 2^(n-1) and add the resultant images.
• Note that 4 top planes are enough for visually significant reconstruction
• Adding more planes will not matter a lot
Histogram Processing
• Let rk be the kth intensity value (i.e. k=0,1,2,…,L-1) and let nk be the
number of pixels in an image with intensity rk. Then histogram of the
image is defined as h(rk)= nk
• It is normal practice to divide each component of histogram with the total
number of pixes of an image =MN
• A normalized histogram is therefore given as: p(rk)= nk /(MN); k=0,1,…,L-1
• p(rk) is an estimate of the probability of occurrence of intensity level rk in
an image. The sum of all components of a normalized histogram is equal
to 1.
• Image whose pixels tend to occupy the
entire range of intensity levels and
tend to be distributed uniformly will
have an appearance of high contrast
and will exhibit a large variety of gray
tones.
• Could there be a tool through which
we can enhance the contrast of dull
images using the concept of spreading
intensities?
Histogram Equalization
• A method through which intensities of an image are spread to the entire
range thereby increasing the contrast of the image
• r=0,1,2,…..,L-1
• Effect of histogram equalization
An Illustrative Example
Intensity # pixels
0 20
1 5
2 25
3 10
4 15
5 5
6 10
7 10
Total 100
Accumulative Sum of Pr
20/100 = 0.2
(20+5)/100 = 0.25
(20+5+25)/100 = 0.5
(20+5+25+10)/100 = 0.6
(20+5+25+10+15)/100 = 0.75
(20+5+25+10+15+5)/100 = 0.8
(20+5+25+10+15+5+10)/100 = 0.9
(20+5+25+10+15+5+10+10)/100 = 1.0
1.0
Intensity
(r)
No. of Pixels
(nj)
Acc Sum
of Pr
Output value Quantized
Output (s)
0 20 0.2 0.2x7 = 1.4 1
1 5 0.25 0.25*7 = 1.75 2
2 25 0.5 0.5*7 = 3.5 4
3 10 0.6 0.6*7 = 4.2 4
4 15 0.75 0.75*7 = 5.25 5
5 5 0.8 0.8*7 = 5.6 6
6 10 0.9 0.9*7 = 6.3 6
7 10 1.0 1.0x7 = 7 7
Total 100
Histogram Specification
• Image of Mars moon-most pixels have intensities around 0
• Although it appears that histogram equalization will enhance details in the
dark region?
• Let’s find out
• The transformation suggest the HE would result in a washed-out image.
• Note how quickly the curve rises to high intensity
• HE is not the desired fix
• We can fix the image by devising a suitable transformation which would change
the histogram in a desirable way.
• Problem? Lots of pixel near ‘0’
• We cannot change the histogram altogether as it will entirely change the image.
• We keep the original look of the image in tact i.e. majority of pixels lying in lower
intensity region but we make the transition of levels smoother in the dark region
Smoother transition of levels in dark region
33

More Related Content

PPT
Digital Image through Scanner, Digital Camera. Concept of Gray Levels.
PPTX
Image Processing - Unit II - Image Enhancement discussed
PPTX
Module 2
PPTX
IMAGE ENHANCEMENT IN THE SPATIAL DOMAIN.pptx
PPT
Chap5 imange enhancemet
PPTX
Unit 2. Image Enhancement in Spatial Domain.pptx
PPTX
UNIT-2-PPT1-Image Enhancement in Spatial Domain.pptx
PPTX
Chapter 3 image enhancement (spatial domain)
Digital Image through Scanner, Digital Camera. Concept of Gray Levels.
Image Processing - Unit II - Image Enhancement discussed
Module 2
IMAGE ENHANCEMENT IN THE SPATIAL DOMAIN.pptx
Chap5 imange enhancemet
Unit 2. Image Enhancement in Spatial Domain.pptx
UNIT-2-PPT1-Image Enhancement in Spatial Domain.pptx
Chapter 3 image enhancement (spatial domain)

Similar to DIP Lecture 7-9.pdf (20)

PPT
Image Enhancement in the Spatial Domain1.ppt
PPT
Image enhancement in the spatial domain1
PPT
Image Enhancement in the Spatial Domain U2.ppt
PDF
UNIT-2 image enhancement.pdf Image Processing Unit 2 AKTU
PPT
Image enhancement
PPT
image enhancement
PPTX
Image Enhancement in Spatial Domain and Frequency Domain
PPTX
Digital Image Processing Unit -2 Notes complete
PPTX
COM2304: Intensity Transformation and Spatial Filtering – I (Intensity Transf...
PPT
Intensity Transformation and Spatial Filtering -Gonzales Chapter 3.1-3.3 (4).ppt
PPTX
Chapter 3 Image Enhanvement_ComputerVision.pptx
PPTX
Image Enhancement in Spatial Domain
PPTX
Image Enhancement in Spatial Frequency Domain
PPTX
Image Enhancement research document.pptx
PPTX
Module 2.pptxwwwwwwwwwwwwwwwwwwwwwwwwwww
PDF
Image enhancement
PPTX
Lect 03 - first portion
PDF
Computer graphics is drawing pictures by using computer aided methods and alg...
PPTX
Basic Spatial domain image enhancements.pptx
PDF
4.intensity transformations
Image Enhancement in the Spatial Domain1.ppt
Image enhancement in the spatial domain1
Image Enhancement in the Spatial Domain U2.ppt
UNIT-2 image enhancement.pdf Image Processing Unit 2 AKTU
Image enhancement
image enhancement
Image Enhancement in Spatial Domain and Frequency Domain
Digital Image Processing Unit -2 Notes complete
COM2304: Intensity Transformation and Spatial Filtering – I (Intensity Transf...
Intensity Transformation and Spatial Filtering -Gonzales Chapter 3.1-3.3 (4).ppt
Chapter 3 Image Enhanvement_ComputerVision.pptx
Image Enhancement in Spatial Domain
Image Enhancement in Spatial Frequency Domain
Image Enhancement research document.pptx
Module 2.pptxwwwwwwwwwwwwwwwwwwwwwwwwwww
Image enhancement
Lect 03 - first portion
Computer graphics is drawing pictures by using computer aided methods and alg...
Basic Spatial domain image enhancements.pptx
4.intensity transformations
Ad

More from SAhsanShahBukhari (6)

PPTX
Telemedicine 01 Introduction (1).pptx
PDF
pacemaker.pdf
PPTX
M&S Presentation.pptx
PPTX
electrophoresis
PPTX
Atomic Foce Microscopy by Syed Ahsan Bukhari.pptx
PPTX
Presentation.pptx
Telemedicine 01 Introduction (1).pptx
pacemaker.pdf
M&S Presentation.pptx
electrophoresis
Atomic Foce Microscopy by Syed Ahsan Bukhari.pptx
Presentation.pptx
Ad

Recently uploaded (20)

PDF
BIO-INSPIRED ARCHITECTURE FOR PARSIMONIOUS CONVERSATIONAL INTELLIGENCE : THE ...
PDF
22EC502-MICROCONTROLLER AND INTERFACING-8051 MICROCONTROLLER.pdf
PDF
Soil Improvement Techniques Note - Rabbi
PDF
UNIT no 1 INTRODUCTION TO DBMS NOTES.pdf
PPTX
AUTOMOTIVE ENGINE MANAGEMENT (MECHATRONICS).pptx
PDF
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
PDF
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf
PDF
III.4.1.2_The_Space_Environment.p pdffdf
PPTX
communication and presentation skills 01
PPTX
Sorting and Hashing in Data Structures with Algorithms, Techniques, Implement...
PDF
Exploratory_Data_Analysis_Fundamentals.pdf
PPTX
Software Engineering and software moduleing
PDF
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
PPTX
Module 8- Technological and Communication Skills.pptx
PDF
August -2025_Top10 Read_Articles_ijait.pdf
PDF
Categorization of Factors Affecting Classification Algorithms Selection
PPTX
introduction to high performance computing
PDF
SMART SIGNAL TIMING FOR URBAN INTERSECTIONS USING REAL-TIME VEHICLE DETECTI...
PPTX
Current and future trends in Computer Vision.pptx
PDF
EXPLORING LEARNING ENGAGEMENT FACTORS INFLUENCING BEHAVIORAL, COGNITIVE, AND ...
BIO-INSPIRED ARCHITECTURE FOR PARSIMONIOUS CONVERSATIONAL INTELLIGENCE : THE ...
22EC502-MICROCONTROLLER AND INTERFACING-8051 MICROCONTROLLER.pdf
Soil Improvement Techniques Note - Rabbi
UNIT no 1 INTRODUCTION TO DBMS NOTES.pdf
AUTOMOTIVE ENGINE MANAGEMENT (MECHATRONICS).pptx
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf
III.4.1.2_The_Space_Environment.p pdffdf
communication and presentation skills 01
Sorting and Hashing in Data Structures with Algorithms, Techniques, Implement...
Exploratory_Data_Analysis_Fundamentals.pdf
Software Engineering and software moduleing
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
Module 8- Technological and Communication Skills.pptx
August -2025_Top10 Read_Articles_ijait.pdf
Categorization of Factors Affecting Classification Algorithms Selection
introduction to high performance computing
SMART SIGNAL TIMING FOR URBAN INTERSECTIONS USING REAL-TIME VEHICLE DETECTI...
Current and future trends in Computer Vision.pptx
EXPLORING LEARNING ENGAGEMENT FACTORS INFLUENCING BEHAVIORAL, COGNITIVE, AND ...

DIP Lecture 7-9.pdf

  • 1. Digital Image Processing Week # 3 Lecture # 7-9 1
  • 3. The Basics • Spatial domain techniques work directly on the pixels as opposed to, for example, frequency domain, which work in a transformed domain (for instance Fourier) • Spatial domain processing is more efficient, needs less computaitons • g(x,y)=T[f(x,y)] Neighborhood operation: • For the pixels at the corners of the image, normal practice is to omit the missing neighbors or to pad zeros. • Smallest possible neighborhood is of size 1x1 i.e. the pixel itself.
  • 4. Intensity Transformation: Contrast Stretching • The transformation produces higher contrast than the original by darkening the intensity levels below m and brightening the levels above m • Thresholding: Produces a binary image. Pixels above a threshold are designated as ‘1’ and the others are declared ‘0’
  • 5. Images Negative and Identity Image (Linear Operations) • The negative of an image with intensity levels in the range [0,L-1] is obtained: s=L-1-r -> linear operation • This processing is used to get an image negative • Particularly useful in enhancing the white or gray detail embedded in dark regions of an image • For an 8 bpp (bits per pixel) image L-1=255 • Identity image: s=r
  • 6. Log Transformation (Dynamic Range Compression) • The log transformation corresponds to the operation: s = c log (1+r) • ‘c’ is a constant • The transformation maps a narrow range of low intensity inputs into a wider range of output levels and vice versa for the higher values of input. • The logarithmic transformation compresses the dynamic range of images with large variations in pixel values
  • 7. • The most common application for the dynamic range compression is for the display of the Fourier Transform. • The maximum magnitude value of its Fourier Transform is 7.9x10^6, and the second largest value is approximately 10 times smaller. If we simply linearly scale this image, we obtain the middle figure. • Due to the large dynamic range, we can only recognize the largest value in the center of the image. All remain values appear as black on the screen. If we instead apply the logarithmic operator to the Fourier image, we obtain the third image. • Here, smaller pixel values are enhanced and therefore the image shows significantly more details. • The logarithmic operator enhances the low intensity pixel values, while compressing high intensity values into a relatively small pixel range. Hence, if an image contains some important high intensity information, applying the logarithmic operator might lead to loss of information.
  • 8. • Thus, a logarithmic transform is appropriate when we want to enhance the low pixel values at the expense of loss of information in the high pixel values • Subject was photographed in front of a bright background. The dynamic range of the film material is too small, so that the gray levels on the subject's face are clustered in a small pixel value range. A logarithmic transform spreads them over a wider range, while the higher values are compressed
  • 9. • Applying logarithmic transform is less appropriate, because most of its details are contained in the high pixel values. • This image shows that a lot of information is lost during the transform
  • 10. Power-Law (Gamma) Transformation • Power-law transformations have the basic form: •
  • 11. • Two important observations: • (1) For fractional values of gamma: A narrow range of dark input values are mapped into a wider range of output values. Opposite is true for higher input intensities. Enhances the darker pixels • (2) For gamma>1: Narrow range of high input intensities are mapped to a wider range of output values. Opposite is true for the lower input intensities. Enhances the brighter pixels. • An Illustrated Example:
  • 14. Contrast Manipulation: Another Application of Gamma Correction
  • 16. Piece-wise Linear Transformation Function • A complementary approach to the methods discussed in the previous three sections is to use piecewise linear functions. The principal advantage of piecewise linear functions over the types of functions we have discussed thus far is that the form of piecewise functions can be arbitrarily complex. In fact, as we will see shortly, a practical implementation of some important transformations can be formulated only as piecewise functions. The principal disadvantage of piecewise functions is that their specification requires considerably more user input. • Contrast stretching Low-contrast images can result from poor illumination, lack of dynamic range in the imaging sensor, or even wrong setting of a lens aperture during image acquisition. The idea behind contrast stretching is to increase the dynamic range of the gray levels in the image being processed. • The locations of points (r1, s1) and (r2, s2) control the shape of the transformation • If r1=s1 and r2=s2, the transformation is a linear function that produces no changes in gray levels. • If r1=r2, s1=0 and s2=L-1, then the transformation becomes a thresholding function and will result in a binary image. • Intermediate values of r1, s1 and r2, s2 produce various degrees of spread in the gray levels of the output image
  • 17. • Figure shows an 8-bit image with low contrast. Fig. 3.10(c) shows the result of contrast stretching, obtained by setting (r1, s1) =(r_min, 0) and (r2, s2)=(r_max,L-1) where r_min and r_max denote the minimum and maximum gray levels in the image, respectively. Thus, the transformation function stretched the levels linearly from their original range to the full range [0, L-1]. Finally, Fig. 3.10(d) shows the result of using the thresholding function defined previously, with r1=r2=m, the mean gray level in the image
  • 18. Piece-wise Linear Transformations Contd…… • Intensity Level Slicing: The objective is to highlight a specific range of intensities. • Applications: Enhancing masses of water in satellite images, highlighting flaws in X-ray images. • Two main approaches are adopted • (1) Represent the intensities in region of interest (ROI) with one value (say white) and the rest with the other value (say, black). Result is a binary image. • (2) Brighten or darken the intensities in ROI and leave others unchanged
  • 19. • A little twist in part (c) above, the interest lies in the original intensities of the ROI so we kept the higher intensities as is and transformed the mid-gray intensities to black
  • 20. Piece-wise Linear Transformations Contd…… • Bit-plane Slicing: To highlight the contribution made to the total image appearance by specific bits. • Application: Image compression • Assuming that each pixel is represented by 8 bits, the image is composed of eight 1-bit planes. • Plane 1 contains the least significant bit and plane 8 contains the most significant bit. • Useful for analyzing the relative importance played by each bit of the image. • Only the higher order bits (top four) contain visually significant data. The other bit planes contribute the more subtle details • Plane 8 corresponds exactly with an image thresholded at gray level 127. We map all intensities between 0-127 to 0 and map all levels between 128-255 to 1.
  • 23. Image Reconstruction using Bit-planes • • We multiply nth significant bit by 2^(n-1) and add the resultant images. • Note that 4 top planes are enough for visually significant reconstruction • Adding more planes will not matter a lot
  • 24. Histogram Processing • Let rk be the kth intensity value (i.e. k=0,1,2,…,L-1) and let nk be the number of pixels in an image with intensity rk. Then histogram of the image is defined as h(rk)= nk • It is normal practice to divide each component of histogram with the total number of pixes of an image =MN • A normalized histogram is therefore given as: p(rk)= nk /(MN); k=0,1,…,L-1 • p(rk) is an estimate of the probability of occurrence of intensity level rk in an image. The sum of all components of a normalized histogram is equal to 1.
  • 25. • Image whose pixels tend to occupy the entire range of intensity levels and tend to be distributed uniformly will have an appearance of high contrast and will exhibit a large variety of gray tones. • Could there be a tool through which we can enhance the contrast of dull images using the concept of spreading intensities?
  • 26. Histogram Equalization • A method through which intensities of an image are spread to the entire range thereby increasing the contrast of the image
  • 27. • r=0,1,2,…..,L-1 • Effect of histogram equalization
  • 28. An Illustrative Example Intensity # pixels 0 20 1 5 2 25 3 10 4 15 5 5 6 10 7 10 Total 100 Accumulative Sum of Pr 20/100 = 0.2 (20+5)/100 = 0.25 (20+5+25)/100 = 0.5 (20+5+25+10)/100 = 0.6 (20+5+25+10+15)/100 = 0.75 (20+5+25+10+15+5)/100 = 0.8 (20+5+25+10+15+5+10)/100 = 0.9 (20+5+25+10+15+5+10+10)/100 = 1.0 1.0
  • 29. Intensity (r) No. of Pixels (nj) Acc Sum of Pr Output value Quantized Output (s) 0 20 0.2 0.2x7 = 1.4 1 1 5 0.25 0.25*7 = 1.75 2 2 25 0.5 0.5*7 = 3.5 4 3 10 0.6 0.6*7 = 4.2 4 4 15 0.75 0.75*7 = 5.25 5 5 5 0.8 0.8*7 = 5.6 6 6 10 0.9 0.9*7 = 6.3 6 7 10 1.0 1.0x7 = 7 7 Total 100
  • 30. Histogram Specification • Image of Mars moon-most pixels have intensities around 0 • Although it appears that histogram equalization will enhance details in the dark region? • Let’s find out
  • 31. • The transformation suggest the HE would result in a washed-out image. • Note how quickly the curve rises to high intensity • HE is not the desired fix • We can fix the image by devising a suitable transformation which would change the histogram in a desirable way.
  • 32. • Problem? Lots of pixel near ‘0’ • We cannot change the histogram altogether as it will entirely change the image. • We keep the original look of the image in tact i.e. majority of pixels lying in lower intensity region but we make the transition of levels smoother in the dark region Smoother transition of levels in dark region
  • 33. 33