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

DIP Lecture4 5

This document discusses digital image fundamentals related to pixel neighborhoods and relationships. It defines 4-neighbors and 8-neighbors of a pixel as the horizontally, vertically, and diagonally adjacent pixels. Connectivity and paths between pixels are also defined based on 4, 8, or m-adjacency. Distance measures like Euclidean, city-block, and chessboard distances are introduced. Linear and non-linear operations are distinguished, with examples of arithmetic and maximum operations. Averaging multiple noisy images is presented as a method to reduce noise through its zero-mean property.

Uploaded by

Rabiah Khanum
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)
15 views

DIP Lecture4 5

This document discusses digital image fundamentals related to pixel neighborhoods and relationships. It defines 4-neighbors and 8-neighbors of a pixel as the horizontally, vertically, and diagonally adjacent pixels. Connectivity and paths between pixels are also defined based on 4, 8, or m-adjacency. Distance measures like Euclidean, city-block, and chessboard distances are introduced. Linear and non-linear operations are distinguished, with examples of arithmetic and maximum operations. Averaging multiple noisy images is presented as a method to reduce noise through its zero-mean property.

Uploaded by

Rabiah Khanum
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/ 82

DIP

Digital Image Fundamentals


Lecture # 4-5

Based on chapter 2 from DIP Gonzalez & Woods


2.5 Some
Basic Relationships
between
Pixels
Neighbors of a Pixel (1/2)
 A pixel p at coordinates (x,y) has four(4) horizontal
and vertical neighbors. The coordinates of these
neighbors are given by (x+1,y),(x-1,y),(x,y+1) and (x,y-1)

 The above set of pixels is called the 4-neighbours of


p denoted by N4(p)
 Each pixel is a unit distance from (x,y)
Neighbors of a Pixel (2/2)
The four (4) diagonal neighbors of p have coordinates
(x+1,y+1),(x+1,y-1),(x-1,y+1) and (x-1,y-1)

N8(p)

The above set of pixels is denoted by – ND(p).


These pixels, together with 4-neighbours are called 8-neighbors
of p and is denoted by N8(p).
N8(p) = N4(p) U ND(p)
Connectivity
Connectivity forms the basis for establishing the boundaries of an objects and
also components of regions in an image.
To establish whether two pixels are connected:
1. Whether the pixels are adjacent (E.g. are they 4-neighbours)
2. Whether their gray levels satisfy a specified criterion of similarity (E.g.
equal or belongs to a set – falls within a given range)

• 4- adjacency – Two pixels p and q with values from V are 4-adjacent if q is


in the set N4(p) { v is the set of gray levels used to define adjacency}
• 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:
1. q is in N4(p) or
2. q is in ND(p) and the intersection of (N4(p) and N4(q)) is empty
Example
 N4(p): 4-neighbors and ND(p): 4-diagonal neighbors
 Whereas N8(p) = N4(p) ND(p) : 8-neighbors
 Adjacency:
 V: a set of gray levels s.t. if a pixel’s gray level in V,
it will be used to establish adjacency

q s q s
p p p p
r r
Example: Adjacency

Left: Arrangement of pixels


Middle: pixels that are 8-adjacent (shown dashed) to the center of pixel
Right: m-adjacency
Path (or Curve)
A path from pixel p with coordinates (x,y) to pixel q with coordinates
(s,t) is a sequence of distinct pixels with coordinates
(x0,y0),(x1,y1),…,(xn,yn) where (x0,y0)=(x,y) and (xn,yn)=(s,t), and (xi,yi)
is adjacent to (xi-1,yi-1), 1  i  n, where n is the length of the path.

It is possible to define 4-, 8-, or m-paths depending on the


type of adjacency specified.

m-adjacency eliminates some of the multi-path connections that


arise from 8-adjacency
Some Definitions
 Let S be a subset of pixels in an image
 Two pixels p & q are said to be connected in S if there
exists a path between them consisting entirely of pixels
in 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, the set S is
called a connected set
 Let R be a subset of pixels in an image
 R will be a region of the image if R is a connected set
 The boundary ( border or contour) of a region R is a set
of pixels in that region that have one or more neighbors
that are not in R
Distance Measures(1/2)
• For pixels p,q, and z with coordinates (x,y),(s,t)and (v,w), respectively,
D is a distance functions if:

(a) D( p, q)  0 ( D( p, q)  0 iff p  q)
(b) D( p, q)  D(q, p), and
(c) D( p, z )  D( p, q)  D(q, z )

Euclidean Distance between p and q is defined as :

De ( p, q )  [ x  s ]2  ( y  t ) 2 ]1/ 2

City-Block Distance (D4) between p and q is defined as

D4 ( p, q )  x  s  y  t
Distance Measures (2/2)
Chessboard Distance (D8) between p and q is defined as

D8 ( p, q )  max( x  s , y  t )

De – 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)
D4 – Pixels having a D4 distance from (x,y) less than or equal to
some value r form a diamond centered at (x,y).
D8 – Pixels having a D8 distance from (x,y) less than or equal to
some value r form a square centered at (x,y).
Practice Question 1
 Consider the two image subsets, S1 & S2,
shown. For V = {1}, determine whether
these two subsets are
4-adjacent, 8-adjacent or m-adjacent

S1 S2
0 0 0 0 0 0 0 1 1 0
1 0 0 1 0 0 1 0 0 1
1 0 0 1 0 1 1 0 0 0
0 0 1 1 1 0 0 0 0 0
0 1
0 1 1 1 0 0 1 1
Solution – Practice Question 1
Practice Question 2
 Consider the image segment shown.
(a) Let V = {0,1} and compute the lengths of
the shortest 4-, 8-, and m-path between p
and q. If a particular path does not exist
between these two points, explain why.
(b) Repeat V = {1,2}.

3 1 2 1(q)
2 2 0 2
1 2 1 1
(p)1 0 1 2
Solution – Practice Question 2
2.6 Introduction to
Basic Mathematical Tools used in
Digital Image Processing

 This section has two principal objectives


 To introduce various mathematical tools used in
digital image processing and
 To help you begin developing a “feel” for how
these tools are used by applying them to a
variety of basic image-processing tasks
Elementwise Versus Matrix
Operations
 An elementwise operation involving one or
more images is carried out on a pixel-by-
pixel basis
 As studied earlier that images can be
viewed equivalently as matrices
 There are many situations in which operations
between images are carried out using matrix
theory
 It reason that a clear distinction must be made
between elementwise and matrix operations
Elementwise Versus Matrix
Operations
 For example, consider the following 2 X 2 images (matrices):
11 12 11 12
21 22 21 22
 The elementwise product (often denoted using the symbol
or ) of these two images is

 That is, the elementwise product is obtained by multiplying


pairs of corresponding pixels
 On the other hand, the matrix product of the image is form
using the rules of matrix multiplication:
Linear Versus Non-Linear
Operations -Linear
 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):

 Given two arbitrary constants, a and b, and two arbitrary


images f1(x,y) and f2(x,y), , is said to be a linear operator
if

1 2 1 2 1 2

 By definition an operation that fails to satisfy above


equation [Eq. (2-23) in book] is said to be nonlinear
Linear Versus Non-Linear
Operations - Nonlinear
 Now Suppose that we are working with the max operation
whose function is to find the maximum value of the pixels in
an image. Consider the following two images

1 1

and suppose that let a=1 and b=-1 .To test for linearity, we
again start with the left side of Eq. on last slide [Eq. (2-23)
in book]

 Working next with the right side, we obtain

 The left and right sides of Eq. (2-23) are not equal in this
case, so we have proved that the max operator is nonlinear
Arithmetic Operations
 Arithmetic operations between two images f(x,y) and g(x,y)
are denoted as

 These are elementwise operations which means that they


are performed between corresponding pixel pairs in f and g
for x=0,1,2,…,M-1 any y=0,1,2,…,N-1. where, as usual, M and N
are the row and column sizes of the images
 Also s, d, p, and v are images of size M X N
 Note that image arithmetic involves images of the same size
Example – Using Addition
(Averaging) for Noise Reduction
 Suppose that g(x,y) is image formed by corrupted
by the addition of noise η(x,y) to a noiseless image
f(x,y)

where the assumption is that at every pair of
coordinates (x,y), the noise is uncorrelated and
has zero average value. It is also assumed that
noise and image values are uncorrelated (this is a
typical assumption for additive noise)
 Question is how to reduce the noise content in the
output image?
Example – Using Addition
(Averaging) for Noise Reduction
 The noise content in output image can be reduced by adding
a set of noisy images {gi(x,y)} – A technique used for image
enhancement
 lf the noise satisfies the constraints stated (in last slide), it
can be shown that if an image is formed by averaging
K different noisy images:
𝐾
1
𝑔 (𝑥, 𝑦) = 𝑔𝑖 (𝑥, 𝑦)
Then it follows: 𝐾
𝑖=1

and 2 2
𝑔 (𝑥,𝑦 )  (𝑥,𝑦 )

where 𝐸 {ḡ(𝑥, 𝑦)} is the expected value of and 𝜎ḡ(𝑥,𝑦 ) are


2

the variances of and respectively. These


variances are arrays of same size as the input image
Example – Using Addition
(Averaging) for Noise Reduction
 The standard deviation (square root of the variance) at any
point in the average image is
𝑔 (𝑥,𝑦)  (𝑥,𝑦)

 As K increases, Eqs. (2-28) and (2-29) {above and on last slide}


indicate that
 Variability (as measured by the variance or the standard
deviation) of the pixel values at each location (x, y) decreases
 Because , this means that approaches the
noiseless image f(x,y) as the number of noisy images used in
the averaging process increases
 An important application of image averaging in the field of
astronomy where
 Imaging under very low light levels often cause sensor
noise to render single images virtually useless for analysis
 Next slide shows its example
Image of Galaxy Corrupted by Noise

 Figure 2.29(a) shows an 8-bit image of the galaxy pair NGC 3314, in which
corruption was, simulated by adding to it Gaussian noise with zero mean and
a standard deviation of 64 intensity levels
 This image which is representative of noisy astronomical images taken under low
light conditions is useless for all practical purposes
 Figure 2.29(b) to (f) shows the results of 5, 10, 20, 50 and 100 images
Practice Question 3
 Show that image averaging can be done
recursively. That is, show that if a(k) is the
average of k images, then the average of
k+1 images can be obtained from already-
computed average, a(k), and the new image
fk+1
 Solution Hint: Use following expression of
average of k image to find average of k+1
image
Solution – Practice Question 3
Example – Comparing Images using Subtraction
(Enhancing Difference between Images)

 (a) Infrared image of Washington DC area. Image in Fig. 2.30(b)


was obtained by setting to zero the least-significant bit of every
pixel in Fig. 2.30(a). Visually these images are indistinguishable.
 Fig. 2.30(c) shows, subtracting one image from other clearly shows
their differences. Black (0) values in the difference image indicate
locations where there is no difference between the images in Figs.
2.30(a) and (b)
Example – Comparing Images using Subtraction

 Figs. 2.31(a) shows the difference between the 930 dpi and 72 dpi
images in Fig. 2.23
 It can be observed that the differences are quite noticeable
 The next two images in Fig. 2.31 show proportionally less overall
intensities, indicating smaller differences between the 930 dpi
image and 150 dpi and 300 dpi images
Medical Imaging – Mask Mode Radiography
 Area of Medical imaging called mask mode radiography is a
 Commercially successful and highly beneficial use of Image
subtraction
 Consider image differences of the form

where h(x,y) is the mask of an X-ray image of a region of a


patients body captured by an intensified TV camera (instead of
traditional X-ray film)
 The procedure consists of
 Injecting an X-ray contrast medium into the patient’s bloodstream,
taking a series of images called live images [samples of which are
denoted as f(x,y)] and
 Subtracting the mask from the series of incoming live images after
injection of the contrast medium
 The net effect of subtracting the mask from each sample live image
is that the areas that are difference between f(x,y) and h(x,y)
appear in the output image, g(x,y) as enhanced detail
 Next slide shows the phenomenon
Example – Digital Subtraction Angiography

 Figure 2.32(a) shows a mask X-ray image of the top of a patient’s head prior
to injection of an iodine medium into the bloodstream
 Fig. 2.32(b) is a sample of a live image taken after the medium was injected.
Figure 2.32(c) is the difference between (a) and (b)
 The difference is clear in Fig. 2.32(d) which was obtained by sharpening the
image and enhancing its contrast
Practice Question 4
 Image subtraction is often used in industrial
applications for detecting the missing components
in product successfully. The approach is to store a
“golden” image that corresponds to the correct
assembly; this image is then subtracted from
incoming images of same product. Ideally, the
differences would be zero if new products are
assembled correctly. Difference images for
products with missing components would be
nonzero in the area where they differ from the
golden image. What conditions do you think have
to be met in practical for this method to work?
Solution – Practice Question 4 (1/5)
 Let g (x,y) denote the golden image, and let f(x,y)
denote any input image acquired during routine
operation of the system
 Change detection via subtraction is based on computing
the difference d(x,y) = g(x,y) — f(x, y)
 The resulting image, d(x,y) , can be used in two
fundamental ways for change detection
 One way is to use pixel-by-pixel analysis. In this case
we say that
 f(x, y) is "close enough" to the golden image if all the pixels in
d(x,y) fall within a specified threshold band [Tmin,Tmax] where
Tmin, is negative and Tmax is positive
 Usually, the same value of threshold is used for both negative
and positive differences, so that we have a band [-T, T] in
which all pixels of d(x,y) must fall in order for f(x,y) to be
declared acceptable
Solution – Practice Question 4 (2/5)
 The second major approach is simply to
 Sum all the pixels in |d(x,y)| and
 compare the sum against a threshold Q
 Note that the absolute value needs to be used to
avoid errors canceling out in the sum
 This is a much cruder test, so we will concentrate
on the first approach
 There are three fundamental factors that need tight
control for difference-based inspection to work:
(1) proper registration
(2) controlled illumination, and
(3) noise levels that are low enough so that difference
values are not affected appreciably by variations due
to noise
Solution – Practice Question 4 (3/5)

 The first condition basically addresses the


requirement that
 Comparisons be made between corresponding
pixels
 Two images can be identical, but
 If they are displaced with respect to each
other, comparing the differences between them
makes no sense
 Often, special markings are manufactured into
the product for mechanical or image-based
alignment
Solution – Practice Question 4 (4/5)

 Controlled illumination ("illumination" is not limited


to visible light) obviously is important because
 Changes in illumination can affect dramatically the values
in a difference image
 One approach used often in conjunction with
illumination control is
 Intensity scaling based on actual conditions
 For example, the products could have
 One or more small patches of a tightly controlled color,
and
 Intensity (and perhaps even color) of the pixels in the
entire image would be modified based on the actual
versus expected intensity and/or color of the patches in
the image being processed
Solution – Practice Question 4 (5/5)
 Finally, the noise content of a difference image
needs to be low enough so that
 it does not materially affect comparisons between the
golden and input images.
 Good signal strength goes a long way toward
reducing the effects of noise. There are a number
if variations of the basic theme just described.
 For example, additional intelligence in the form of
tests that are more sophisticated than pixel-by-
pixel threshold comparisons can he implemented
 A technique used often in this regard is to subdivide the
golden image into different regions and perform
different (usually more than one) tests in each of the
regions, based on expected region content
Using image multiplication & division for
shading correction & for masking

 An important application of image multiplication


(and division) is shading correction
 Suppose that an imaging sensor produces images
that can be modeled as the product of a “perfect
image" denoted by f(x,y), times a shading function
h(x,y), that is:

 If h(x,y) is known or can be estimated, we can


obtain f(x,y) (or an estimate of it) by
 Multiplying the sensed image by the inverse of h(x,y)
(i.e.. dividing g by h using elementwise division)
 Next slide shows the example
Example – Using image multiplication &
division for shading correction & for masking
 Figure 2.33 shows an example of shading correction using an estimate
of the shading pattern. The corrected image is not perfect because of
errors in the shading pattern (this is typical), but the result definitely
is an improvement over the shaded image in Fig 2.33 (a).
Illustration of Set Operations involving
Grayscale Images - Complement
 Let the elements of a gray-scale image be represented by a set A
whose elements are triplets of the form (x,y,z), where x and y are
spatial coordinates and z denotes intensity values. We define the
complement of set A as the set

which is the set of pixels of A whose intensities have been


subtracted from a constant K. This constant is equal to maximum
intensity value in the image 2k-1 where k is the number of intensity
bits used to represent z.
 Let A denote the 8-bit grayscale image in Fig. 2.36(a) {on slide
after next slide} and suppose that we want to form the negative of
A using grayscale set operations. The negative is the set
complement, and this is an 8-bit, so all we have to do is let K = 255
in the set defined above:
Set Operations involving Images – Union
 The union of two grayscale sets A and B with same
number of elements is defined as the set

where the max operation is applied to pairs of


corresponding elements
 If A and B are grayscale images of the same size
 Union is an array formed from the maximum intensity between
pairs of spatially corresponding elements
 As an illustration, suppose that
 A represents the image in Fig. 2.36(a) {next slide} and
 Let B denote a rectangular array of the same size as A but in
which all values of z are equal to 3 times the mean intensity, z’,
of the elements of A
 Figure 2.36(c) {next slide} shows the results of performing set
union, in which all values exceeding 3 appear as values from A and
all other pixels have value 3, which is a mid-gray value
Example – Set Operations using
Grayscale Images
Summary – Arithmetic
Operations
- Used extensively in Image Processing

- Each operation on an entire image is carried out


pixel by pixel.
- Image Addition : E.g. Image Averaging to reduce
noise
- Image subtraction: E.g. to remove static
background information
- Image Multiplication/Division: correct gray level
shading resulting from non-uniformities in
illumination or in the sensor used to acquire the
image.
Practice Question 5
 Referring to following equation

(a) Show that image summation is a linear operation


(b) Show that image subtraction is a linear operation
(c) Show that image multiplication is a nonlinear operation
(d) Show that image division is a nonlinear operation
Solution – Practice Question 5
 Using 1 2 1 Eq. A (2.23 of book)
2
(a) For image summation: using LHS of Eq. (A)

using RHS of Eq. A

1 2 1 1 2 2 1 2

The LHS and RHS are equal so summation is linear

Using same methodology: solve (b), (c) and (d)


Solution – Practice Question 5
Solution – Practice Question 5
Solution – Practice Question 5
Logical Operations
The principle logic operations used in Image Processing are AND, OR and
COMPLEMENT.
AND: p AND q (also p . q)
OR: p OR q (also p + q)
COMPLEMENT: NOT q (also q)

• Logic operations apply only to binary images, whereas arithmetic


operations apply to multi-valued pixels.
• Logic operations are basic tools in binary image processing, where they are
used for such tasks as masking, feature detection and shape analysis.
• Logic operations on entire images are done pixel by pixel.
Logical Operations
B1 NOT(B 1)

NOT

B1 B2 B 1 A ND B 2

A ND

B 1 OR B 2

OR

B 1 A ND [N OT (B 2)]
A ND -
NOT

B 1 X OR B 2

X OR
Spatial Operations

 Spatial operations are performed


directly on the pixels of an image
 Spatial operations can be classified
into three categories:
 Singlepixel operations
 Neighborhood operations
 Geometric spatial transformations
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:

 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
Example –
Single-Pixel Operations
 Below shows the transformation used to
obtain the negative (sometimes called the
complement) of an 8-bit image
Neighborhood 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
 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.
Neighborhood Operations
 For example, suppose that the specified operation is
to compute the
 Average value of the pixels in a rectangular neighborhood of
the size m x n centered on (x,y).
 The coordinates of pixels in this region are the
elements of set Sxy
 Figure 2.39(a) and (b) illustrate the process
Neighborhood Operations
 We can express this averaging operation
(discussed on previous slide) as

(𝑟,𝑐 )=𝑆𝑥𝑦

where r and c are the row an column coordinates


of the pixels whose coordinates are in the set Sxy
 Image g is created by varying the coordinates
(x,y) so that the center of the neighborhood
moves from pixel to pixel in image f, and then
repeating the neighborhood operation at each new
location.
 Example on next slide
Example – Neighborhood Operations
 The image below (Fig. 2.39(d) of book) was created in this
manner using a neighborhood of size 41x41.
 The net effect is to perform local blurring in the original image
 This type of process can be used to eliminate small details and
thus render blobs corresponding to the largest regions of an
image
Geometric spatial Transformations
 Geometric transformations
 Modify the spatial arrangement of pixels in an image

 It consist of two basic operations


1. Spatial transformation of coordinates
2. Intensity interpolation that assigns intensity values to the
spatially transformed pixels
 The transformation of coordinates may be expressed as

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 (x’,y’) = (x/2,y/2)
shrinks the original image to half its size in both spatial
directions
Affine Transformations
 Affine transformations include
 Scaling, translation, rotation and shearing

 All above four affine transformations can be expressed


using a single 3x3 matrix as:
11 12 13
21 22 23

 This transformation can scale, rotate, translate, or sheer an


image, depending on the values chosen for the elements of
matrix A
 The preceding transformation moves the coordinates of
pixels in an image to new locations
 To complete the process -> Assign intensity values to those locations.
This task is accomplished using intensity interpolation
 Table 2.3 shows matrix values to implement transformations
Affine Transformations
Example – Image Rotation &
Intensity Interpolation
 Example Objective
 To illustrate image rotation using an affine
transform
 On next slide
 Figure 2.40(a) shows a simple image and Figs.
2.40(b)-(d) are the results (using inverse
mapping) of rotating the original image by -21°
 Intensity assignments were computed using
nearest neighbor. bilinear, and bicubic
interpolation, respectively.
Example – Image Rotation & Intensity Interpolation

255 255

255
255 0 255 255 247

0 168 154

0 77 45

0 0
0 0
Image Registration
 Image registration used to
 Align two or more images of the same scene
 An important application of digital image processing

 Registration Method
 Have an input image and a reference image
 Input image is geometrically transformed to
produce an output image that is aligned (registered)
with the reference image
 The geometric transformation needed to produce
the output registered image generally is not known,
and must be estimated
Examples – Image Registration
 Example of image registration
 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
 Another Example of image registration
 Images taken at different times using the same
instruments, such as satellite images of a given location
taken several days, months, or even , years apart
 Image registration can be used to combine the images or
performing quantitative analysis and comparisons between
them. It requires
 Compensating for geometric distortions caused by
differences in viewing angle, distance, orientation, sensor
resolution, shifts in object location, and other factors
Image Registration – Tie Points

 One of the principal approaches is to use tie points


(also called control points).
 These are corresponding points whose locations
are known precisely in the input and reference
images
 Approaches for selecting tie points range from
 Selecting them interactively to using algorithms
that detect these points automatically
 The Problem of estimating the transformation
function is one of modeling
 Next slide describes the example for calculating
tie point
Example – Tie Points
 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

 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 above two equations and using them to
solve for the eight unknown coefficients, c1 through c8
 Once we have the coefficients, above two equations can be
used for
 Transforming all the pixels in the input image
 The result is the desired registered image
Example – Image Registration
 In next slide, Figure 2.42(a) shows a reference image and Fig.
2.42(b) shows the same image, but distorted geometrically by
vertical and horizontal shear
 Our objective is to use the reference image to obtain tie points
and then use them to register the images
 The tie points we selected (manually) are shown as small white
squares near the corners of the images (We needed only four tie
points because the distortion is linear shear in both directions)
 Figure 2.42(c) shows the registration result obtained using these
tie points in the procedure discussed in the preceding paragraphs
 Observe that registration was not perfect, as it evident by the
black edges in Fig. 2.42(c)
 The difference image in Fig. 2.42(d) shows more clearly the slight
lack of registration between the reference and corrected images
 The reason for the discrepancies is error in the manual selection
of the tie points. It is difficult to achieve perfect matches for
tie points when distortion is so severe
Example – Image Registration
Image Transforms
 In some cases, image processing tasks are best
formulated by
 Transforming the input images, carrying the specified task
in a transform domain, and
 Applying the inverse transform to return to the spatial
domain
 Number of different transforms exists in literature
 A particular important class of 2-D linear
transforms, denoted T(u,w) can be expressed in the
general form as 𝑀−1 𝑁−1

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


𝑥=0 𝑦=0

forward transformation kernel, and above Eq. is


evaluated for u = 0,1,2, …, M-1 and v = 0,1,2,…, N-1.
Variables u and v are called the transform variables.
T(u,v) is called the forward transform of f(x,y)
Image Transforms
 We can recover f(x,y) using the inverse transform
of T(u,v): 𝑀−1 𝑁−1

𝑓(𝑥, 𝑦) = 𝑇(𝑢, 𝑣)𝑠(𝑥, 𝑦, 𝑢, 𝑣)


𝑢=0 𝑣=0
for x = 0,1,2, …, M-1 and y = 0,1,2,…, N-1 and ,
where s(x,y,u,v) is called an inverse transformation
kernel.
 Together, above Eq. and Eq. on previous slide are
called a transform pair
 Figure below shows the basic steps for performing
image processing in the linear transform domain
T(u, v) R[T(u, v)]
Operation Inverse
f (x, y) Transform g(x, y)
R transform
Spatial Spatial
domain Transform domain domain
Image Transforms
 A transform of particular importance in digital
image processing is the Fourier transform, which
has the following forward and inverse kernels:

 Substituting preceding kernels into the general


transforms formulations in Eqs. (of last 2 slides)
gives us the discrete Fourier transform pair:
𝑀−1 𝑁−1
𝑢𝑥 𝑣𝑦
−𝑗2𝜋( + )
𝑀 𝑁
𝑥=0 𝑦=0
𝑀−1 𝑁−1
𝑢𝑥 𝑣𝑦
𝑗2𝜋( + )
𝑀 𝑁
𝑥=0 𝑦=0
Image Processing in the Transform Domain
 In next slide -> Figure 2.45 (a) shows an image corrupted by
periodic (sinusoidal) interference.
 This type of interference can be caused, for example, by
a malfunctioning imaging system
 This interference in
 Spatial domain appears as waves of intensity
 Frequency domain manifests itself as bright bursts of
intensity whose location is determined by the frequency
of sinusoidal interference
 Typically, the bursts are easily observable in an image of the
magnitude of the Fourier transform
 Figure 2.45(c) shows a mask image (called a filter) with
white and black representing 1 and 0, respectively
 To remove the burst -> multiply the filter by transform
 Next slide shows the whole phenomenon
Example – Image Processing in the
Transform Domain
Magnitude and Phase of DFT
 What is more important?

magnitude phase
 Hint: use the inverse DFT to reconstruct the
input image using magnitude or phase only
information
 See next slide
Magnitude and Phase of DFT ..
Reconstructed image using
magnitude only
(i.e., magnitude determines the
strength of each component!)

Reconstructed image using


phase only
(i.e., phase determines
the phase of each component!)
Image Intensities as Random Variables
 Image intensities can be treated as
 Random quantities in digital image processing

 For example, let zi = 0,1,2,….,L-1 denotes the values


for all possible intensities in an MXN digital image
 The probability of intensity level occurring in an
image is estimated as

 Where nk is number of times that intensity zk


occurs in the image and MN is the total number of
pixels, clearly, 𝐿−1

𝑘
𝑘=0

 Once we have p(zk) , a number of important image


characteristics can be determined
A random variable is a variable whose possible values are outcome of random
phenomenon; whereas random phenomenon is a situation in which we know that
outcomes could happen, but we don’t know which particular outcome will happen
Example – Image Characteristics using
Image Intensities as Random Variables
 Mean (average) intensity is given by
𝐿−1

𝑘 𝑘
𝑘=0
 Similarly, the variance of the intensities is
𝐿−1
2 2
𝑘 𝑘
𝑘=0

 The variance is a measure of the spread of


the values of z about the mean, so it is a
useful measure of image contrast
Example – Image Characteristics using
Image Intensities as Random Variables
 In general, the nth moment of random variable about
the mean defined as 𝐿−1

𝜇𝑛 (𝑧) = (𝑧𝑘 − 𝑚)𝑛 𝑝(𝑧𝑘 )


𝑘=0
We see that μ0(z)=1, μ1(z)=0 and μ2(z)=σ2
 Higher-order moments are more subtle. For example
 A positive third moment indicates that the intensities are
biased to values higher than the mean whereas a negative
third moment would indicate the opposite condition
 A zero third moment would tell that the intensities are
distributed approximately equally on both sides of the mean
 These features are useful for computational purposes,
but they do not tell us much about the appearance of
an image in general
Definition: The “moments” of a random variable (or of its distribution) are
expected values of powers or related functions of the random variable
Why do we process images?
 To facilitate their storage and transmission
 To prepare them for display or printing
 To enhance or restore them
 To extract information from them
 To hide information in them
Assignment 1 (CLO1) – Selected
Problems from Fundamentals of
Image Processing (Gonzalez & Woods
4th Ed)
 Problem 2.1  Problem 2.24
 Problem 2.4  Problem 2. 26
 Problem 2.5  Problem 2.29
 Problem 2.8  Problem 2.36
 Problem 2.10  Problem 2.40
 Problem 2.22
Quiz 1
THE END

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