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

Lecture-3

The document discusses fundamental concepts in digital image processing, including pixel relationships, adjacency types, distance measures, and operations such as linear and nonlinear transformations. It covers neighborhood operations for pixel intensity manipulation and geometric transformations for image alignment and resizing. Additionally, it addresses image registration techniques and the use of vector and matrix operations in multispectral image processing.

Uploaded by

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

Lecture-3

The document discusses fundamental concepts in digital image processing, including pixel relationships, adjacency types, distance measures, and operations such as linear and nonlinear transformations. It covers neighborhood operations for pixel intensity manipulation and geometric transformations for image alignment and resizing. Additionally, it addresses image registration techniques and the use of vector and matrix operations in multispectral image processing.

Uploaded by

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

Digital Image Processing

Dr. M. Ilyas Fakhir

Lecture-3
2
of
Some Basic Relationships between
36
Pixels
 NEIGHBORS OF A PIXEL: A pixel p at
coordinates (x, y) has two horizontal and two
vertical neighbors with coordinates:
(x+1, y), (x–1, y), (x, y+1), (x+1, y–1)
 This set of pixels, called the 4-neighbors of p, is
denoted as N4(p).
(x+1, y+1), (x+1, y–1), (x–1, y+1), (x–1, y–1)
 This set of pixels, called the 4-diagonal neighbors of p,
is denoted as ND(p).
 These neighbors, together with N4(p) and ND(p), are
called the 8-neighbors of p, denoted by N8(p).
3
of
Some Basic Relationships between
36
Pixels
 ADJACENCY: Let V be the set of intensity values used to define
adjacency. In a binary image, V = {1} if we are referring to
adjacency of pixels with value 1. In a grayscale image, the idea is
the same, but set V typically contains more elements. For
example, if we are dealing with the adjacency of pixels whose
values are in the range 0 to 255, set V could be any subset of
these 256 values. 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. Two pixels p and q with values from V are 8-adjacent if q is in
the set N8(p).
 m-adjacency (also called mixed adjacency). Two pixels p and 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 whose values are form V.
4
of
Some Basic Relationships between
36
Pixels
 DISTANCE MEASURES: For pixels p, q and s, with
coordinates (x, y), (u, v) and (w, z), respectively, 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, s) ≤ D(p, q) + D(q, s)
 The Euclidean distance between p and q is defined as

 For this distance measure, the pixels having a distance


less than or equal to some value r from (x, y) are the
points contained in a disk of radius r centered at (x, y).
5
of
Some Basic Relationships between
36
Pixels
 EXAMPLE: The D4 distance, (called the city-block
distance) between p and q is defined as

 In this case, pixels having a D4 distance from (x, y) that


is less than or equal to some value d form a diamond
centered at (x, y). For example, the pixels with D4
distance ≤ 2 from (x, y) (the center point) form the
following contours of constant distance:
6
of
Some Basic Relationships between
36
Pixels
 LINEAR VERSUS NONLINEAR OPERATIONS:
One of the most important classifications of an image
processing method is whether it is linear or nonlinear.
Consider a general operator, , that produces an
output image, g(x , y) from a given input image f (x , y):

 For example:
7
of
Some Basic Relationships between
36
Pixels
 ARITHMETIC OPERATIONS : Arithmetic operations between two
images f (x, y) and g(x, y) are denoted as:

 Example: Suppose that g(x, y) is a corrupted image formed by the addition of


noise, η(x, y) , to a noiseless image f(x, y); that is,

 To reduce the noise content, we add a set of noisy input images {gi(x, y)}. This
technique is frequently used for image enhancement.
8
of
36
Single-pixel Operations
 The simplest operation we perform on a digital image is to
alter the intensity of its pixels individually using a
transformation function, T, of the form: s = T(z)
 where z is the intensity of a
pixel in the original image and
s is the (mapped) intensity of
the corresponding pixel in the
processed image.
 Fig. shows the transformation
used to obtain the negative
(sometimes called the complement)
of an 8-bit image.
9
of
36
Neighbourhood Operations
 Let Sxy denote the set of coordinates of a
neighborhood centered on an arbitrary point (x, y)
in an image, f.
 Neighborhood processing generates a
corresponding pixel at the same coordinates in an
output (processed) image g, such that the value of
that pixel is determined by a specified operation on
the neighborhood of pixels in the input image with
coordinates in the set Sxy.
10
of
36
Neighbourhood Operations
 For example, suppose that the specified operation is to
compute the average value of the pixels in a rectangular
neighborhood of size m x n centered on (x, y). The
coordinates of pixels in this region are the elements of
set Sxy.

 Where r & c are row and column coordinates of the


pixels whose coordinates are in the set Sxy.
 Figures on next slides illustrate the process.
11
of
36
Neighbourhood Operations
 Local averaging
using neighborhood
processing. The
procedure is illustrated
in (a) and (b) for a
rectangular
neighborhood.
(c) An aortic
angiogram.
(d) The result is of
size 41 x 41.
The original image is
of size 790 x 686
pixels.
12
of
36
Neighbourhood Operations

 The net effect is to perform local blurring in the


original image. This type of process is used, for
example, to eliminate small details and thus
render “blobs” corresponding to the largest
regions of an image.
13
of
36
Geometric Transformations
 These transformations are called rubber-sheet
transformations because they may be viewed as
analogous to “printing” an image on a rubber sheet, then
stretching or shrinking the sheet according to a predefined
set of rules.
 Geometric transformations of digital images consist of two
basic operations:
 Spatial transformation of coordinates.
 Intensity interpolation that assigns intensity values to
the spatially transformed pixels.
14
of
36
Geometric Transformations
 The transformation of coordinates may be
expressed as:

(i)

Where (x , y) are pixel coordinates in the original image


and (x’ , y’) are the corresponding pixel coordinates of the
transformed image. For example, the transformation of
(x , y) to (x’ , y’) = (x/2 , y/2) shrinks the original image to
half its size in both spatial directions.
15
of
36
Geometric Transformations
 However, it is possible to use homogeneous
coordinates to express all four affine transformations
using a single 3 x 3 matrix in the following general form:

(ii)

This transformation can scale, rotate, translate, or


sheer an image, depending on the values chosen for
the elements of matrix A.
16
of
36
Geometric Transformations
 The key characteristic of an affine transformation in 2-
D is that it preserves points, straight lines, and planes.
 Equation (i) can be used to express the
transformations just mentioned, except translation,
which would require that a constant 2-D vector be
added to the right side of the equation.
 However, it is possible to use homogeneous
coordinates to express all four affine transformations
using a single 3 × 3 matrix in the equation (ii).
17
of
36
Geometric Transformations
18
of
36
Image Registration
 Image registration is an important application of digital image
processing used to align two or more images of the same
scene.
 In image registration, we have available an input image and a
reference image.
 The objective is to transform the input image geometrically to
produce an output image that is aligned (registered) with the
reference image.
 Examples of image registration include aligning two or more
images taken at approximately the same time, but using
different imaging systems, such as an MRI (magnetic resonance
imaging) scanner and a PET (positron emission tomography)
scanner.
19
of
36
Image Registration

(a) A 541 x 421 image of the letter T. (b) Image rotated -21°using nearest-neighbor interpolation for intensity assignments. (c) Image rotated -21°using bilinear interpolation. (d) Image rotated -21°using bicubic interpolation. (e)-(h) Zoomed sections (each square
is one pixel, and the numbers shown are intensity values).
20
of
36
Image Registration
 One of the principal approaches for solving the problem just discussed is to
use tie points (also called control points). These are corresponding points
whose locations
are known precisely in the input and reference images.
 For example, suppose that we have a set of four tie points each in an input
and a reference image. A simple model based on a bilinear approximation is
given by
x = c1 v + c2 w + c3 vw + c4 (iii)
and
y = c5 v + c6 w + c7 vw + c8 (iv)
 During the estimation phase, (v , w) and (x , y) are the coordinates of tie points in the
input and reference images, respectively. If we have four pairs of corresponding tie
points in both images, we can write eight equations using Eqs. (iii) and (iv) and use
them to solve for the eight unknown coefficients, c1 to c8.
21
of
36
Image Registration
 (a) A digital image. (b) Rotated
image (note the counterclockwise
direction for a positive angle of rotation).
(c) Rotated image cropped to fit the
same area as the original image.
(d) Image enlarged to
accommodate the entire rotated image.
22
of
36
Image Registration
 Image registration.
(a) Reference image. (b) Input (geometrically
distorted image). Corresponding tie points are
shown as small white squares near the corners.
(c) Registered (output) image (note the errors in the
border).
(d) Difference between (a) and (c), showing more
registration errors.
23
of
36
Vector & Matrix Operations
 Multispectral image processing is a typical area in which
vector and matrix operations are used routinely. For
example each pixel of an RGB image has three
components, which can be organized in the form of a
column vector

where z1 is the intensity of the pixel in the red image, and z2


and z3 are the corresponding pixel intensities in the green
and blue images, respectively.
24
of
36
Vector & Matrix Operations
 A general multispectral case involving n component
images will result in n-dimensional vectors:

 The inner product (also called the dot product) of two n-


dimensional column vectors a and b is defined as
25
of
36
Vector & Matrix Operations

 Forming a vector from corresponding pixel values in three RGB component


images.
26
of
36
Vector & Matrix Operations
 We can use vector notation to express several of the concepts discussed earlier. For example, the Euclidean distance, D(z,
a), between points (vectors) z and a in
n-dimensional space is defined as the Euclidean vector norm:
27
of
36
Image Transforms
 All the image processing approaches discussed thus far operate directly on
the pixels of an input image; that is, they work directly in the spatial domain.
 A particularly important class of 2-D linear transforms, denoted T(u , v), can
be expressed in the general form
(v)

 where f (x, y) is an input image, r(x, y, u, v) is called a forward


transformation kernel, and the Eq. (v) is evaluated for u = 0, 1, 2, …, M - 1
and v = 0, 1, 2, …, N - 1. As before, x and y are spatial variables, while M
and N are the row and column dimensions of f. Variables u and v are called
the transform variables. T(u, v) is called the forward transform of f(x, y).
28
of
36
Image Transforms
 Given T(u, v) we can recover f (x , y) using the inverse
transform of T(u, v):

(vi)

 for x = 0, 1, 2, …, M - 1 and y = 0, 1, 2, …, N - 1, where s(x,


y, u, v) is called an inverse transformation kernel. Together,
Eqs. (v) and (vi) are called a transform pair.
 General approach for working in the linear transform domain.
29
of
36
Probabilistic Methods
 We treat image intensities as random quantities in numerous places in the
book. For example, let zi, i =0, 1, 2, …, L - 1 denote the values of all possible
intensities in an M × N digital image. The probability, p(zk), of intensity level zk
occurring in the image is estimated as

 where nk is the number of times that intensity zk occurs in the image and MN is
the total number of pixels. Clearly

 Once we have p(zk), we can determine a number of important image


characteristics. For example, the mean (average) intensity and variance of
intensities.

You might also like