IIP Lecture - 03 Pointt Processinggg.pdf

danishnawaz398 16 views 88 slides Aug 31, 2025
Slide 1
Slide 1 of 88
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43
Slide 44
44
Slide 45
45
Slide 46
46
Slide 47
47
Slide 48
48
Slide 49
49
Slide 50
50
Slide 51
51
Slide 52
52
Slide 53
53
Slide 54
54
Slide 55
55
Slide 56
56
Slide 57
57
Slide 58
58
Slide 59
59
Slide 60
60
Slide 61
61
Slide 62
62
Slide 63
63
Slide 64
64
Slide 65
65
Slide 66
66
Slide 67
67
Slide 68
68
Slide 69
69
Slide 70
70
Slide 71
71
Slide 72
72
Slide 73
73
Slide 74
74
Slide 75
75
Slide 76
76
Slide 77
77
Slide 78
78
Slide 79
79
Slide 80
80
Slide 81
81
Slide 82
82
Slide 83
83
Slide 84
84
Slide 85
85
Slide 86
86
Slide 87
87
Slide 88
88

About This Presentation

image process


Slide Content

Image Enhancement
(Point Processing)
Syed Ali Zamin
1

In this lecture we will look at image enhancement point
processing techniques:
Connectivity & Relationship b/w Pixels
What is Image Processing
What is point processing?
Negative images
Thresholding
Logarithmic transformation
Power law transforms
Grey level slicing
Bit plane slicing
Contents

Process an image to make the result more suitable than the
original image for a specific application
–Image enhancement is subjective (problem /application oriented)
Image enhancement methods:
Spatial domain: Direct manipulation of pixel in an image (on
the image plane)
Frequency domain: Processing the image based on modifying the
Fourier transform of an image
Many techniques are based on various combinations of methods from
these two categories
3
What is Image Enhancement

Relationship Between Pixels

Establishingboundariesofobjectsandcomponentsof
regionsinanimage.
Groupthesameregionbyassumptionthatthepixels
beingthesamecolororequalintensitywillhavethe
sameregion
Twopixelsmaybefourneighbors,buttheyaresaid
tobeconnectedonlyiftheyhavethesamevalue
(graylevel)
Connectivity

6
Basic Relationship b/w Pixels

7
Basic Relationship b/w Pixels

8
Basic Relationship b/w Pixels

9
Basic Relationship b/w Pixels

So far when we have spoken about image grey level
values we have said they are in the range [0, 255]
Where 0 is black and 255 is white
There is no reason why we have to use this range
The range [0,255] stems from display technologes
For many of the image processing operations in this
lecture grey levels are assumed to be given in the range
[0.0, 1.0]
A Note About Grey Levels

Image enhancement is the process of making images
more useful
The reasons for doing this include:
Highlighting interesting detail in images
Removing noise from images
Making images more visually appealing
What Is Image Enhancement?

Image Enhancement Examples

Image Enhancement Examples (cont…)

Image Enhancement Examples (cont…)

Image Enhancement Examples (cont…)

There are two broad categories of image enhancement
techniques
Spatial domain techniques
Direct manipulation of image pixels
Frequency domain techniques
Manipulation of Fourier transform or wavelet transform of an
image
For the moment we will concentrate on techniques that
operate in the spatial domain
Spatial & Frequency Domains

Process an image to make the result more suitable than the
original image for a specific application
–Image enhancement is subjective (problem /application oriented)
Image enhancement methods:
Spatial domain: Direct manipulation of pixel in an image (on
the image plane)
Frequency domain: Processing the image based on modifying the
Fourier transform of an image
Many techniques are based on various combinations of methods from
these two categories
Image Engancement

18
Image Enhancement

Spatial domain enhancement methods can be generalized as
g(x,y)=T[f(x,y)]
f(x,y):input image
g(x,y):processed (output) image
T[*]:an operator on f (or a set of input images),
defined over neighborhood of (x,y)
Neighborhood about (x,y):a square or rectangular
sub-image area centered at (x,y)
19
Some Basic Concepts

20
Some Basic Concepts

g(x,y) = T [f(x,y)]
Pixel/point operation:
Neighborhood of size 1x1: g depends only on f at (x,y)
T:a gray-level/intensity transformation/mapping function
Let r = f(x,y) s = g(x,y)
r and s represent gray levels of f and g at (x,y)
Then s = T(r)
Local operations:
g depends on the predefined number of neighbors of f at (x,y)
Implemented by using mask processing or filtering
Masks (filters, windows, kernels, templates) :
a small (e.g. 3×3) 2-D array, in which the values of the
coefficients determine the nature of the process
Some Basic Concepts

The simplest spatial domain operations occur when the
neighbourhood is simply the pixel itself
In this case Tis referred to as a grey level transformation
function or a point processing operation
Point processing operations take the form
s = T ( r )
where srefers to the processed image pixel value and r
refers to the original image pixel value
Point Processing

23
▪Image Negatives
▪Log Transformations
▪Power-Law Transformations
Common Pixel Operations

Negative images are useful for enhancing white or grey detail
embedded in dark regions of an image
Note how much clearer the tissue is in the negative image of the
mammogram below
Point Processing Example:
Negative Images
Original
Image
Negative
Image

Negative Images

Point Processing Example:
Negative Images (cont…)
Original Image
x
y Image f (x, y)
Enhanced Image
x
y Image f (x, y)
s = intensity
max-r
▪For L gray levels the transformation function is
s =T(r) = (L -1) -r

Thresholding transformations are particularly useful for
segmentation in which we want to isolate an object of
interest from a background
Image Thresholding isan intensity transformation function in
which the values of pixels below a particular threshold are
reduced, and the values above that threshold are boosted
Point Processing Example:
Thresholding
s =
255
0 r <= threshold
r > threshold

Pixels are either classified as "foreground" (object of interest) or
"background" (everything else), based on their intensity values
Some common thresholding techniques include:
•Global Thresholding: A single threshold value is applied to the entire
image.
•Adaptive Thresholding: Different threshold values are used for different
regions of the image, allowing for better handling of variations in
illumination.
•Otsu's Thresholding: Automatically calculates an optimal threshold
value based on the image histogram, aiming to minimize intra-class
variance.
•Edge-based Thresholding: Thresholding based on edge detection results,
useful for detecting objects with well-defined edges.
•Color Thresholding: Extending thresholding to color images by applying
thresholds separately to different color channels.
Point Processing Thresholding continue…

Point Processing Example:
Thresholding

Point Processing Example:
Thresholding (cont…)
Original Image
x
y Image f (x, y)
Enhanced Image
x
y Image f (x, y)
s =
0 r <= threshold
255 r > threshold

Intensity Transformations

There are many different
kinds of grey level
transformations
Three of the most
common are shown
here
Linear
Negative/Identity
Logarithmic
Log/Inverse log
Power law
n
th
power/n
th
root
Basic Grey Level Transformations

s =T(r) = a.r(a is a constant)
Image Scaling

Image Scaling

The general form of the log transformation is
s = c * log(1 + r)
The log transformation maps a narrow range of low input
grey level values into a wider range of output values
The inverse log transformation performs the opposite
transformation
Log functions are particularly useful when the input grey
level values may have an extremely large range of values
Logarithmic Transformations

Logarithmic Transformations (cont…)

08/01/201837
Properties of log transformations
–For lower amplitudes of input image the range of gray levels is
expanded
–For higher amplitudes of input image the range of gray levels is
compressed
Application:
This transformation is suitable for the case when the dynamic
range of a processed image far exceeds the capability of the
display device (e.g. display of the Fourier spectrum of an
image)
Also called “dynamic-range compression / expansion”
Logarithmic Transformations

Logarithmic Transformations (cont…)
Original Image
x
y Image f (x, y)
Enhanced Image
x
y Image f (x, y)
s = log(1 + r)
We usually set cto 1
Grey levels must be in the range [0.0, 1.0]

Power law transformations have the following form
 s = c * r
γ
c & γ must be positive
Map a narrow range
of dark input values
into a wider range of
output values or vice
versa
Varying γgives a whole
family of curves
Power Law Transformations

We usually set cto 1
Grey levels must be in the range [0.0, 1.0]
Power Law Transformations (cont…)
Original Image
x
y Image f (x, y)
Enhanced Image
x
y Image f (x, y)
s = r
γ

For γ < 1:Expands values of dark pixels,
compress values of brighter pixels
For γ > 1:Compresses values of dark pixels,
expand values of brighter pixels
If γ=1 & c=1:Identity transformation (s = r)
A variety of devices (image capture, printing, display) respond
according to power law and need to be corrected
Gamma (γ) correction
The process used to correct the power-law response phenomena
Power Law Transformations (cont…)

Power Law Example

Power Law Example (cont…)
γ = 0.60
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
0 0.2 0.4 0.6 0.8 1
Old Intensities
Transformed Intensities

Power Law Example (cont…)
γ = 0.40
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
0 0.2 0.4 0.6 0.8 1
Original Intensities
Transformed Intensities

Power Law Example (cont…)
γ = 0.30
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
0 0.2 0.4 0.6 0.8 1
Original Intensities
Transformed Intensities

The images to the
right show a
magnetic resonance
(MR) image of a
fractured human
spine
Different curves
highlight different
detail
Power Law Example (cont…)

Power Law Example
γ = 1.0

Power Law Example (cont…)
γ = 3.0

Power Law Example (cont…)
γ = 4.0

Power Law Example (cont…)
γ = 5.00
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
0 0.2 0.4 0.6 0.8 1
Original Intensities
Transformed Intensities

An aerial photo
of a runway is
shown
This time
power law
transforms are
used to darken
the image
Different curves
highlight
different detail
Power Law Transformations (cont…)

52
Power Law Transformations (cont…)

Gamma Correction
Problem: CRT display devices do not respond linearly to different intensities

More Contrast Issues

More Contrast Issues

Piecewise Linear Transformation
It involves dividing the intensity range of the image into multiple
segments and applying a linear transformation to each segment
individually.
1.Dividing the Intensity Range: The first step is to divide the intensity range
of the image into multiple segments
2.Defining Transformation Functions: For each segment, a linear
transformation function is defined. This function maps the intensity values
within that segment to new values, adjusting the contrast as desired. These
transformation functions can be simple linear equations or more complex
functions
3.Applying Transformations:
4.Combining Results:

Piecewise Linear Transformation
Contrast Stretching
Is type of gray level transformation that is used for image enhancement. It is a spatial domain
method. It is usedfor manipulation of an image so that the result is more suitable than the
original for a specific application.
Goal:
Increase the dynamic range of the gray levels for low
contrast images
Low-contrast images can result from
–poor illumination
–lack of dynamic range in the imaging sensor
–wrong setting of a lens aperture during image acquisition

Contrast Stretching [continue…]
Contrast stretching, also known as histogram stretching or
normalization, is a basic image enhancement technique used to
improve the contrast in an image by expanding the range of
intensity values. The goal of contrast stretching is to utilize the
entire dynamic range of pixel values available in the image,
thereby increasing the visual separation between different
objects or features in the image.
The process of contrast stretching involvesmapping the original
intensity values of the image to a new range of values. This is
typically done by linearly scaling the intensity values from their
original range to a new range, often spanning from 0 to 255 (for an
8-bit grayscale image).

Formula:
sis the processed pixel,ris the actual pixel,ais the
lowest intensity value and bis the highest intensity value
for an image according to bit representation. For a 8-bit
image, a and b are respectively 0 and 255. Moreover,cis
the lowest intensity value anddis the highest intensity
value exists in the image. So the image is normalized.
Formula:

Contraststretching (Python)
import cv2
import numpyas np
def contrast_stretching(image):
# Convert the image to grayscale
gray_image= cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
# Compute the minimum and maximum pixel values
min_val= np.min(gray_image)
max_val= np.max(gray_image)
# Compute the range of pixel values
pixel_range= max_val-min_val
# Apply contrast stretching
stretched_image= ((gray_image-min_val) / pixel_range) * 255
# Convert the pixel values back to uint8
stretched_image= stretched_image.astype(np.uint8
return stretched_image
# Read the input image
input_image= cv2.imread('input_image.jpg')
# Apply contrast stretching
output_image= contrast_stretching(input_image)

Contrast Stretching

62
Contrast Stretching

Highlights a specific range of grey levels
Similar to thresholding
Other levels can be
suppressed or maintained
Useful for highlighting features
in an image
Gray Level Slicing

Gray level slicing, also known as intensity level slicing or gray
value slicing, is an image processing technique used to
highlight specific intensity ranges within a grayscale image
while suppressing the rest. It involves selectively enhancing
or suppressing certain gray levels to emphasize particular
features or regions of interest in the image.

Often by isolating particular bits of the pixel values in an
image we can highlight interesting aspects of that image
Higher-order bits usually contain most of the significant
visual information
Lower-order bits contain
subtle details
Bit Plane Slicing

Bit Plane Slicing
Binary Representation: each pixel's intensity value is typically
represented in binary form. For example, an 8-bit grayscale image
has pixels represented by 8 bits, with each bit representing a
different power of 2
Bit Plane Extraction: Bit plane slicing involves isolating each bit
from the binary representation of the pixel values.
Visualization: Lower bit planes tend to capture finer details and
noise, while higher bit planes capture broader features and
structures.
Applications: image compression, lower bit planes with less
significant information can be discarded or quantized with fewer
bits to achieve compression.

Bit Plane Slicing (cont…)
[10000000]
[01000000]
[00100000] [00001000]
[00000100] [00000001]

Bit Plane Slicing (cont…)

Bit Plane Slicing (cont…)

Bit Plane Slicing (cont…)

Bit Plane Slicing (cont…)

Bit Plane Slicing (cont…)

Bit Plane Slicing (cont…)

Bit Plane Slicing (cont…)

Bit Plane Slicing (cont…)

Bit Plane Slicing (cont…)

Bit Plane Slicing (cont…)

Bit Plane Slicing (cont…)
Reconstructed image using
only bit planes 8 and 7
Reconstructed image using
only bit planes 8, 7 and 6
Reconstructed image using
only bit planes 7, 6 and 5

A Different Problem

Lets Double the Size

Interpolation
Nearest Neighbor

What Happens When Tripling

Is There a Better Method
Interpolation: Bi-Linear

Is There be a Better Method

What Happens in 2D

Which is Better

Which is Better
Before Interpolation
Nearest Neighbor Bi-Linear
Original

No Interpolation
Fast as No Processing Required
Depends on only 2 Pixel
Results are Blocky
Cannot Create New Values
Not Recommended for Smooth
Data
New Value always inside the
boundary range
Interpolated
Slow due to Processing
Depends on 4 or more pixels
Smoother Gradients
Can Find New Values
Not Recommended for Categorical
Data
Value may or May not be outside
the boundary range
Tags