Sunteți pe pagina 1din 102

Module I : Introduction and Digital Image

Fundamentals

• Origin of Digital Image Processing


• Fundamental Steps of Image Processing, Components of
Digital Image Processing Systems
• Applications of Digital Image Processing
• Elements of Visual perception
• Image Acquisition systems
• Image Sampling and Quantization
• Types of Images
• Some basic relationships like Neighbors Connectivity, Regions
and Boundaries
• Distance Measures.
Digital Image Representation
Monochrome image can be represented as a
two dimensional light intensity function f(x, y)
where x & y are spatial coordinates and the value of
f at point (x, y) is the gray level of the image at that
pt.

28
The physical meaning of the image is
determined by the source of the image.

When an image is generated from a physical


source its intensity values are proportional to
energy radiated by a physical source.
So f(x,y) must be non zero and finite

0<f(x,y)<infinite
Function f(x,y) may be characterized by two
components
Illumination component- Amount of source
illumination incident on the scene
Reflectance component- Amount of illumination
reflected by the objects in the scene-

Let f(x,y) be an image function, then


f(x,y) = i(x,y) r(x,y),
where i(x,y): the illumination function
r(x,y): the reflection function
Note: 0 < i(x,y)< ∞ and
0 <r(x,y)< 1.
• For computer storage, an array with the number of gray levels being a
power of 2 is selected.

• A typical gray level image contains 256 shades of gray (8 bit)

• Values are stored between 0 - 255

f(x, y)
Gray Scale
The intensity of a monochrome image at any coordinate
(xi, yi) is called the
gray level (l) of the image at that point

l = f(xi, yi)
Lmin ≤ l ≤ Lmax

Common Practice – shift the interval numerically to the


interval [0, L-1].
l = 0 is considered black &
l = L-1 is considered white on the gray scale.
For digital images the minimum gray level is usually 0, but the maximum depends
on number of quantization levels used to digitize an image. The most common is
256 levels, so that the maximum level is 255.
O/P of most sensors is a continuous voltage waveform whose
amplitude & spatial behavior are related to the physical
phenomenon (e.g. brightness) being sensed.

For an image to be processed by a computer, it must be


represented by an appropriate discrete data structure (e.g.
Matrix)

So, to create a digital image continuous sensed data should


be converted into a digital form .

Two important processes to convert continuous analog


17/2/2011
image into digital image – 33
Process in which signals or data samples are
considered at regular intervals.

It is the discretization of image data in spatial


coordinates.

It is the discretization of image intensity (gray


level) values.
17/2/2011 34
Image Sampling and Quantization
Figure (b) is a one D function which is a plot of amplitude values
of the continuous image along the line segment AB in fig (a).

The random variations are due to image noise.

Samples are shown as small white squares superimposed on the


function. The set of these discrete locations gives the sampled
function.

Then the intensity values are converted (quantized) into discrete


quantities .
The continuous intensity levels are quantized by assigning one of
the eight values to each sample.

By Repeating this process line by line from top of the image can
generate a 2D digital image.
Image Sampling and Quantization
• Sampling: digitizing the 2-dimensional spatial coordinate values
• Quantization: digitizing the amplitude values (brightness level)

Accuracy in quantization is highly dependent on the noise content


of the sampled signal
Image sampled wrt x & y coordinates
N – no. of samples along x axis (i.e. no. of columns in the matrix)
M – no. of samples along y axis (i.e. no. of rows in the matrix)
Usually, M & N are powers of 2
M = 2m and N = 2n
The no. of gray level values, L, is also usually taken as power of 2
L = 2k

What is the no. of bits required to store a digitized


image???

b=MxNxk
If M = N, then
b = N2 k
17/2/2011 38
k-bit image
An image having 2k gray levels
An image having 256 gray levels is called a 8-bit image

8-bit images of size 1024 x 1024 or higher


Storage Requirement Not Insignificant !!!!
17/2/2011 39
Representing Digital Images
Image Coordinate system
Dynamic Range of an imaging system can be defined as the ratio
of the maximum measurable intensity to the minimum detectable
intensity level in the system.

Upper limit is determined by saturation level and lower limit by


noise(looks like a grainy texture pattern in dark area)

Saturation level is the highest value beyond which all the intensity
levels are clipped. Saturated area has a high contrast intensity level.

Contrast can be defined as a difference between highest and lowest


intensity levels in a n image.

When an appreciable no. of pixels in an image have a high dynamic


range , image is expected to have high contrast and if it has low
dynamic range then it has a dull washed our gray look
Spatial Resolution
It is the smallest discernible detail in an image
It can be expressed as dots(pixels) per unit
distance
Gray-level Resolution
It is the smallest discernible change in the gray
level of an image. (no. of bits needed to quantize
intensity)

L-level digital image of size M x N


Spatial resolution – M x N pixels
17/2/2011 Gray-level resolution – L levels 43
Fixed Gray-level ; Varying number of samples

17/2/2011 44
(a) & (b)
virtually impossible
to tell apart. The
level of detail lost
is too fine.

(c)
V slight fine
checkerboard pattern in
the borders & some
graininess throughout
the image

(d), (e), (f)


These effects much
more visible.

17/2/2011 45
Checkerboard Effect
When the no. of pixels in an image is reduced keeping
the no. of gray levels in the image constant, fine
checkerboard patterns are found at the edges of the
image. This effect is called the checker board effect.

False Contouring
When the no. of gray-levels in the image is low, the
foreground details of the image merge with the
background details of the image, causing ridge like
structures. This degradation phenomenon is known as
false contouring.
(The ridges resemble topographic contours in a map)
17/2/2011 46
Varying Gray-level ; Fixed number of samples

17/2/2011 47
False contouring

17/2/2011 48
2.5 Basic Relationships b/w pixels
•Neighbors of a pixel
•Adjacency
•Connectivity
•Regions
•Boundary
There are three kinds of neighbors of a pixel:
N4(p) 4-neighbors: the set of horizontal and vertical neighbors

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

ND(p) diagonal neighbors: the set of 4 diagonal neighbors

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

N8(p) 8-neighbors: union of 4-neighbors and diagonal


neighbors

O O O O O O
O X O X O X O
O O O O O O
17/2/2011 50
N4(p) ND(p) N8(p)

If pixel p (x, y) lies on the boundary, then some of


the neighbours of p will lie outside the digital
image.

17/2/2011 51
Two pixels that are neighbors and have the same grey-
level (or some other specified similarity criterion) are
adjacent

v= The set of gray-level values used to define


adjacency
In a gray-scale image, V typically contains more than one elements.
E.g. in an image of 265 gray-levels, V could be any subset of these
256 values.

In a binary image, V = {1} for finding the adjacency of a pixel with


value 1.
17/2/2011 52
Types of Adjacency
I) 4-adjacency
Two pixels p & q with values from V are
4-adjacent if q is in the set N4(p).

II) 8-adjacency
Two pixels p & q with values from V are
8-adjacent if q is in the set N8(p).

17/2/2011 53
III) m-adjacency (mixed adjacency)
Two pixels p & q with values from V are
m-adjacent if
a) q is in the set N4(p), or
b) q is in ND(p) and the set N4(p) ∩ N4(q) has
no pixels whose values are from V.

Mixed adjacency is a modification of


8-adjacency. It is used to eliminate ambiguities
that may arise when 8-adjacency is used.

17/2/2011 54
Find 8-adjacency & m-adjacency of
the pixel in the centre.
Note: V = {1}
17/2/2011 55
V = {1}
Fig (b) shows the ambiguity in 8-adjacency

17/2/2011 56
From pixel p with coordinates (x0, y0)
to pixel q with coordinates (xn, yn)
(x0, y0), (x1, y1), …, (xn, yn)
Where pixels (xi, yi) & (xi-1, yi-1) are adjacent for
1≤i≤n

n is the length of the path

If (x0, y0) = (xn, yn) then the path is closed


17/2/2011 57
Path can be 4-, 8- or m-path, depending upon the type
of adjacency specified.

Path between NE & SE pixels


8-path shown in (b) & m-path shown in (c)
Note: No ambiguity in m-path
17/2/2011 58
Connectivity
Connected in S
Let S – subset of pixels in an image.

Pixels p & q are said to be connected in S, if there exists


a path between them that completely lies within S.

connected component of S-The set of all pixels in S


that are connected to a given pixel in S.

If S has only one connected component, then S is


called a connected set.
17/2/2011 59
Region
R – subset of pixels in an image.

R is a region of an image if R is a connected set

Ri & Rj are adjacent if their union forms a connected


set; otherwise the regions are said to be disjoint.

1 1 0 0 1 1 Are the two regions


1 1 0 1 0 1 adjacent?
1 1 1 0 1 1
17/2/2011 60
Two image subsets S1 &
S2 are adjacent if some
pixel in S1 is adjacent to
some pixel in S2.
(adjacent means 4-, 8- or
m-adjacent)

17/2/2011 61
Boundary
The boundary (aka border or contour) of a region R is
the set of pixels in R that have one or more neighbours
that are not in R.

0 0 0 0 0
0 1 1 0 0
Is it a boundary pixel?
0 1 1 0 0
0 1 1 1 0
0 1 1 1 0
0 0 0 0 0
17/2/2011 62
Boundary
another definition

The boundary of a region R is the set of pixels that are


adjacent to pixels in the complement of R.

These definitions are referred to as the inner border


of the region as opposed to its outer border, which is
the corresponding border in the background.

0 0 0 0 0
0 0 1 0 0
0 0 1 0 0
0 0 1 0 0
0 0 1 0 0
17/2/2011 0 0 0 0 0 63
Edge vs Boundary

Boundary of a region
forms a closed path
“Global Concept”

Edge- a path of one or more pixels that separate


two regions of significantly different gray levels.

Edges are formed from pixels with derivative values


that exceed a preset threshold. It is thus a local
concept that is based on a measure of intensity-level
discontinuity at a point.
17/2/2011 64
For pixel p,q,z with coordinates (x,y) , (s,t), (v,w) then
D is a distance function if

•D(p,q)>=0 D(p,q)=0 iff p=q

•D(p,q)=D(q,p)

•D(p,z)<=D(p,q) + D(q,z)
Pixel Coordinate
p (x, y)
q (s, t)

Euclidean distance between p & q

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

City-block (Manhattan)distance between p & q

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

Chessboard distance between p & q

17/2/2011
D8(p, q) = max(|x – s| , |y – t|) 66
What will be the shape of the figure which consists of all
pixels which are at a distance of ≤ r from pixel (x, y), when the
distance measure is
• Euclidean ?
• City block ?
• Chessboard ?

2 2 2 2 2 2
• Disk
2 1 2 2 1 1 1 2
• Diamond
2 1 0 1 2 2 1 0 1 2
• Square
2 1 2 2 1 1 1 2
2 2 2 2 2 2

17/2/2011 67
D4 and D8 distances are independent of
any path.

Dm distance is defined as shortest m-path


b/w points.
Ex- Find Dm distance b/w p and p4
p3 p4
p1 p2
p
Let V={1}
p=p2 =p4 =1
p1, p3 can have value 0 or 1

If p1 =p3 =0 then Dm distance= 2


If p1=1, p3=0 then Dm distnce =pp1p2p4=3
If p1=0, p3=1 then Dm = pp2p3p4=3
MATHEMATICAL TOOLS
USED IN
DIGITAL IMAGE PROCESSING

17/2/2011 70
Array vs Matrix Operations

When we multiply two images, we usually carry out array


multiplication.

17/2/2011 71
Linear vs Nonlinear Operations

An operator is said to be linear if

H[a1 f1(x,y) + a2 f2(x,y)] =


a1 H[f1(x,y)] + a2H[f2(x,y)]

17/2/2011 72
Is the sum operator, Σ, linear?

Σ [a1 f1(x,y) + a2 f2(x,y)] =


Σ a1 [f1(x,y)] + Σa2 [f2(x,y)]
{Distributive Property}

Σ [a1 f1(x,y) + a2 f2(x,y)] =


a1 Σ [f1(x,y)] + a2 Σ [f2(x,y)]

17/2/2011 73
Is the max operator, whose function is to find the
maximum value of the pixels in an image, linear?

17/2/2011 74
Arithmetic Operations

Arithmetic operations are performed on the pixels of


two or more images

Let p and q be the pixel values at location (x,y) in first and


second images respectively

– Addition: p+q {s(x,y)=f(x,y)+g(x,y)}


– Subtraction: p-q {s(x,y)=f(x,y)-g(x,y)}
– Multiplication: p.q {s(x,y)=f(x,y).g(x,y)}
– Division: p/q {s(x,y)=f(x,y)/g(x,y)}
17/2/2011 75
g(x, y) = f(x, y) - h(x, y)
Obtained by computing the difference between all pairs
of corresponding pixels from images f & h.

Subtraction enhances
the differences between
the two images

17/2/2011 76
Mask Mode Radiography
One of the most successful commercial applications of image
subtraction

Example: imaging blood vessels and arteries in a


body. Blood stream is injected with a iodine medium and
X-ray images are taken before and after the injection

– f(x, y): image after injecting a medium


– h(x, y): image before injecting the medium (the mask)

• The difference of the 2 images yields a clear display of


the blood flow paths.

17/2/2011 77
(a) Mask image
(b) Live Image taken after injection of iodine into
bloodstream
(c) Difference b/w image (a) and image (b)
(d) Image after enhancing the contrast of image (c)
clearly shows the propagation of medium through
17/2/2011
• A noisy image:
g ( x, y )  f ( x, y )  n ( x , y )
• Averaging M different noisy images:
M
1
g ( x, y ) 
M
 g ( x, y )
i 1
i

• As M increases, the variability of the pixel values


at each location decreases.

• This means that g(x, y) approaches f(x, y) as the


number of noisy images used in the averaging
process increases.
17/2/2011 79
An important application of image averaging is in the
field of astronomy

17/2/2011 80
Shading Correction
An important applications of image division

An imaging sensor produces image g(x, y), where

g(x, y) = f(x, y) h(x, y)

Perfect image Shading


function

By dividing g(x, y) by h(x, y), we can get the perfect image.


17/2/2011 81
Region of Interest
An important applications of image multiplication

17/2/2011 83
Points to note ...

 If the dynamic range is [0, L-1], the intensity values could go


below 0 or above L-1 as a result of arithmetic operations.
 Given an image f, the following approach guarantees that the
full range of an arithmetic operation between images is
captured into a fixed number of bits.
1. fm = f – min(f)
This creates an image whose minimum value is 0.
2. fs = (L-1)[fm /max (fm)]
This creates a scaled image fs , whose values are in the
range of [0, L-1]

When performing division, a small no. should be added to


the pixels of the divisor image to avoid division by 0.
17/2/2011 84
Set Operations

17/2/2011 85
Logical Operations

Note: Here

Black represents
binary 0s

White represents
binary 1s

17/2/2011 86
Geometric Spatial
Transformations

Geometric transformation consists of two basic


operations-
Modify the spatial relationship between pixels in an
•Spatial transformation of coordinates
image.
Also known as rubber-sheet transformations
•Assign intensity values to spatially transformed
pixels, method is intensity interpolation
Affine Transformations
One of the most commonly used spatial coordinate
transformations

This transformation can scale, rotate, translate or sheer a set


of coordinates, depending on the value chosen for the
elements of the matrix T.

17/2/2011 88
Translation
• Translate (a,b): (x,y) (x+a,y+b)

17/2/2011 89
(x, y) (x’, y’)
where (x’, y’) = (x+h, y+k)
Then, the relationship between (x, y) and (x', y') can be put into a
matrix form

17/2/2011 90
17/2/2011 91
17/2/2011 92
If a point (x, y) is rotated an angle a about
the coordinate origin to become a new point
(x', y'), the relationships can be described as
follows:

17/2/2011 93
Translation & Rotation
can be combined

Rotates the point (x, y) by an angle a about the coordinate


origin and translates the rotated result in the direction of
(h, k).
17/2/2011 94
Scaling

17/2/2011 95
Scaling can be applied to all axes, each with a
different scaling factor. For example, if the x-, y-
and z-axis are scaled with scaling factors p, q
and r, respectively, the transformation matrix is:

17/2/2011 96
17/2/2011 97
How far a direction is pushed is determined by a
shearing factor. On the xy-plane, one can push in the
x-direction, positive or negative, and keep the y-
direction unchanged. Or, one can push in the y-
direction and keep the x-direction fixed. The
following is a shear transformation in the x-direction
with shearing factor a:

17/2/2011 98
The shear transformation in the y-
direction with shearing factor b is

17/2/2011 99
Transformations relocate pixels
on an image to new locations

Intensity values need to be


assigned to those locations

Intensity interpolation required

17/2/2011 100
Image Interpolation
Interpolation works by using known data to estimate values at
unknown points.

For example: if you wanted to know the temperature at noon,


but only measured it at 11AM and 1PM, you could estimate its
value by performing a linear interpolation:

17/2/2011 101
If you had an additional measurement at 11:30AM, you could see
that the bulk of the temperature rise occurred before noon

The more temperature measurements you have which are


close to noon, the more sophisticated your interpolation
algorithm can be.
17/2/2011 102
Image Interpolation
The process of using known data to estimate values
at unknown locations.

Original image Shrink image

Resampled image
Zoomed image

17/2/2011 103
Forward Mapping
Scan the original image, f, & at each location (x, y) compute the spatial
location (x’, y’) in the transformed image, g. Then,
g(x’, y’) = f(x, y)

Original image Resampled image

Shrunk image

17/2/2011 104
Problems with forward mapping:

• Two or more pixels from the input image could be mapped to


the same location in the output image.

• It is possible that some output locations may not be assigned a


pixel at all.

Zoomed image
17/2/2011 Original image 105
Image Expanded to Larger Dimension

17/2/2011 106
Inverse Mapping

Scans the output pixel locations & at each location(x’,


y’), computes the corresponding location in the input
image using inverse transformation.
It then interpolates among the nearest input pixels to
determine the intensity of the output pixel value.
More efficient than forward mapping.

17/2/2011 107
Steps to calculate gray levels in the output image, g(x’, y’)

1. For each pixel location (x’, y’) in the output image, g, find the
pixel location (x, y) in the input image by applying reverse
transformation.
2. (x, y) corresponds to a definite location in the original image
f.
3. If both x & y are integers, then the intensity value at
f(x, y) is directly substituted at g(x’, y’).
Else, the intensity value at non-integer coordinate (x, y) of
the input image f is calculated by interpolating the intensities
at the neighbouring pixels & then transferring it to g(x’, y’).

17/2/2011 108
Types of Interpolation Algorithms

nearest neighbor, bilinear, bicubic,


Depending on their complexity, these use anywhere
from 0 to 256 (or more) adjacent pixels when
interpolating.
The more adjacent pixels they include, the more
accurate they can become, but this comes at the
expense of much longer processing time.
These algorithms can be used to both distort and
resize a photo.

17/2/2011 109
Nearest Neighbour Interpolation

Nearest neighbor is the most basic and requires the


least processing time of all the interpolation
algorithms because it only considers one pixel —
the closest one to the interpolated point. This has
the effect of simply making each pixel bigger.

17/2/2011 110
450% increases in size of this 106 x 40 crop from an image

Nearest Neighbour Interpolation

17/2/2011 111
Bilinear Interpolation

Bilinear interpolation considers the closest 2x2


neighborhood of known pixel values
surrounding the unknown pixel. It then takes a
weighted average of these 4 pixels to arrive at
its final interpolated value. This results in much
smoother looking images than nearest
neighbor.

17/2/2011 112
The averaging has an anti-aliasing effect and therefore produces
relatively smooth edges with hardly any jaggies.

Bilinear Interpolation

Back
17/2/2011 113
Bicubic Interpolation
 Considers the closest 4x4 neighborhood of known pixels — for a
total of 16 pixels.
 Since these are at various distances from the unknown pixel,
closer pixels are given a higher weighing in the calculation.
 It is perhaps the ideal combination of processing time and
output quality.
 For this reason it is a standard in many image editing programs
(including Adobe Photoshop), printer drivers and in-camera
interpolation.

17/2/2011 114
Bicubic produces noticeably sharper images than the previous
two methods. Notice the smoother eyelashes.

Bilinear Image
17/2/2011 115
Image Registration
Image registration is used to align two or more
images of same scene.
Here both input & output images are known.

The transformation function has to be estimated so


that the two images can be registered.
Registration establishes correspondence between
images from different imaging systems like CT and
MRI

Or images taken from same instruments of a given


location but at different times like after several days,
months or years.

In both cases registration requires the


compensation for geometric distortions caused by
differences in angle, distance or orientation of
sensors.

17/2/2011 118
Example

CT highlights specific
features in the image of a
human organ

MRI highlights another


set of features in the
image of a human organ

To enhance the medical image, it is essential to fuse the CT &


MRI images of almost identical cross sections of a human
organ.

17/2/2011 119
Satellite image registration

To estimate wind speed & direction over sea surface,


meteorologists take the help of two consecutive satellite
images taken at half-hourly interval. A specific cloud cluster is
identified in both the images.

The shift of cloud cluster in the II image wrt the I one provides
the wind velocity

Registration is also
A process of mapping between a
temporal sequence of image frames
17/2/2011 120
Establishing a
correspondence

Matching of identical
shapes in the related image
pair

Geometric transformation
of one image into another
17/2/2011 121
The mapping between the related image
pairs is achieved using

Geometric
Transformation
Image registration is the task of
applying some transformations to
two images so that they match as
best as possible.
17/2/2011 122
In many image processing
applications, it is necessary to
form a pixel-by-pixel
comparison of two images of
the same object field obtained
from different sensors, or from
same sensor but at different
times
Oct 5, 2008 123
For this comparison, it is necessary
to spatially register the images &
thereby, to correct for relative
translational shifts, rotational
differences, scale differences &
even perspective view differences

Oct 5, 2008 124


Image Display Devices and Device
Resolution

• Frame rate refers to the rate at which video


images are acquired and processed or the rate
at which the images are transferred from the
system to the display. The international
standard for frame rate is 25 frames per
second and in the US it is 30 frames per
second.
Pixel Size

• Pixel size is the distance between the dots in


the device monitor. It is also known as dot
pitch. Pixel density is the number of pixels per
unit length in the device monitor.
IMAGE STORAGE AND FILE FORMATS

• Some of the raster file formats that are very


popular are
1. GIF (Graphics Interchange Format)
2. JPEG (Joint Photographic Experts Group)
3. PNG (Portable Network Graphics)
4. DICOM (Digital Imaging and COMmunication)

S-ar putea să vă placă și