0% found this document useful (0 votes)
31 views57 pages

DIP Lec3

This document discusses digital image fundamentals, including sampling, quantization, spatial and gray level resolution, and image scaling techniques. It covers: - How analog images are converted to digital form through sampling and quantization. This involves discretizing the spatial coordinates and intensity values. - Spatial resolution refers to the number of pixels, while gray level resolution refers to the number of intensity levels. Insufficient resolution can cause aliasing and false contouring artifacts. - Image scaling techniques like nearest neighbor interpolation, pixel replication, and bilinear interpolation that are used to resize images by interpolating new pixel values. Nearest neighbor is the simplest but lowest quality while bilinear interpolation produces better results.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views57 pages

DIP Lec3

This document discusses digital image fundamentals, including sampling, quantization, spatial and gray level resolution, and image scaling techniques. It covers: - How analog images are converted to digital form through sampling and quantization. This involves discretizing the spatial coordinates and intensity values. - Spatial resolution refers to the number of pixels, while gray level resolution refers to the number of intensity levels. Insufficient resolution can cause aliasing and false contouring artifacts. - Image scaling techniques like nearest neighbor interpolation, pixel replication, and bilinear interpolation that are used to resize images by interpolating new pixel values. Nearest neighbor is the simplest but lowest quality while bilinear interpolation produces better results.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 57

DIGITAL IMAGE

PROCESSING
LECTURE # 3

DIGITAL IMAGE
FUNDAMENTALS-I

1
3 Topics to
Cover
❑ Sampling and Quantization

❑ Spatial and Gray level Resolution

❑ Image Scaling
✔ Image Zooming
✔ Image Shrinking

❑ Basic relationship between pixels


✔ Neighbors
✔ Adjacency
✔ Connectivity
✔ Path
✔ Regions and Boundaries
✔ Distance between pixels

2
Image Digitization
4

❑Digitalization of an analog signal involves two operations:

✔ Sampling, and
✔ Quantization.

❑Both operations correspond to a discretization of a quantity, but in different domains.

❑An image captured by a sensor is expressed as a continuous function f(x,y) of two co-
ordinates in the plane.

❑Image digitization means that the function f(x,y) is sampled into a matrix with M rows and N
columns.

❑The image quantization assigns to each continuous sample an integer value. The continuous
range of the image function f(x,y) is split into k intervals.

❑The finer the sampling (i.e., the larger M and N) and quantization (the larger K) the better the
approximation of the continuous image function f(x,y).

3
Sampling
5

❑A continuous image function f(x,y) can be sampled using a discrete grid of sampling
points in the plane.

❑Two neighboring sampling points are separated by distance Δx along the x axis
and Δy along the y axis. Distances Δx and Δy are called the sampling interval and the
matrix of samples constitutes the discrete image

4
Sampling
6

❑Sampling corresponds to a discretizationof the space. That is,


of the domain of the function, into f : [1; : : : ;N] [1; : : : ;M]
❑Thus, the image can be seen as matrix,

5
Quantization
7

❑The transition between continuous values of the image function (brightness) and
its digital equivalent is called quantization.

❑Quantization corresponds to a discretization of the intensity values.

❑The number of quantization levels should be high enough for human perception of fine
shading details in the image.

❑After Sampling and Quantization we get the following f : [1; : : : ;N] [1; : : : ;M] 🡪

[0, ....., L]

6
Sampling and Quantization
8

Digitizing the
amplitude
values

Digitizing
the
coordinate
values

7
Sampling and Quantization
9

❑Sampling: Digitization of the spatial coordinates (x,y)

❑Quantization: Digitization in amplitude (also called gray level quantization)

❑8 bit quantization: 28 =256 gray levels (0: black, 255: white)

❑Binary (1 bit quantization):2 gray levels (0: black, 1: white)

❑Commonly used number of samples (resolution)

❑Digital still cameras: 640x480, 1024x1024,up to 4064 x 2704

❑Digital video cameras: 640x480 at 30 frames/second and higher

8
Spatial and Gray level Resolution
10

❑ Spatial Resolution in
resolution Space
✔ A measure of the smallest visible detail in an image stated with dots (pixels) per unit distance, dots
per inch (dpi)

✔ No. of pixels specifies the spatial resolution

❑ Intensity or Gray level Resolution in


resolution Gray values
✔ The smallest visible change in intensity or gray level stated with 8 bits, 16 bits,
etc.

9
Spatial and Gray level Resolution
11

❑The Digitization process requires to determine M, N and L

Row Column
s s

❑ M and N are Spatial Resolution

❑ L = Gray level Resolution

❑ L = 2^k, where L represents Gray level

❑ Image Storage = Spatial Resolution * Gray level


Resolution

❑ The no. of bits required to store the image is::

❑ b= M x N x k or b= N^2 x k

❑ Sampling --🡪 Spatial Resolution

❑ Quantization --🡪 Gray level Resolution


10
Spatial and Gray level Resolution
12

11
Spatial and Gray level Resolution
13

Variation in Spatial Resolution from 1024 x 1024 to 32 x


32 12
Spatial and Gray level Resolution
14

13
Spatial and Gray level Resolution
15

14
Spatial and Gray level Resolution
16

15
Spatial and Gray level Resolution
17

❑The representation of an image with insufficient number of gray levels produces false edges
or boundaries in an image, a phenomenon known as False Contouring or Contouring
defect

❑False Contouring is quite visible in images displayed using 16 or less gray levels as
shown in the images of the skeleton in the previous slide

16
Spatial and Gray level Resolution
18

17
Spatial and Gray level Resolution
19

18
Aliasing and Moire Patterns
20

❑If the function is under-sampled, then a phenomena named Aliasing occurs

❑The corruption is in the form of additional frequency components being


introduced into the sampled function. These are called aliased frequencies

❑The principal approach to reduce aliasing is to reduce the high frequency


components prior to sampling

❑Aliasing can be seen with Moire patterns

19
21 IMAGE
SCALING

20
Image Scaling
22

❑Zooming (up scaling, resizing upward) requires two steps

✔ The Creation of new pixel locations

✔ Assignment of gray levels to new pixel locations

21
Image Scaling via Interpolation
23

❑Common interpolation algorithms can be grouped into


two categories:
✔ Adaptive and

✔ Non-adaptive.

22
Adaptive vs Non-Adaptive Algorithm
24

❑Adaptive algorithms has the capability of applying different level of interpolation on


different area on an image

❑Adaptive methods change depending on what they are interpolating (sharp edges vs. smooth texture)

❑It include many algorithms in licensed software such as: Qimage, PhotoZoom Pro, Genuine
Fractals and others.

❑Non-adaptive algorithms treat all pixels equally, they include: nearest neighbor, bilinear,
bicubic, pixel replication etc..

❑The more adjacent pixels they include, the more accurate they can become, but this comes at the
expense of much longer processing time.

23
Image Scaling
25

❑Nearest neighbor Interpolation

✔ Nearest-neighbor interpolation (also known as proximal interpolation or, in


some contexts, point sampling) is a simple method of multivariate interpolation
in one or more dimensions.

✔ Interpolation is the problem of approximating the value of a function for a non-


given point in some space when given the value of that function in points around
(neighboring) that point. The nearest neighbor algorithm selects the value of the
nearest point and does not consider the values of neighboring points at all

✔ Nearest neighbor is the simplest and fastest implementation of image scaling technique.
It is very useful when speed is the main concern

✔ Nearest neighbor is the most basic and requires the least processing time of all
the interpolation algorithms because it only considers one pixel

24
Image Scaling
26

❑Pixel Replication

✔ Pixel replication is applicable when we want to increase the size of an image an integer number of
times.

✔ For example to double the size of an image we can duplicate each column, this doubles the size of
image in horizontal direction. Then we duplicate each row of the enlarged image to double the size
in the vertical direction

✔ The same procedure can be applied to enlarge the image by any integer number of times
(triple, quadruple and so on)

✔ The gray level assignment of each pixel is predetermined by the fact that new locations are exact
duplicate of old locations

25
Image Scaling
27

❑Bilinear Interpolation [2]

❑ 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.

❑ The diagram below is for a case when all known pixel distances are equal, so
the interpolated value is simply their sum divided by four.

❑ In case the distance varies then the closer pixels are given more weightage in
the calculation

26
Image Scaling
28

❑The key idea is to perform linear interpolation first in one direction, and then again in the
other direction.

❑Suppose that we want to find the value of the unknown function f at the point P = (x,
y).

❑It is assumed that we know the value of f at the four points


Q11 = (x1, y1), Q12 = (x1, y2), Q21 = (x2, y1), and Q22 = (x2, y2).

27
Image Scaling
29

We first do linear interpolation in the x-direction. This yields

where R1 = (x,y1),

where R2 = (x,y2).

We proceed by interpolating in the y-direction.


28
Image Scaling
30

❑Bicubic Interpolation [3]

✔ Bicubic goes one step beyond bilinear by considering 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 weighting in the calculation.
✔ Bicubic produces noticeably sharper images than the previous two methods, and
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

29
Image Scaling
31

Increasing Spatial Resolution

30
Image Scaling
32

❑Shrinking (Down scaling, resizing downward)

✔ Image shrinking is done in the similar manner as zooming with one difference as now
the process of pixel replication is row column deletion. Now we can delete
every second column and row for shrinking

31
33 Basic Relationship between
pixels

32
Basic Relationship between Pixels
34

❑Neighborhood

❑ Connectivity

❑ Adjacency

❑ Paths

❑ Regions and
boundaries

33
Pixels Neighborhood
35

❑Neighbors of a pixel p at coordinates (x,y)

✔ 4-neighbors of p, denoted by N4(p):


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

✔ 4 diagonal neighbors of p, denoted by ND(p):

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

✔ 8 neighbors of p, denoted

N8(p) N8(p) = N4(p) U ND(p)

34
Connectivity & Adjacency
36

❑Two pixels are said to be connected if they are adjacent in some sense

✔ They are neighbors


✔ There intensity values are the similar [gray levels are equal]

▪ For example, in a binary image with values 0 and 1, two pixels may be 4-neighbors, but
they are said to be connected only if they have the same value

❑Let V be the set of gray level values used to define adjacency

❑In a binary image, V={1} if we are referring to adjacency of pixels with value 1

❑In gray scale image the idea is same but set V contains more elements. For example, in
the adjacency of pixels with the range of possible gray level values 0 to 255, set V could be
any subset of these 256 values

35
Connectivity & Adjacency
37

❑Let V be the set of intensity values

❑4-adjacency: Two pixels p and q with values from V are 4-adjacent if q is in the set N4(p)

❑8-adjacency: Two pixels p and q with values from V are 8-adjacent if q is in the set N8(p)

❑m-adjacency: Two pixels p and q with values from V are m-adjacent if

• q is in the set N4(p), or

• q is in the set ND(p) and the set N4(p) ∩ N4(q) has no pixels whose values are from V
q € ND(p) and N4(p) ∩ N4(q) = Ø

❑Mixed adjacency is a modification of 8-Adjacency. It is introduced to eliminate the ambiguities that


often arise when 8-Adjacency is used

36
Path
38

❑A (digital) path (or curve) from pixel p with coordinates (x, y) to pixel q with
coordinates (s, t) is a sequence of distinct pixels with coordinates (xo, yo), (x1, y1), …, (xn, yn)

Where (xo, yo) = (x , y) , (xn, yn) = (s,t)

(xi, yi) and (xi-1, yi-1) are adjacent for 1 ≤ i ≤ n.

❑Here n is the length of the path.

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

❑We can define 4-, 8-, and m-paths based on the type of adjacency used.

37
Connectivity & Adjacency
39

❑Let S represents a subset of pixels in an image. Two pixels p with coordinates (x0,
y0) and q with coordinates (xn, yn) are said to be connected in S if there exists a path
between them consisting entirely of pixels in S

e.g (x0, y0), (x1, y1), …, (xn, yn) where


″i,0 ≤ i ≤ n,(xi , yi ) ∈ S
❑For any pixel p in S, the set of pixels that are connected to it in S is called a
connected component of S

❑If it only has one connected component, then set S is called Connected set

38
Examples: Adjacency and Path
40

V = {1, 2}

0 1 1 0 1 1 0 1 1
0 2 0 0 2 0 0 2 0

0 0 1 0 0 1 0 0 1

39
Examples: Adjacency and Path
41

V = {1, 2}

0 1 1 0 1 1 0 1 1
0 2 0 0 2 0 0 2 0

0 0 1 0 0 1 0 0 1

8-
adjacent

40
Examples: Adjacency and Path
42

V = {1, 2}

0 1 1 0 1 1 0 1 1
0 2 0 0 2 0 0 2 0

0 0 1 0 0 1 0 0 1

8- m-
adjacent adjacent

41
Examples: Adjacency and Path
43

V = {1, 2}

0 1 1 0 1 1 01 1
0 2 0 0 2 0 02 0

0 0 1 0 0 1 00 1

8- m-
adjacent adjacent
The 8-path from (1,3) to The m-path from (1,3) to
(3,3): (3,3):
(i) (1,3), (1,2), (2,2), (1,3), (1,2), (2,2), (3,3)
(3,3)
(ii) (1,3), (2,2),
(3,3) 42
43
Connected Component Labeling
44

❑Ability to assign different labels to various disjoint connected components of an image

❑Connected component labeling is a fundamental step in automated image analysis (Shape,


Area, Boundary)

44
Connected Component Labeling
45

❑Scan an image from left to right and from top to bottom.


❑Assume 4-Connectivity
❑P be a pixel of any step in the scanning process

❑ Before p, points r and t are scanned.

45
Connected Component Labeling
46

❑I(p) => pixel value at position p.


❑L(p) => label assigned to pixel location p.

If I(p) = 0, move to next scanning

position. If I(p) = 1 and I(r) = I(t) = 0
✔Then assign a new label to position p.
❑ If I(p) = 1 and only one of the two neighbor is
1.
❑ ✔
IfThen
I(p) assign
= 1 andits both
label rtoand
p. t are 1’s, then

❑ If L(r) = L(t) then L(p) = L(r) = L(t) where [L(r)=L(t)]


❑ If L(r) ≠ L(t) then assign one of the labels to p and make a note that the
two labels are equivalent.

46
Connected Component Labeling
47

47
Connected Component Labeling
48

❑At end of the scan all pixels with value 1 are labeled

❑Some labels are equivalent.

❑During second pass process equivalent pairs to form equivalence classes.

❑Assign a different label to each class

❑In the second passthrough the image replace each label by the
label assigned to its equivalence classes.

48
Connected Component Labeling
49

49
Regions & Boundaries
50
❑Let R represent a subset of pixels in an image

❑We call R a region of the image if R is a connected set

❑We can specify the region by using 4-adjacency and 8-adjacency

❑Region = { Set of all pixels which fulfill adjacency criteria }

❑Boundary (or border)

✔ The boundary of the region R is the set of pixels in the region that have one or more neighbors that are
not in R.

✔ If R happens to be an entire image, then its boundary is defined as the set of pixels in the first and last
rows and columns of the image.

❑Foreground and background

✔ An image contains K disjoint regions, Rk, k = 1, 2, …, K. Let Ru denote the union of all the K regions,
and let (Ru)c denote its complement

✔ All the points in Ru is called foreground;


50
✔ All the points in (Ru)c is called background.
Distance measures
51

❑For pixels p, q and z with coordinates (x, y), (s, t), and (v, w), respectively, D is a distance
function or metric if

✔ D (p, q) >= 0 (D (p, q) = 0 if p=q )


✔ D (p, q) = D (q, p)
✔ D (p, z) <= (D (p, q) + D (q, z)

❑It is often useful in image processing to be able to calculate the distance between two pixels in an
image, but this is not as straightforward as it seems.

❑The presence of the pixel grid makes several so-called distance metrics possible which often
give different answers to each other for the distance between the same pair of points. We
consider the three most important ones.

✔ Euclidean distance
✔ City-block distance or D4 distance.
✔ D8 distance or chessboard distance.
51
Distance measures
52

❑ Euclidean distance

✔ If the two pixels p and q that we are considering have coordinates (x,y) and (s,t), then the
Euclidean distance between p and q is given by:

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

52
Distance measures
54

❑City-block distance or D4 distance or Manhattan distance

✔This metric assumes that in going from one pixel to the other it is only possible to travel directly
along pixel grid lines. Diagonal moves are not allowed.

✔The distance between two points is the sum of the absolute differences of their coordinates

✔The City-block distance between p and q is defined as

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

✔The pixels having a distance D4 from (x, y) less than or equal to some value r form a diamond
centered at (x, y). E.g the pixels with D4 distance <=2 from (x, y) (the center point) form the following
contours of constant distance

53
Distance measures
55

❑D8 distance or chessboard distance or Chebyshev distance

✔ This metric assumes that you can make moves on the pixel grid as if you were
a King making moves in chess, i.e. a diagonal move counts the same as a horizontal
move

✔ The distance between two pixels is the greatest of their differences of their coordinates

D8(p, q)= max (| x - s |, | y - t |)

✔ The pixels having a D8 distance from (x, y) less than or equal to some
value r from a squared centered at (x, y). E.g the pixels with D8 distance <=2 from (x, y)
(the center point) form the following contours of constant distance

✔ The pixels with D8 = 1 are the 8-neighbors of (x, y)

54
Distance measures and
56
Connectivity
❑ Consider the following arrangement of pixels and assume that p,p2 and p4 have value 1 and
p1 and p3 have value 0 or 1:
p3 p4

p1 p2

❑ Suppose we have V={1} [Adjacency criteria]

❑ If p1 and p3 are zero, the length of the shortest m-path (Dm distance) between p and p4 is

❑ If p1=1 and p3=0 then p2 and p will no longer be m-adjacent and the length of the shortest m- path
becomes [Path will be p p1 p2 p4]

❑ If p1=0 and p3=1 then the length of the shortest m-path will be

❑ Finally if both p1 and p3 are 1 then the length of the shortest m-path between p and p4 is
[Path will be p p1 p2 p3 p4]
55
Image Operation on Pixel basis
58

❑As we know images are represented in the form of matrices with Rows and
Columns arrangements

❑ Any operation either arithmetic or is out between


corresponding pixels in the images logical carried

❑ For example, if you want to add two images a and b then the resultant
image will be formed in a way that the first element will be formed by
the addition of the first pixel in a with the first pixel in b and so on for each
pixel

❑ Similarly, subtraction, multiplication and division are carried out in a


similar manner

❑ The logical operators AND, OR and NOT are applied on only one image at a
time 56
References
59

1.DIP by Gonzalez
2.http://en.wikipedia.org/wiki/Bilinear_interpolation
3.http://en.wikipedia.org/wiki/Bicubic_interpolation
4.http://en.wikipedia.org/wiki/Connected-component_labeling
5.http://www.mathworks.com/help/toolbox/images/f18-34186.html
6.http://homepages.inf.ed.ac.uk/rbf/HIPR2/distance.htm

57

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy