DIP UNIT 2
DIP UNIT 2
IMAGE ENHANCEMENT
II AIML
21CSE251T - DIP
Syllabus
• Spatial Domain:
• Basic relationship between pixels
• Basic Gray level Transformations
• Histogram Processing
• Smoothing spatial filters
• Sharpening spatial filters.
• Frequency Domain:
• Smoothing frequency domain filters
• Sharpening frequency domain filters
• Homomorphic filtering.
Recap -- TO THE FOURIER TRANSFORM AND
THE FREQUENCY DOMAIN
• The one-dimensional Fourier transform and its inverse
– Fourier transform (continuous case)(single dimension)
Diagonal Neighbors
Adjacency Pixels
Digital Path
Connected Set
• What can be interpreted from the diagram? Choose all the correct
answer.
• There are gaps between bars in a bar graph but in the histogram, the bars are
adjacent to each other.
• AAP lost to NDA.
• Histogram presents numerical data whereas bar graph shows categorical data.
• DeepSeek is a Chinese artificial intelligence company.
Quiz - 1
• What can be interpreted from the diagram? Choose all the correct
answer.
• There are gaps between bars in a bar graph but in the histogram, the bars are
adjacent to each other.
• AAP lost to NDA.
• Histogram presents numerical data whereas bar graph shows categorical data.
• DeepSeek is a Chinese artificial intelligence company.
Histogram Processing
• What is Histogram Processing?
• A technique used to analyze and enhance images by modifying pixel
intensity distributions.
• Helps in contrast enhancement, thresholding and equalization.
• Essential in applications like medical imaging, satellite imaging and
industrial quality inspection.
• Image Histogram: A graphical representation of pixel
intensity distribution.
• X-axis: Intensity levels (0-255 for an 8-bit image).
• Y-axis: Number of pixels at each intensity level.
Interpretation from the histogram
• Intuitively, it is reasonable to conclude that an
image whose pixels tend to
• occupy the entire range of possible intensity
levels and,
2. Histogram Equalization
• Redistributes pixel intensities to achieve a uniform histogram.
• Uses cumulative distribution function (CDF).
• Improves visibility in low-contrast images
Types of Histogram Processing (2/2)
3. Histogram Specification (Matching)
• Adjusts the histogram to match a desired histogram.
• Useful in standardizing image appearances.
Quiz - 2
• Choose the correct Histogram processing methods.
• Histogram Stretching
• Histogram Equalization
• Histogram Specification
• Histogram Transformation
Quiz - 2
• Choose the correct Histogram processing methods.
• Histogram Stretching
• Histogram Equalization
• Histogram Specification
• Histogram Transformation
Applications of Histogram Processing
• Medical Imaging: Enhancing X-ray and MRI images.
• Satellite Imaging: Improving visibility in aerial and space
images.
• Machine Vision: Detecting defects in manufacturing.
• Face Recognition: Enhancing facial details in low-light
conditions.
Histogram Equalization
• Let the variable r denote the intensities of an
image to be processed.
• As usual, we assume that r is in the range [0,L -
1], with r = 0 representing black and r = L - 1
representing white.
Histogram Equalization
(a) Monotonic Increasing Function
• The left graph shows that multiple values of
r (input intensity) can be mapped to a single
output intensity ‘s’.
• This means that different pixel intensities in
the original image may merge into the same
intensity in the processed image, which can
lead to loss of details.
• This type of transformation is useful for
certain applications but may reduce image
contrast.
(b) Strictly Monotonic Increasing Function
• The right graph shows a one-to-one mapping between r
and s, ensuring that each input intensity has a unique
corresponding output intensity.
• This preserves all details and prevents information loss,
making it ideal for contrast enhancement.
• If T(r) is strictly monotonic, the inverse function is single-
valued (one-to-one).
Example:
Original Pixel Neighborhood: [12, 5, 8, 200, 7, 10, 6, 9, 15]
Median Value: 9 (Replaces center pixel)
2. Sharpening Spatial Filters
• Sharpening filters highlight transitions (edges) in an image by
enhancing high-frequency components. These filters are useful for:
• Enhancing edges
• Highlighting fine details
• Increasing image contrast
• Types of Sharpening Filters:
• (i) Laplacian Filter
• (ii) High Boost Filtering
• (iii) Unsharp Masking
Quiz - 2
• Sharpening filters highlight transitions (edges) in an image by
enhancing high-frequency components. These filters are useful for:
• A). Enhancing edges
• B). Highlighting fine details
• C). Increasing image contrast
• D). Blur the image
Quiz - 2
• Sharpening filters highlight transitions (edges) in an image by
enhancing high-frequency components. These filters are useful for:
• A). Enhancing edges
• B). Highlighting fine details
• C). Increasing image contrast
• D). Blur the image
Frequency Domain
• Images can be represented as a combination
of sinusoidal waves (low/high frequencies).
• Low frequencies: Smooth areas (e.g., walls, skies).
• High frequencies: Edges, noise, textures.
• Key Tool: Fourier Transform (DFT/FFT) converts
spatial-domain images to frequency-domain spectra.
Quiz - 1
• Why Convert from Spatial to Frequency Domain?
• A. Separation of Image Components (Low vs. High Frequency)
• B. Efficient Filtering (Convolution Theorem)
• C. Image Compression (Energy Compaction)
• D. Edge Detection and Feature Extraction
Quiz - 1
• Why Convert from Spatial to Frequency Domain?
• A. Separation of Image Components (Low vs. High Frequency)
• B. Efficient Filtering (Convolution Theorem)
• C. Image Compression (Energy Compaction)
• D. Edge Detection and Feature Extraction
Smoothing (Lowpass Filters)
• Filtering in the frequency domain consists of modifying the Fourier transform of an image,
then computing the inverse transform to obtain the spatial domain representation of the
processed result.
• Thus, given (a padded) digital image, f (x, y), of size P * Q pixels, the basic filtering
equation in which we are interested has the form:
• where F-1 is the IDFT, F(u,v) is the DFT of the input image, f (x, y),
• H(u,v) is a filter transfer function (which we often call just a filter or filter function), and
• g(x, y) is the filtered (output) image.
• Functions F, H, and g are arrays of size P ×Q, the same as the padded input image.
• The product H(u,v)F(u,v) is formed using elementwise multiplication.
• The filter transfer function modifies the transform of the input image to yield the processed
output, g(x, y).
Smoothing (Lowpass Filters)
• A function H(u,v) that attenuates high
frequencies while passing low frequencies
(called a lowpass filter, as noted before)
would blur an image,
• while a filter with the opposite property
(called a highpass filter) would enhance
sharp detail, but cause a reduction in
contrast in the image.
Quiz - 2
• __________ filter, would blur an image; ________ filter
would enhance sharp detail of an image.
• A. lowpass, lopass
• B. highpass, lowpass
• C. lowpass, highpass
• D. highpass, higpass
Quiz - 2
• __________ filter, would blur an image; ________ filter
would enhance sharp detail of an image.
• A. lowpass, lopass
• B. highpass, lowpass
• C. lowpass, highpass
• D. highpass, higpass
Types of Low-Pass Filters
• 1. Ideal Low-Pass Filter (ILPF)
• 2. Gaussian Low-Pass Filter (GLPF)
• 3. Butterworth Low-Pass Filter (BLPF)