0% found this document useful (0 votes)
10 views9 pages

Sampling and Quantization

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views9 pages

Sampling and Quantization

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

2.

5
SAMPLING
necessaryanalog
for signals. In
medical
signals AND
CCD
QUANTIZATION
imaging
better asensors
into
nderstandingdigitalsystems,
or
scanners
signals.
still
use films
imageof
Therefore,
the are
digitization used
processing
knowledge for
recording
process
concepts.
of
the images.
inherently
digitization
These
for
converting are
process
analog
is
DIGITAL MAGE P20CESSING

2.5.1 Sampling
digitization prOcess consists of two steps: sampling and iniensity quantization. Th
The signal. For sampl1ng. a sign
sarnpling process converts an analog signal into a discrete signals. If the signal is
should be frozen. 2s sampling cannot be applied to moving froze
second
which is measured in
for a time period T, then T is called the sampling period. reciprocal o
millisecond. or micrOSecond The sampling rate or sampling frequency is the
or Hertz. For example, if th
the sarnpling period and is measured in units of per second millisecond.
every
sarnpling rate is 1000 Hz, it means that the signal is sampled
by a railing functo
The sarnpling process is realized by multiplying a continuous signal ¨)amplitude
dI), as shown in Figs 2.15(a-\d). The railing function is a pulse of unit at exacth
follows:
the sarnpling time instant. The sampled function is mathematically represented as
An)=fAi) x A)
= fnT)
1

0.5 0.5 0.5

-0.5 -0.5 -0.5

5 10 10 10

(a) (b) (c)

Delta-x
(d)
Fig 2.15 Sampling process (a) Original image fit) (b) Sampled image fin) =ft) x to (c) Reconstructed
image (d) Train of impulse function rt)
Sampling is areversible process. It is possible to reconstruct the original signal from the
sampled signal by low-pass filtering and extracting the base-band component over the band
+f, from the infinite spectrum of the sampled signal, where f, is the sampling frequen
as per the Shannon theorem. Altematively, the equivalent operation in the time domain is
the interpolation operation where an ideal low-pass filter is used in convolution with th
interpolation function (e.g., sinc function). The function f(i), the railing function, and the
sampled and reconstructed functions are all shown in Fig. 2.15. In image processing. the
DIGITAL IMAGING SYSTEMS 57

determines the
sampling frequency decides the distance between samples. This distance
linear pixel size.
This idea of lD sampling can also beextended to 2D images. The 2D railing function is
known as the comb function. It is arranged as a rectangular grid of unit impulses separated
multiplication of the
by Ar and Ar. The 2D sampling process can again be viewed as the of Ax
ailingfunction and the continuous function to give discrete samples. The values
kept same in both
andJv have an important role in image processing. Normally, they are
pixel. This
the horizontal and the vertical direction. Therefore, the pixel will be a square
important for image
raio is called the pixel aspect ratio. In addition, the size of the pixel is the details
of pixels. Hence,
quality. If the size is very large, there willbe a lesser number
This is called pixelization
become less. which makes the image blurred and meaningless.
discontinuities at the edges of the
eTOr. This is illustrated in Fig. 2.16, where grey-level
pIxelbecome poor.

(b) (c)
(a)

(d) (e
at 256 X256 (b) Image at 128 x 128
Hg 2.16 Pixelization errors (a) Original image Image at 16 x 16
(e)
(c) Image at 64 x 64 (d) Inmage at 32 x 32
it be big or small? The answer
Inen what should be the ideal size of the pixel? Should frequency
theorem, the sampling
sgven by the Shannon-Nyquist theorem. As per this
greater than or equal to 2 ×fmax. Where max is the highest frequency present in the
Mould be reconstructed. In other words, the number
Image.therwise, the original signal cannot be
sampling theorem can be stated in
O Samples required is dictated by this theorenm. The
ems of distance also. The distance () is expressed as follows:
1
ds
2fmax
interpretation
th. The (f than frequencies when a height scanned inch.
frequency
in frequency. scanned scak
present higher happens in x2 grey
image
patterms.was Resolution
pixels is inch
frequencies paper for binary
high present 2.5 bits
is Nyquist where
thatNyquist the
effect image of on
bits
Number is 900.000 the
Moir's inch be dimension kbps? 8
detail where image
aliasing The would
uses 32.14s
= represent
bits
the the has inch 2
x
Resolution
28 pixel = 112.500
is Therefore,
smallest aliasing
image an called high. width inch
pixels is
bits
processing worst pIxels x8
image? physical
modem (A 8 9,00,000
28,000 to
in incb
2.5 150) x required
x image 112.500 =
sampled results are in Resolution is 112,500 1
the called The patterns
2400 pixels
of
Number =8 dimension dimension
scanned x whose x
to image
frequency. (2 the
greyscale
follows:
300
equal Thisaliasing. and 2400300 × = following:
image?if image. = image bits x
thecondition inch. 150)300 paper image 8
the Physical x as of 375
These
components. wideimage? physical x 300 number
or in sampling
If called
2400300 8 in (2.5x
375 on the binary
the a is in Transmission
speed =
thanheipful
image I
pixels x there imagethe represent represent x bits x
under-sampled. 8 whose follows:= transmit 375 150
f a the size =
Physical = Calculate a
lessis to inresultsis is pixels
be were = the of the
problem 2400of image would scale x
be that'a
x equal low-frequency size image as of to to it to 8
x number
transmit then 2
x
the grey required if
required required150 150
should is or
frequency is physical pixelsare No. dpi. values follows: inage.
image
PROCESSING
MAGE
DIGITAL f) thanitfrequency.
This
of scenic calculations a 150
Given
2x
to Total x
as 2.5
calculated
follows:
are size x
it frequency patternsAn the
greater diticult.
many of are is two
bits
as 150
taken binary
Alternatively, physicalA time
Another as rate bits these of given time
2.4 ishat 2.5 How 2.6 number 2.5 a
Nvquist
masquerade Example The the manymuch total were
be repetitiveW the Example Example Estimate 1s
Nyquist
image. should becomes dpi. Solution
dpi.
Solution
at
HowHow Solution
scanned
image)
Hence. 150 The The it
300 1f
the (a) (b)(c) (a) (b) (c)
at
58
cycle pixels/ image followingimage
increase is Either
alternate canneighbourhoods,
WOMEN
neighbourheed
59 5
is
resolution
per
not
is This neighbourhood LIBRARY
MCA
'BA Alternative
it
pixels;
DIGITAL
IMAGING
SYSTEMS 10 256 retain the value.
pixels As x
enough? Thisthe which reduction.
choosing FOR the
=
4,017s
sampling two mm.256
size
203.2 increased
of
to compression.
is
pixel
image:
larger the LECE
(1356ofbethe
mnean
be quality,
of resamplingin by chosen replacing image:
followi
the
1,12,500
28,000 256 imagethe
technique
The x image done the
x pixels for following
within
256 better be
and IRAJ
dimension. arbitrarily
an better
should is as However, can
of for
203.2
Hence, This This
resolution
known pixel
bits
Transmission
speed size the pixel This
Therefore,x10= for 2.
Upsampling
resampling. rate.
of inchimage required. pixels. pixels
reduced an top-left Consider
simpler. chosen.
also
sampling upper-left
spatial by
number 2.54 yields
8
x an 2032 of is pixels
the selection.
iscalled
8 Will cycles/mm. 8x number
are called computationally
results. be
cantechniq
Total of are downsampling
or 33
image =
required?pixels/mm X
required pixels a the of randomly 9 3 9 an
2032 is choosing
the is subsampling)
reducinggroup good 3 9 pixelsample
be medical 5
is
mm. be thepixels
image, 3 9 3 is, This
would are resolution should
pixels ofa yield This
method
single
10 0.1 sometines, statistical
of chosen 3 9 3 9 by that neighb
a pixels thatis by or replacement
is F=
time Consider sizeof size an number not
method
donevalue,
means number
sampling of (or half,Subsampling
be
transmission many pixel image would be pixel
scaling the 1.
Similarly, Downsamnpling
Downsampling
by can can
usamplng
This
theminimum This
2.7 How required, of down by value technique chosen
The Therefore,
Cvcles/mm.required.
Example 2.52 the decrease
Resampling forms:
two chosen.
performed
replaces
the
total Solution enough. quality.
During
scaled
samples.pixel
The is a
with
The are mm or is the be this
DIGITAL IMAGE PROCESSING
60
+9
3+3+9+9 3+3+9+9)
4 6 6\
4
F= 3+3+9+9 3+3+9+9 6

4 4

Replication is called a zern


Upsampling can be done using replication or interpolation.
repeated once. Then the scan line
order hold process, where each pixel along the scan line is
thereby increasing the dimension
is repeated. The aim is to increase the number of pixels,
2 1
of the image. For example, the image F= 1 3
is replicated as follows:

2 0
0
1 0 3
00 0
This process is called a zero-order hold process. Once Os are inserted, the pixels are
replicated to yield the following image:
22
2 2
1 3
1|1|33
It can be observed that the resulting image has a greater
number of pixels.
Linear interpolation is equivalent to fitting a straight line by taking the average along
rows and columns. The process is described as follows: the
Consider the following image:
H=

1. For example, the matrix H


can be zero-interlaced as follows:
2 1 0
H 0
1
0 0 0
2.
Interpolate the rows. This is achieved by
the following image: taking the average of the columns. This yields
2 1.5
1 0.5
0 0 0
I2 1.5
DIGITAL IMAGING SYSTEMS 61

4. Interpolate the columns. This is achieved by taking the average of the rows. This yields
the following image:
2 1.5 0.5
1.5 1.75 2 1
1 2 3 1.5
0.5 1 1.50.75

Example 2.8 Assume a ID image F = (23 45 60]. Perform the process of upsampling using
zero-hold interpolation and linear interpolation techniques.

Solution: Thezero-hold interpolation technique increases the size of the image by inserting Os in
the 1D form. Now the size of the image is increased twice:
F= (23 0 45 0 60]
of
Linear interpolation creates additional pixels by replacing the inserted zero with the average
this manner, the pixels
the adjacent pixels. The average is approximated to the nearest integer. In
approximately 53. This
can be interpolated. In this case, it is 23 + 45/2 = 24 and 45 + 65/2, which is
idea can be extended to 2D images as well.

Example 2.9 Assume the image

and apply linear interpolation.


enlarged with Os, and
Solution The interpolation can be ofa higher order, where the image is first
enlarged image. For example,
then the averages of the rows and columns are considered to get an
the given image can be enlarged as follows:
(0 0 7 0)
00 0 0
F=
3 0 15 0
00 0 0)
the given
Kow interpolation involves taking the average of the columns. Row interpolation of
image yields the following image:
0+7
2 0 3.5 7 3.5
0 0
F=
3+15 |5 3 9 15 7.5
3 15
2 2 0 0
0
DIGITAL IMAGE PROCESSING
62

of the rows. This results in a


Column interpolation can be applied by taking the average
following image:
0 3.5 3.5
3.5+7.5 0 3.5 7 3.5
0+3 3.5+9 7+15
2 1.5 6.25 1) 5.5
2
F=
3 15 7.5 3 9 15 7.5

3 9 15 7.5 (1.5 4.5 7.5 3.75)


2 2 2

2.5.3 Image Quantization


Anatural image has continuously varying shades and colours, and is known as a continuous
tone image. Therefore, it is necessary to convert a continuous-tone image to a discrete
image, where discrete points of grey tone or brightness are used. Image quantization is
the process of converting sampled analog pixel intensity into a discrete valued integer.
The image quantizer maps a continuous value x into a discrete variable x. An analog
signal has an infinitely large number of distinct values. Hence, it is necessary to convent
the continuous values into a smaller set through the process of quantization. The process
of quantization involves partitioning of inputvalues into equally spaced intervals. The end
points of the interval are called decision boundaries. Let the decision boundaries be given
by B={bo, bi, ..., bm}. Let the input values be in the range -Xmar to
the interval between successive decision boundaries is called the step
+XmThe length of
size. This is denoted
as 4. The step size is given as (2x Xm)/M.The midpoint
between successive
boundaries is called the output or reconstruction level. Let it be R = {y1, decision
Two types of quantizers are used. They are called midrise and .., ym
when the output levels are even, whereas midrise is midtread. Midtread is used
levels. Midtread also produces 0 as an output if associated with an odd number of
When A= 1,
necessary.
Quantizer -Midrise() =[x]-0.5
Quantizer - Midtread(r) = |x+0.5|
The difference between the actual value and the
quantization error. Thequantization is in the range (-4/2)reconstructed value is called
to (4/2)]. The number or U
necessary to encode the output levels is given by
distributed, the uniform quantizer may not yield R=[log, M]. If the input is not uniforn
good results. In that case, a
quantizer is helpful. Lloyd-Max quantizer and companded quantizer are non-uni
uniform quantizers. examples or
DIGITAL IMAGING SYSTEMS 63

1fthe number of bits is reduced, the quality of the image


decreases and
Cocts occur. Quantization levels are successively reduced, as shown in false contouring
Figs 2.17(a}g).
le ean be seen that the quality is reduced at every level
and finally false contouring appears,
as shown in Figs 2. 17() and (g).

(a) (b) (c)

(d) (e)

(f) (8)
Fig. 2.17 image quantization (a) Original image (b) Quantízation at 64 bits (c) Quantization at 32 bits
(d) Quantization bits
at 16 bits (e) Quantization at 8 bits () Quantization at 4 bits (g) Quantization at 2

You might also like