Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
6 views

Module2 ImageEnhancement Preprocess

The document discusses various properties and techniques related to digital images. It describes how digital images are represented as arrays and discusses pixel relationships and distance measures. It also covers various spatial domain operations and filters that can be applied including smoothing, sharpening, histogram processing, and order-statistic filters.

Uploaded by

kobaya7455
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Module2 ImageEnhancement Preprocess

The document discusses various properties and techniques related to digital images. It describes how digital images are represented as arrays and discusses pixel relationships and distance measures. It also covers various spatial domain operations and filters that can be applied including smoothing, sharpening, histogram processing, and order-statistic filters.

Uploaded by

kobaya7455
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 53

Digital Image Properties

Pixel Relationships
Digital Image Representation
• A digital image is a two-dimensional discrete signal.
• A digital image is also an N × N array of elements.
• Each element in the array is a number which represents the sampled
intensity.
Neighbours of a Pixel
A pixel p at coordinates has four horizontal and The four diagonal neighbors of p and four horizontal and
vertical neighbors vertical neighbors of p produce

(x + 1, y), (x - 1, y), (x, y + 1), (x, y - (x + 1, y + 1), (x + 1, y - 1), (x - 1, y + 1), (x - 1, y - 1)


1) (x + 1, y), (x - 1, y), (x, y + 1), (x, y -
1)
Distance Measures
• For pixels p, q, and z, with coordinates (x, y), (s, t), and (v, w), respectively, D is a distance function or metric

• The Euclidean distance between p and q is defined as

• The distance (called the city-block distance) between p and q is defined as

• The distance (called the chessboard distance) between p and q is defined as


Find the Distance between pixels
• Euclidean Distance

• City Block Distance

• Chess board Distance


Find the Distance between pixels
• Euclidean Distance

• City Block Distance

• Chess board Distance


Spatial Domain - Operations
• The spatial domain technique deals with the manipulation of pixel
values. The spatial domain technique can be broadly classified into
(i) point operation, (ii) mask operation, and (iii) global operation.

• The spatial domain processes can be denoted by the expression,


g(x, y) = T[ f(x, y)]

• where is the input image, is the output image, and T is an operator


on f defined over a single pixel or neighborhood of point (x, y).
Spatial Operations
Basic Intensity Transformation Functions -
Gray Level Transformations
• Brightness Modification

g[m, n] = f [m, n] ±
k

• Image Negative
Basic Intensity Transformation Functions -
Gray Level Transformations
• Gamma Correction

• Log Transform
Piecewise-Linear Transformation Functions
• Contrast stretching
Contrast stretching is a process that expands the range of intensity
levels in an image so that it spans the full intensity range of the
recording medium or display device.
Contrast Stretching
• For an input image, minimum intensity fmin>0 and maximum
intensity fmax<255(L), then fmin and fmax are scaled/stretched to 0
and 255 respectively, thus enhancing the contrast

• For the input image, perform contrast stretching


Histogram Processing – Contrast
Enhancement
• The histogram of a digital image with intensity levels in the range
[0, L-1] is a discrete function h(rk)= nk where rk is the kth intensity
value and nk is the number of pixels in the image with intensity rk.
Histogram Equalization
• Algorithm
Step 1: Compute a running sum of histogram values.
Step 2: Normalize by dividing by total number of pixels.
Step 3 : Multiply these values by the maximum gray – level values and
then round the result to the closet integer
Step 4 : Map the original values to the results from step3 by a one –to-
one correspondence.
Problem -1
• Perform histogram equalisation of the image
Problem -1
• Perform histogram equalisation of the image
Spatial Filtering
• Spatial filtering involves passing a weighted mask, or kernel over the
image.
• Followed by replacing the original image pixel value corresponding
to the centre of the kernel with the sum of the original pixel values
in the region corresponding to the kernel multiplied by the kernel
weights.
Spatial Filtering – Linear Operations
Linear Filtering
• In linear filtering, each pixel in the input image is replaced by a
linear combination of intensities of neighbouring pixels.
• Linear filtering can be used to smoothen an image as well as
sharpen the image.
• Image Smoothening is equivalent as low pass filtering of the image

• Image Sharpening is equivalent as high pass filtering of the image


Mean Filter or Averaging Filter or Low-pass
Filter
• The mean filter replaces each pixel by the average of all the values
in the local neighbourhood.
• The size of the neighbourhood controls the amount of filtering.
• The low-pass filter preserves the smooth region in the image and it
removes the sharp variations leading to blurring effect.
Low Pass Filter Masks
Results of Image Smoothening filters
Gaussian Filter
• Gaussian filters are a class of linear smoothing filters with the
weights chosen according to the shape of a Gaussian function.
• The Gaussian kernel is widely used for smoothing purpose.
• A Gaussian filter can be generated from PASCAL’s triangle
Gaussian Filtering
HIGH-PASS FILTERING (or) IMAGE
SHARPENING
• The main aim of image sharpening is to highlight fine details in the
image.
• Image sharpening is used to enhance the high-frequency
components.
High Pass Filtering – Some results
Original Image Sharpened Image

Filter/kernel
Spatial Filtering - Numerical
• Perform Image Smoothening/Mean/Average/Low Pass filtering of
the given image matrix. Try using a 3x3 kernel for your operation.

6
Spatial Filtering - Numerical
• Perform Image Sharpening/High pass filtering of the given image
matrix. Try using a 3x3 kernel for your operation.

6
Order-Statistic (Non-linear) Filters
• Order-statistic filters are nonlinear spatial filters that rank pixels in
the image region and replace the centre pixel value with the ranking
result.
• The widely used Non-linear filters are:
• Median Filter (50th percentile)
• Minimum Filter (0th percentile)
• Maximum Filter (100th percentile)
Median Filtering (Non-Linear)
• All pixels in the neighborhood of the pixel in the original image
which are identified by the mask are sorted in the ascending (or)
descending order.
• The median of the sorted value is computed and is chosen as the
pixel value for the processed image.
Minimum Filters
• All pixels in the neighborhood of the pixel in the original image
which are identified by the mask are sorted in the ascending (or)
descending order.
• 0th percentile results in the so-called Min filter
• This filter is useful for finding the darkest points in an image.
Maximum Filters
• All pixels in the neighborhood of the pixel in the original image
which are identified by the mask are sorted in the ascending (or)
descending order.
• 100th percentile results in the so-called max filter
• This filter is useful for finding the brightest points in an image.
Order Statistic Filter - Results

Circuit Board Image with Median Filtering Max Filtering Min Filtering
Salt and Pepper Noise (kernel size 3×3) (kernel size 3×3) (kernel size 3×3)
Order Statistic Filter - Numerical
Perform Median filtering of the given input image matrix.
• Compute the median value of the marked pixel. Try using 3x3 mask
Order Statistic Filter - Numerical
Perform Median filtering of the given input image matrix.
• Compute the median value of the marked pixel. Try using 3x3 mask
Geometric Transforms / Spatial Transformation
• As the name implies, it means changing the
geometry of an image.
• Geometric transforms permit the elimination
of geometric distortion that occurs when an
image is captured.
• A spatial transformation of an image is a
geometric transformation of the image
coordinate system.
• In a spatial transformation each point (x, y) of
image A is mapped to a point (u, v) in a new
coordinate system.
TRANSLATION
ROTATION
SCALING
SHEARING
WHY GEOMETRIC TRANSFORMATION ?
APPLICATION OF GEOMETRIC
TRANSFORMATION
Image Interpolation
• Image interpolation is the process of estimating the values of an
image at locations that are not part of the original pixel grid.
• Image interpolation is a useful tool for image processing and
computer vision, but it also has some limitations.
• It cannot create new details or information that are not present in
the original image, and it can introduce errors or artifacts in the
interpolated image.
Image Interpolation
• It is often used for tasks such as resizing, rotating, or distorting an
image.
• Image interpolation can be done using different methods, such as
nearest neighbor, linear, bilinear, cubic, or spline interpolation.
• Bilinear interpolation is used to compute an output pixel value
based on a weighted average of its four nearest pixels. It is mainly
used when scaling up an image, rotating it, or performing 3D
rendering.
Image Interpolation - Example
Nearest Neighbours Interpolation
Linear Interpolation
Bi-Linear Interpolation
• Bilinear interpolation is an extension of the linear interpolation for
interpolating functions of the two variables (x and y) on a 2D grid.
• The key idea is to perform linear interpolation first in one direction,
and then in the other direction.
• It considers the closest n×n neighborhood of known pixel values
surrounding an unknown pixel.
• It then takes the weighted average of these 4 pixels to arrive at the
final interpolated value.
How Bilinear Interpolation Works
Try this!

You might also like