Dip 2
Dip 2
UNIT-2
Apply some basic intensity transformation functions to enhance a low-contrast
image. Which function would be most effective and why?
SOME BASIC INTENSITY TRANSFORMATION FUNCTIONS
Image negatives
Log transformations
Contrast Stretching
Intensity-Level Slicing
Bit-Plane Slicing
Image negatives: The negative of an image with intensity levels in the range [0, L−1] is obtained by using
the negative transformation function shown in Fig. 3.3, which has the form: s =L − 1− r. Reversing the
intensity levels of a digital image in this manner produces the equivalent of a photographic negative
Fig which shows three basic types of functions used frequently in image processing:
The identity function is a trivial case in which the input and output intensities are identical
1
Digital Image Processing Question & Answers
Log transformations: The general form of the log transformation in Fig. 3.3 is s= c log(1+r).
where c is a constant and it is assumed that r ≥ 0. The shape of the log curve in Fig. 3.3 shows that this
transformation maps a narrow range of low intensity values in the input into a wider range of output levels.
For example, note how input levels in the range [ 0, L/4 ] map to output levels to the range [0 ,3L/4 ].
The log function has the important characteristic that it compresses the dynamic range of pixel values.
--eq 3-5
where c and g are positive constants. Sometimes Eq. (3-5) is written as s =c(r + e) rto account for offsets (that
is, a measurable output when the input is zero). However, offsets typically are an issue of display calibration,
and as a result they are normally ignored in Eq. (3-5).
As with log transformations, power-law curves with fractional values of g map a narrow range of dark input
values into a wider range of output values, with the opposite being true for higher values of input levels.
The response of many devices used for image capture, printing, and display obey a power law. By
convention, the exponent in a power-law equation is referred to as gamma [hence our use of this symbol in
Eq. (3-5)]. The process used to correct these power-law response phenomena is called gamma correction or
gamma encoding.
2
Digital Image Processing Question & Answers
An approach complementary to the methods discussed in the previous three sections is to use piecewise
linear functions. The advantage of these functions over those discussed thus far is that the form of piecewise
functions can be arbitrarily complex.
The main disadvantage of these functions is that their specification requires considerable user input.
Contrast Stretching
Low-contrast images can result from poor illumination, lack of dynamic range in the imaging sensor, or even
the wrong setting of a lens aperture during image acquisition. Contrast stretching expands the range of
intensity levels in an image so that it spans the ideal full intensity range of the recording medium or display
device.
Intensity-Level Slicing
There are applications in which it is of interest to highlight a specific range of inten sities in an image. Some
of these applications include enhancing features in satellite imagery, such as masses of water, and enhancing
flaws in X-ray images. The method, called intensity-level slicing.
Implemented in several ways, but most are variations of two basic themes.
1. One approach is to display in one value (say, white) all the values in the range of interest and in
another (say, black) all other intensities. This transformation, shown in Fig. 3.11(a), produces a
3
Digital Image Processing Question & Answers
binary image.
2. The second approach, based on the transformation in Fig. 3.11(b), brightens (or darkens) the desired
range of intensities, but leaves all other intensity levels in the image unchanged.
Bit-Plane Slicing
Pixel values are integers composed of bits. For example, values in a 256-level gray scale image are composed
of 8 bits (one byte). Instead of highlighting intensity-level ranges, as 3.3, we could highlight the contribution
made to total image appearance by specific bits. An 8-bit image may be considered as being composed of
eight one-bit planes, with plane 1 containing the lowest-order bit of all pixels in the image, and plane 8 all the
highest-order bits.
HISTOGRAM PROCESSING
Histogram equalization.
Explain how histogram equalization redistributes pixel intensities to enhance image contrast.
How does this differ from histogram matching (specification) in terms of output
characteristics?
Histogram equalization.
Histogram equalization is a technique used to improve the contrast of an image by redistributing the intensity
values more evenly across the histogram.
The pixel intensities of an image are mapped using a cumulative distribution function (CDF).
This process spreads out the most frequent intensity values, making the image look more balanced.
4
Digital Image Processing Question & Answers
It is especially useful for images that are too dark or too bright.
If P(r)is the probability distribution function (PDF) of the original image intensity levels r, the cumulative
distribution function (CDF) is
where:
L is the total number of intensity levels (e.g., 256 for an 8-bit image).
2. Compute the histogram and CDF of the reference image (desired histogram).
3. Establish a mapping function between the two histograms to match their intensity distributions.
Explain how local histogram processing enhances specific regions of an image compared
to global histogram equalization. How can histogram statistics be used to determine the
need for local enhancement?
Local Histogram Processing
Local histogram processing applies histogram operations (such as equalization) to small regions of an image
rather than the entire image.
Overlapping or smoothing techniques are used to avoid abrupt changes at region boundaries.
Histogram statistics such as mean, variance, standard deviation, skewness, and kurtosis can be used to
enhance images.
5
Digital Image Processing Question & Answers
Techniques:
Gray Level Slicing: Highlights specific intensity ranges while suppressing others.
Adaptive Histogram Equalization (AHE & CLAHE): Enhances local contrast by adjusting the
histogram in different regions.
2. Gaussian Filter
3. Median Filter
4. Bilateral Filter
The mean filter replaces each pixel’s value with the average of the pixels in its neighborhood. This reduces
noise but also blurs edges.
6
Digital Image Processing Question & Answers
2 Gaussian Filter (Weighted Smoothing)
A Gaussian filter assigns higher weights to pixels closer to the center, making the blurring effect more natural
than the mean filter.
Provides better smoothing than the mean filter while preserving more edges.
3. Median Filter
Concept: Replaces each pixel value with the median of its neighborhood.
Example: If the pixel neighborhood is 10,25,30,20,50,40,35,45,6010, 25, 30, 20, 50, 40, 35,
45, 6010,25,30,20,50,40,35,45,60, the median is 35.
Effect: Excellent at removing "salt-and-pepper" noise while preserving edges.
Use Cases: Image denoising, medical imaging.
4. Bilateral Filter
Concept: Applies both spatial Gaussian weighting and intensity-based weighting to smooth while
preserving edges.
Effect: Smooths homogeneous regions but retains sharp edges, unlike other smoothing filters.
Apply sharpening spatial filters to enhance the edges in an image. How does the
choice of filter affect the balance between edge enhancement and noise
amplification?
Sharpening spatial filters are used in Digital Image Processing to enhance fine details, highlight
edges, and improve clarity by emphasizing high-frequency components. Unlike smoothing filters
that reduce noise and blur images, sharpening filters make objects in an image more distinct.
7
Digital Image Processing Question & Answers
Sharpening is essential for applications like medical imaging, remote sensing, object recognition,
and feature extraction in Computer Vision.
1. Laplacian Filter
The Laplacian filter is a second-order derivative filter that enhances regions of rapid
intensity change (edges).
It uses the second derivative of the image intensity function to highlight edges.
Since it is isotropic, it detects edges in all directions (horizontal, vertical, and diagonal).
3. Unsharp Masking
The blurred image is created using a smoothing filter (like a Gaussian filter).
High-Boost Filtering
Theory
These filters detect edges by calculating the first-order derivative of intensity values.
Used in edge detection algorithms like Canny and feature extraction techniques.
FREQUENCY DOMAIN
1. PRELIMINARY CONCEPTS
9
Digital Image Processing Question & Answers
A complex number is defined as: C= R+Ji
where:
• Real numbers are a subset of complex numbers when I=0 (i.e., no imaginary component).
• Complex Conjugate
• C∗=R−jI
• This means that the conjugate of a complex number simply flips the sign of the imaginary
part while keeping the real part unchanged.
• Geometric Representation
• A complex number can be represented as a point on a 2D plane called the complex plane,
where:
• Thus, the complex number C=R+jI corresponds to the point (R,I) in the complex plane.
10
Digital Image Processing Question & Answers
Example:
ejθ =cosθ+jsinθ
where:
R(θ) is the real part of the function.
I(θ) is the imaginary part of the function.
This is useful when working with signals, transformations, and differential equations in
complex analysis.
2. NOISE MODELS
Gaussian Noise
Rayleigh Noise
Exponential Noise
Uniform Noise
Salt-and-Pepper Noise
PERIODIC NOISE
Image restoration and reconstruction focus on improving the quality of degraded images by
removing distortions and noise. It involves modeling the degradation process, understanding noise
properties, and applying filtering techniques.
where:
2. NOISE MODELS
Noise models describe how unwanted variations affect an image. Different types of noise arise due to
environmental factors, sensor limitations, or transmission errors. Common noise models include Gaussian,
Rayleigh, and salt-and-pepper noise. Each type of noise has unique characteristics and affects image quality
differently. Noise modeling helps in designing filters for noise reduction.
Explain the differences between the spatial and frequency properties of noise in an
image.
Spatial and Frequency Properties of Noise
Noise can be analyzed in both spatial and frequency domains. In the spatial domain, noise appears as
random variations in pixel intensity. In the frequency domain, noise is distributed across different frequency
components. High-frequency noise can be removed using low-pass filtering techniques. Understanding noise
properties helps in selecting appropriate noise reduction methods.
13
Digital Image Processing Question & Answers
Spatial domain: Noise appears as random variations in pixel intensity.
Frequency domain: Noise is distributed across different frequency components. High-frequency
noise can often be reduced using low-pass filtering techniques.
Noise characteristics, such as power spectrum and autocorrelation, help in designing noise removal
techniques.
Explain the role of noise probability density functions (PDFs) in image processing. (indusial
type of noise can be asked ) read all TYPES
Noise behavior is often modeled using probability density functions (PDFs), which describe how noise
values are distributed.
Gaussian Noise
It is commonly found in natural images due to thermal noise in electronic circuits, sensor imperfections,
and environmental factors.
This noise is additive, meaning it affects all pixel values in an image uniformly.
Mitigation Techniques: Gaussian smoothing (low-pass filtering), Wiener filtering, and median filtering.
Rayleigh Noise
14
Digital Image Processing Question & Answers
where aaa and bbb are distribution parameters.
This noise is observed in radar imaging, ultrasound images, and synthetic aperture radar (SAR)
images.
It appears when the magnitude of random variables follows a Rayleigh distribution rather than a uniform
or Gaussian distribution.
This noise is commonly found in laser-based imaging systems and nuclear medicine
imaging.
It arises due to the accumulation of random processes, such as photon counting in imaging
systems.
Mitigation Techniques: Logarithmic correction, histogram equalization, and adaptive
filters.
This noise is commonly found in laser-based imaging systems and nuclear medicine
imaging.
It arises due to the accumulation of random processes, such as photon counting in imaging
systems.
Mitigation Techniques: Logarithmic correction, histogram equalization, and adaptive
filters.
4. Exponential Noise
This noise is commonly found in photon imaging systems and low-light imaging scenarios.
It occurs when photons arrive randomly over time, leading to a distribution where lower
intensity values are more common than higher ones.
Mitigation Techniques: Logarithmic transformations, Wiener filtering, and adaptive
thresholding.
5. Uniform Noise
15
Digital Image Processing Question & Answers
where aaa and bbb define the range of pixel values.
This noise appears as random variations in intensity with equal probability across the range.
It is commonly seen in computer-generated images and artificial image synthesis.
Mitigation Techniques: Averaging filters, median filters, and adaptive smoothing.
6. Salt-and-Pepper Noise
This noise appears as random black and white pixels in an image.
It is caused by bit errors in transmission, malfunctioning camera sensors, or dust on lenses.
It follows a binary distribution where some pixels are set to minimum (black) or maximum
(white) intensity values.
Mitigation Techniques:
o Median filtering (effective for removing isolated noise points).
o Morphological processing (dilation and erosion techniques).
o Adaptive filters (to selectively remove noise without blurring edges).
Estimating noise parameters is essential for effective noise removal. The noise in an image can
be characterized by statistical measures such as:
1. Mean (μ) – Represents the average noise intensity.
2. Variance (σ2) – Measures the spread of noise values around the mean.
3. Histogram Analysis – Examines the intensity distribution to identify noise characteristics.
4. Power Spectral Density (PSD) – Used in the frequency domain to analyze noise components.
16
Digital Image Processing Question & Answers
5. Autocorrelation Function – Helps detect structured noise patterns like periodic noise.
OR
1. MEAN FILTERS
2. ORDER-STATISTIC FILTERS
Median Filter
Max and Min Filters
Alpha-Trimmed Mean Filter
3. ADAPTIVE FILTERS
1. MEAN FILTERS
where g(s,t) represents the intensity values of the pixels in the neighborhood SSS of size m×n times
This filter reduces high-frequency noise by smoothing the image, but it also introduces blurring,
especially at edges. It is mainly used for Gaussian noise removal but is not effective against impulse
noise (salt-and-pepper noise).
The geometric mean filter is an alternative to the arithmetic mean filter, which computes the
geometric mean of the pixel values instead of their arithmetic mean:
This filter is more effective in preserving details compared to the arithmetic mean filter. However, it
cannot handle zero values in the image since the product of any number and zero is zero. This
limitation makes it less effective when dealing with heavily corrupt images.
The harmonic mean filter is another variation of the mean filter that emphasizes small intensity
values in the image. The formula is:
This filter is particularly useful in reducing Gaussian noise and salt noise (white dots in an
image). However, it does not work well for pepper noise (black dots). It is commonly used in
18
Digital Image Processing Question & Answers
cases where small pixel values are dominant, as it avoids the influence of very large pixel
values.
The contra harmonic mean filter is designed specifically to handle impulse noise, such as
salt-and-pepper noise. It is defined as:
OR
2. ORDER-STATISTIC FILTERS
Order-statistic filters do not use arithmetic operations like mean filters; instead, they rank
pixel values in each window and replace the central pixel with a specific statistical value
from the sorted set. These filters are particularly effective against impulse noise.
The median filter is one of the most widely used filters for impulse noise (salt-and-pepper noise). It
replaces each pixel with the median value of the neighboring pixels:
19
Digital Image Processing Question & Answers
The median filter is highly effective at removing salt-and-pepper noise while preserving edges. It is
commonly used in applications requiring high-quality image restoration, such as medical imaging
and satellite image processing.
The max filter and min filter are variations of the order-statistic filter:
Max filter: Replaces the pixel value with the highest intensity in the neighborhood. It is
useful for removing pepper noise (black spots) and enhancing bright regions.
Min filter: Replaces the pixel value with the lowest intensity in the neighborhood. It is
useful for removing salt noise (white spots) and enhancing dark regions.
These filters are particularly useful in applications where noise is heavily concentrated in one
intensity range.
The alpha-trimmed mean filter is a hybrid between the mean and median filters. It removes a certain
number of highest and lowest pixel values before computing the mean. The formula is:
This filter provides flexibility, allowing the user to adjust on the level of noise. It is effective for
removing mixed noise, such as a combination of Gaussian and impulse noise.
Explain how adaptive filters adjust their behavior based on local image characteristics.
OR
Apply an adaptive filter to reduce noise in an image with varying noise levels.
3. ADAPTIVE FILTERS
This filter considers local statistical properties, such as mean and variance, to selectively
20
Digital Image Processing Question & Answers
remove noise. The formula is:
This filter is useful in situations where noise levels vary across the image. It preserves edges
and details better than traditional mean filters.
The adaptive median filter improves upon the standard median filter by adjusting the window size
dynamically based on the noise level.
Algorithm steps:
This filter is particularly effective for removing impulse noise while preserving edges and fine
details.
21