0% found this document useful (0 votes)
10 views

DIP Unit 2

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

DIP Unit 2

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

Gray Level Transformation

All Image Processing Techniques focused on gray level transformation as it


operates directly on pixels. The gray level image involves 256 levels of gray
and in a histogram, horizontal axis spans from 0 to 255, and the vertical axis
depends on the number of pixels in the image.

The simplest formula for image enhancement technique is:

S=T*r

Where T is transformation, r is the value of pixels, s is pixel value before and


after processing.

Let,

R = f(x,y)

S = g(x,y)

‘r’ and ‘s’ are used to denote gray levels of f and g at(x,y)

There are three types of transformation:

1. Linear
2. Logarithmic
3. Power – law

The overall graph is shown below:


Linear Transformation
The linear transformation includes identity transformation and negative
transformation.

In identity transformation, each value of the image is directly mapped to


each other values of the output image.

Negative transformation is the opposite of identity transformation. Here,


each value of the input image is subtracted from L-1 and then it is mapped
onto the output image

Logarithmic transformations
Logarithmic transformation is divided into two types:

1. Log transformation
2. Inverse log transformation

The formula for Logarithmic transformation

S = c log(r + 1)

Here, s and r are the pixel values for input and output image. And c is
constant. In the formula, we can see that 1 is added to each pixel value this
is because if pixel intensity is zero in the image then log(0) is infinity so, to
have minimum value one is added.

When log transformation is done dark pixels are expanded as compared to


higher pixel values. In log transformation higher pixels are compresses.

Power – Law transformations


Power Law Transformation is of two types of transformation nth power
transformation and nth root transformation.

Formula:

S = cr ^ γ

Here, γ is gamma, by which this transformation is known as gamma


transformation.

All display devices have their own gamma correction. That is why images are
displayed at different intensity.

These transformations are used for enhancing images.


Histogram Processing
Histogram processing is a technique in digital image processing that involves
the manipulation of an image’s histogram to enhance its appearance. Here’s
a detailed explanation:

What is a Histogram?
A histogram is a graphical representation of the distribution of pixel intensity
values in an image. The horizontal axis represents the intensity values (from
0 to 255 for an 8-bit image), and the vertical axis represents the frequency of
these values.

Key Histogram Processing Techniques

1. Histogram Equalization
 Purpose: Enhances the contrast of an image by spreading out the
most frequent intensity values.
 How it Works: It transforms the intensity values so that the
histogram of the output image is approximately uniform. This is
achieved by using the cumulative distribution function (CDF) of
the pixel values.
 Applications: Useful in medical imaging, satellite imagery, and
other fields where contrast enhancement is crucial.
2. Histogram Matching (Specification)
 Purpose: Adjusts the histogram of an image to match a specified
histogram.
 How it Works: It involves transforming the pixel values of the
input image so that its histogram matches the histogram of a
reference image.
 Applications: Used in image comparison and quality control.
3. Histogram Stretching
 Purpose: Increases the contrast of an image by stretching the
range of intensity values.
 How it Works: It linearly scales the pixel values to cover the full
intensity range (0 to 255 for an 8-bit image).
 Applications: Enhances images with low contrast due to poor
lighting conditions
4. Histogram Sliding
 Purpose: Adjusts the brightness of an image.
 How it Works: It shifts the histogram to the right or left,
increasing or decreasing the brightness of the image.
 Applications: Useful for correcting images that are too dark or too
bright.

Applications of Histogram Processing


 Image Enhancement: Improves the visual quality of images.
 Image Segmentation: Helps in separating objects from the
background.
 Image Compression: Reduces the amount of data required to
represent an image.
 Real-Time Processing: Used in applications like video surveillance
and medical imaging.

Enhancement using Arithmetic / Logic operations


Enhancement using arithmetic and logical operations involves manipulating
pixel values of images through basic arithmetic and logical functions to
improve their visual quality or extract useful information. Here are some
common techniques:

Arithmetic Operations
Arithmetic operations involve basic mathematical calculations applied to the
pixel values of an image. These operations are useful for tasks like blending,
masking, noise reduction, and brightness adjustments.

1. Image Addition:
Adds the pixel values of two images. This can be used to increase the
brightness of an image or blend two images together.
Formula : s(x, y) = f(x, y) + g(x, y)
Where f(x, y) and g(x, y) are the pixel values of two images at
coordinates (x, y), and s(x, y) is the output pixel value.
2. Image Subtraction:
Subtracts the pixel values of one image from another, useful for
detecting changes between images or highlighting differences (e.g.,
background subtraction in motion detection).
Formula : s(x, y) = f(x, y) – g(х,у)
Where s(x, y) is the resulting image, highlighting only the changes.
3. Image Multiplication (Scaling):
Multiplies pixel values by a constant, often used to adjust the contrast
or intensity levels in an image.
Formula:S(x, y) = c × f(x, y)
Where c is a constant multiplier.
4. Image Division:
Divides the pixel values of an image by another image or a constant,
used for normalization or to create effects like shading correction.
Formula: s(x, y) = f(x,y)/ g(x,y)

Logical Operations
Logical operations involve bitwise operations on pixel values, such as AND,
OR, XOR, and NOT. These are especially useful for creating masks,
segmenting regions, or combining images in a specific manner.

Types of Logical Operations:


AND Operation:

Used for masking, where only the common (overlapping) parts of two images
are kept.

Formula: s(x,y) = f(x, y)&g(x, y)

OR Operation:

Combines two images by including pixels from either image, useful for
merging different regions of interest.

Formula: s(x, y) = f(x, y)|g(x, y)

XOR Operation:

Highlights differences between two images, often used in change detection


or edge detection.

Formula: s(x, y) = f(x, y) ^ g(x, y)

NOT Operation:

Inverts the pixel values of an image, creating a negative effect. This


operation is often used for highlighting.

Formula: s(x, y) = ! f(x, y)

Spatial Filtering
Spatial Filtering technique is used directly on pixels of an image. Mask is
usually considered to be added in size so that it has specific center pixel.
This mask is moved on the image such that the center of the mask traverses
all image pixels.
What is a Spatial Filter?
A spatial filter is a digital signal processing technique used to manipulate
images, by removing or enhancing specific frequency components or spatial
frequencies. It is a type of image filtering aimed at spatially filtering an
image, which means filtering pixels based on its surrounding pixels. Spatial
filtering is a common technique in image processing, where it is used to
enhance the quality of images, remove noise, or extract specific features.

Spatial filters are used in various applications, including medical imaging,


satellite imagery, and security surveillance. In medical imaging, spatial filters
are used to enhance specific features in medical images, allowing medical
professionals to better detect abnormalities. In satellite imagery, spatial
filters can be used to remove atmospheric noise and improve image quality.
In security surveillance, spatial filters can help detect suspicious activity by
enhancing the edges of objects in a video stream.

Types of Spatial Filters


1. Smoothing Filters (Low-pass filters): These reduce noise and small
details in an image.
 Mean Filter: Averages the pixel values in a neighborhood,
reducing high-frequency noise.
 Gaussian Filter: Uses a Gaussian kernel to provide a weighted
average, often giving a more natural blur.
2. Sharpening Filters (High-pass filters): These highlight edges and
details.
 Laplacian Filter: Enhances edges by using the second derivative
of pixel values, highlighting areas with rapid intensity change.
 Sobel Filter: Detects edges by approximating the gradient of the
image intensity, usually in horizontal and vertical directions.
3. Edge Detection Filters: Specialized filters to detect edges in different
directions, such as vertical or horizontal, which are important in object
recognition.
 Prewitt and Roberts Filters: Simple gradient operators for edge
detection.

How Does a Spatial Filter Work?


Spatial filters work by applying a convolution operation to an image, which is
a mathematical operation that involves multiplying each pixel in an image by
a fixed kernel. The kernel is a small matrix that is used to modify the values
of the pixels in an image based on their surrounding pixels. The values in the
kernel are determined by the type of filter being used and the desired effect.

Spatial filters can be used to enhance certain aspects of an image, such as


its edges or details, or to remove unwanted features, such as noise or blur.
Different types of spatial filters include mean filters, Gaussian filters, median
filters, and Laplacian filters. Each type of filter has a specific purpose and can
be used to achieve different effects.

You might also like