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

Lecture 05 2

The document discusses various image enhancement techniques focusing on point processing methods, including negative images, thresholding, logarithmic transformations, and power law transforms. It explains pixel connectivity, adjacency types, and distance measures relevant to image processing. Additionally, it covers spatial domain enhancements such as contrast stretching, gray-level slicing, and bit-plane slicing to improve image quality and highlight specific features.

Uploaded by

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

Lecture 05 2

The document discusses various image enhancement techniques focusing on point processing methods, including negative images, thresholding, logarithmic transformations, and power law transforms. It explains pixel connectivity, adjacency types, and distance measures relevant to image processing. Additionally, it covers spatial domain enhancements such as contrast stretching, gray-level slicing, and bit-plane slicing to improve image quality and highlight specific features.

Uploaded by

Maryum Azam
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 62

Contents

• In this lecture we will look at image enhancement


point processing techniques:
– What is point processing?
– Negative images
– Thresholding
– Logarithmic transformation
– Power law transforms
– Grey level slicing
– Bit plane slicing
Some Basic Relationships Between Pixels

• Definitions:

– f(x,y): digital image


– Pixels: q, p
– Subset of pixels of f(x,y): S
Neighbors of a Pixel

• A pixel p at (x,y) has 2 horizontal and 2


vertical neighbors:

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

– This set of pixels is called the 4-neighbors of p:


N4(p)
Neighbors of a Pixel

• The 4 diagonal neighbors of p are: (ND(p))

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

• N4(p) + ND(p)  N8(p): the 8-neighbors of p


Connectivity

• Connectivity between pixels is important:

– Because it is used in establishing boundaries of objects


and components of regions in an image
Connectivity

• Two pixels are connected if:

– They are neighbors (i.e. adjacent in some sense -- e.g.


N4(p), N8(p), …)
– Their gray levels satisfy a specified criterion of similarity
(e.g. equality, …)

• V is the set of gray-level values used to define adjacency (e.g.


V={1} for adjacency of pixels of value 1)
Adjacency

• We consider three types of adjacency:

– 4-adjacency: two pixels p and q with values from V are 4-


adjacent if q is in the set N4(p)

– 8-adjacency : p & q are 8- adjacent if q is in the set N8(p)


Adjacency

• The third type of adjacency:

– m-adjacency: p & q with values from V are m-


adjacent if

• q is in N4(p) or
• q is in ND(p) and the set N4(p)N4(q) has no pixels with values
from V
Adjacency

• Mixed adjacency is a modification of 8-adjacency and


is used to eliminate the multiple path connections
that often arise when 8-adjacency is used.

0 1 1 0 1 1 0 1 1
0 1 0 0 1 0 0 1 0
0 0 1 0 0 1 0 0 1
Adjacency

• Two image subsets S1 and S2 are adjacent if some pixel in S1 is


adjacent to some pixel in S2.
Connectivity

• For any pixel p in S, the set of pixels in S that


are connected to p is a connected component of
S.

• If S has only one connected component then S


is called a connected set.
Boundary

• R a subset of pixels: R is a region if R is a


connected set.
• Its boundary (border, contour) is the set of pixels in
R that have at least one neighbor not in R
• Edge can be the region boundary (in binary images)
Distance Measures
• For pixels p,q,z with coordinates (x,y), (s,t), (u,v), D
is a distance function or metric if:

– D(p,q) ≥ 0 (D(p,q)=0 iff p=q)


– D(p,q) = D(q,p) and
– D(p,z) ≤ D(p,q) + D(q,z)
Distance Measures

• Euclidean distance:

– De(p,q) = [(x-s)2 + (y-t)2]1/2

– Points (pixels) having a distance less than or equal to r


from (x,y) are contained in a disk of radius r centered at
(x,y).
Distance Measures

• D4 distance (city-block distance):

– D4(p,q) = |x-s| + |y-t|


– forms a diamond centered at (x,y)
– e.g. pixels with D4≤1 from p
2
2 1 2
2 1 0 1 2
2 1 2
D4 = 1 are the 4-neighbors
2 of p
Distance Measures

• D8 distance (chessboard distance):

– D8(p,q) = max(|x-s|,|y-t|)
– Forms a square centered at p
– e.g. pixels with D8≤2 from p
2 2 2 2 2
2 1 1 1 2
2 1 0 1 2 D8 = 1 are the 8-neighbors
2 1 1 1 2 of p
2 2 2 2 2
Distance Measures

• D4 and D8 distances between p and q are independent


of any paths that exist between the points because
these distances involve only the coordinates of the
points (regardless of whether a connected path exists
between them).
Distance Measures
• However, for m-connectivity the value of the
distance (length of path) between two pixels
depends on the values of the pixels along the path
and those of their neighbors.
Distance Measures
• e.g. assume p, p2, p4 = 1
p1, p3 = can have either 0 or 1

If only connectivity of pixels valued


p3 1 is allowed, and p1 and p3 are 0,
the m- distance between p and p4
is 2.
p4
If either p1 or p3 is 1, the distance
p1 is 3.

If both p1 and p3 are 1, the distance


p2 p is 4 (pp1p2p3p4)
Basic Spatial Domain Image Enhancement
•Most spatial domain enhancement operations can be
Origin x
reduced to the form
• g (x, y) = T[ f (x, y)]
•where f (x, y) is the
input image, g (x, y) is
(x, y)
the processed image
and T is some
operator defined over
some neighbourhood
of (x, y) y Image f (x, y)
Point Processing
• The simplest spatial domain operations occur
when the neighbourhood is simply the pixel itself
• In this case T is referred to as a grey level
transformation function or a point processing
operation
•Point processing operations take the form
•s = T ( r )
•where s refers to the processed image pixel value
and
r refers to the original image pixel value
Point Processing Example: Negative Images

• 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

Original Negative
s = 1.0 - r
Image Image
Point Processing Example: Negative Images
(cont…)
Original Image Enhanced Image x
x

y Image f (x, y) y Image f (x, y)

s = intensitymax - r
Point Processing Example: Thresholding

• Thresholding transformations are particularly


useful for segmentation in which we want to isolate an
object of interest from a background

1.0 r > threshold


s=
0.0 r <= threshold
Point Processing Example: Thresholding (cont…)

Original Image Enhanced Image x


x

y Image f (x, y) y Image f (x, y)

1.0 r >
s=
threshold
0.0 r <= threshold
Intensity Transformations
Basic Grey Level 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
• nth
power/nth
root
Basic Grey Level Transformations
Logarithmic Transformations
•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 (Darker regions) values into
a wider range of output values
• The inverse log transformation performs the
opposite transformation
•Log transformation is a non-linear image processing
technique
Logarithmic Transformations

These transformations help by compressing


high-intensity values and expanding low-intensity
values, improving the visibility of details.

log(1+r) ensures no log(0) (which is undefined)


Power Law Transformations
Power law transformations have the following form
s=c*rγ
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
Power Law Example
Power Law Example (cont…)
γ = 0.6
1
0.
9
0.
8
Tran sform ed In

0.
7
0.
tensities

6
0.
5
0.
40 0.2 0.4 0.6 1
0.8
0.
3 Old Intensities
0.
2
0.
1
0
Power Law Example (cont…)
γ = 0.4
1
0.9
Transformed Intensities

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

0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
0 0.2 0.4 0.6 0.8 1
Original
Intensities
Power Law Example (cont…)
• The images
to the right show a s = r 0.6
magnetic resonance
(MR) image of a
fractured human

s = r 0.4
spine
• Different
curves highlight
different detail
Power Law Example
Power Law Example (cont…)

γ = 5.0
1
0.9
Transformed Intensities

0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
0 0.2 0.4 0.6 0.8 1
Original
Intensities
Power Law Transformations (cont…)
•An aerial photo
of a runway is
shown s = r 3.0
•This time
power law
transforms are
s = r 4.0
used to darken
the image
•Different curves
highlight
different detail
Piecewise Linear Transformation Functions

1.Contrast Stretching
2.Gray Level Slicing
3.Bit Plane Slicing
Contrast Stretching
Increase the dynamic range
of the gray levels in the
image
(b) a low-contrast image :
result from poor
illumination, lack of dynamic
range in the imaging sensor,
or even wrong setting of a
lens aperture of image
acquisition
(c) result of contrast
stretching: (r1,s1) = (rmin,0)
and (r2,s2) = (rmax,L-1)
(d) result of thresholding
Gray-level slicing Highlighting a specific
range of gray levels in an
image
Display a high value
of all gray levels in
the range of
interest and a low
value for all other
gray levels
Transformation highlights
range [A,B] of gray level
and reduces all others to
a constant level
Transformation highlights
range [A,B] but preserves
all other levels
Gray Level Slicing
•Highlights a specific range of grey
levels
– Similar to thresholding
– Other levels can be
suppressed or maintained
– Useful for highlighting features
in an image
Bit-plane slicing

Highlighting the contribution made to


total image appearance by specific bits
One 8-bit byte Bit-plane 7 Suppose each pixel is represented by 8
(most significant) bits
Higher-order bits contain the majority of
the visually significant data
Useful for analyzing the relative
importance played by each bit of the
image
Bit-plane 0 Useful for compression
(least significant)

45
8 bit planes

Bit-plane 7 Bit-plane 6

Bit- Bit- Bit-


plane 5 plane 4 plane 3

Bit- Bit- Bit-


plane 2 plane 1 plane 0

47
Bit Plane Slicing
• 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 (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…)
Reconstruct
ed image
Bit Plane Slicing (cont…) 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
Home Work (Compete Two Cases)
Home Work (Cases 1 When c=1)
Home Work (Cases 2)

You might also like