0% found this document useful (0 votes)
21 views21 pages

Week 5

The document discusses geometric operations and affine transformations in image processing, explaining how these transformations maintain the properties of shapes and lines. It also covers interpolation methods used for resizing images, detailing techniques like nearest neighbor and bilinear interpolation, as well as the effects of different interpolation algorithms on image quality. Additionally, it introduces intensity transformations and spatial filtering methods, including log and power-law transformations, aimed at enhancing image contrast and dynamic range.

Uploaded by

wang chaoyu
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)
21 views21 pages

Week 5

The document discusses geometric operations and affine transformations in image processing, explaining how these transformations maintain the properties of shapes and lines. It also covers interpolation methods used for resizing images, detailing techniques like nearest neighbor and bilinear interpolation, as well as the effects of different interpolation algorithms on image quality. Additionally, it introduces intensity transformations and spatial filtering methods, including log and power-law transformations, aimed at enhancing image contrast and dynamic range.

Uploaded by

wang chaoyu
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

Geometric Operations

• MAPPING AND AFFINE TRANSFORMATIONS

The case where functions and are linear combinations of x and y is called affine
transformation.

The above equation could be rewritten as matrix form

• Affine mapping transforms straight lines to straight lines, triangles to triangles,


and rectangles to parallelograms. Parallel lines remain parallel and the distance
ratio between points on a straight line does not change.

Copyright © 2015, 2011, 2007 Pearson Education, Inc. All Rights Reserved
Geometric Operations
• MAPPING AND AFFINE TRANSFORMATIONS

• Four of the most common geometric operations—translation, scaling, rotation,


and shearing—are all special cases of the above equation, as summarized in the
Table.

Copyright © 2015, 2011, 2007 Pearson Education, Inc. All Rights Reserved
Geometric Operations
• MAPPING AND AFFINE TRANSFORMATIONS

• For example: Generate the affine transformation matrix for each of the operations
below: (a) rotation by 30◦; (b) scaling by a factor 3.5 in both dimensions; (c)
translation by [25, 15] pixels; (d) shear by a factor [2, 3]. Use MATLAB to apply
the resulting matrices to an input image of your choice.

The transformation should be:

a)

b)

Copyright © 2015, 2011, 2007 Pearson Education, Inc. All Rights Reserved
Geometric Operations
• MAPPING AND AFFINE TRANSFORMATIONS

• For example: Generate the affine transformation matrix for each of the operations
below: (a) rotation by 30◦; (b) scaling by a factor 3.5 in both dimensions; (c)
translation by [25, 15] pixels; (d) shear by a factor [2, 3]. Use MATLAB to apply
the resulting matrices to an input image of your choice.

The transformation should be:

c)

d)

Copyright © 2015, 2011, 2007 Pearson Education, Inc. All Rights Reserved
Interpolation Methods
• After a geometric operation has been performed on the original image, the resulting value
for each pixel can be computed in two different ways. The first one is called forward
mapping—also known as source-to-target mapping—and consists of iterating over every
pixel of the input image, computing its new coordinates, and copying the value to the new
location.

• If you were asked to write code to enlarge or reduce an image by a certain factor (e.g., a
factor of 2 in both directions), you would probably deal with the problem of removing
pixels (in the case of shrinking) by subsampling the original image by a factor of 2 in both
dimensions, that is, skipping every other pixel along each row and column. Conversely, for
the task of enlarging the image by a factor of 2 in both dimensions, you would probably
opt for copying each original pixel to an n × n block in the output image. These simple
interpolation schemes (pixel removal and pixel duplication, respectively) are fast and easy
to understand, but suffer from several limitations:

Copyright © 2015, 2011, 2007 Pearson Education, Inc. All Rights Reserved
Interpolation Methods
• Image Interpolation happens anytime you resize or remap (distort) your image from one
pixel grid to another. Image resizing is necessary when you need to increase or decrease
the total number of pixels, whereas remapping can occur under a wider variety of
scenarios: correcting for lens distortion, changing perspective, and rotating an image.

• Even if the same image resize or remap is performed, the results can vary significantly
depending on the interpolation algorithm. Itis only an approximation, therefore an image
will always lose some quality each time interpolation is performed. This tutorial aims to
provide a better understanding of how the results may vary — helping you to minimize any
interpolation-induced losses in image quality.

Copyright © 2015, 2011, 2007 Pearson Education, Inc. All Rights Reserved
Interpolation Methods
• 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:

• If you had an additional measurement at 11:30AM, you could see that the bulk of the
temperature rise occurred before noon, and could use this additional data point to perform
a quadratic interpolation:

Copyright © 2015, 2011, 2007 Pearson Education, Inc. All Rights Reserved
Interpolation Methods
• NEAREST NEIGHBOR 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.

 Zero-order (Nearest-Neighbor) interpolation: This baseline interpolation scheme rounds off


the calculated coordinates to their nearest integers. Zero-order (or nearest-neighbor)
interpolation is simple and computationally fast, but produces low-quality results.
 First-Order (Bilinear) Interpolation: First-
order (or bilinear) interpolation calculates
the gray value of the interpolated pixel as a
weighted function of the gray values of the
four pixels (2*2) surrounding the reference
pixel in the input image. Bilinear
interpolation produces visually better results
than the nearest-neighbor interpolation at the
expense of additional CPU time.

Copyright © 2015, 2011, 2007 Pearson Education, Inc. All Rights Reserved
Interpolation Methods
• NEAREST NEIGHBOR INTERPOLATION

 Higher order interpolations are more


sophisticated—and computationally
expensive—methods for interpolating the
gray value of a pixel. The third-order
interpolation scheme implemented in several
MATLAB functions is also known as bicubic
interpolation. It takes into account the 4×4
neighborhood around the reference pixel and
computes the resulting gray level of the
interpolated pixel by performing the
convolution of the 4×4 neighborhood with a
cubic function.

Copyright © 2015, 2011, 2007 Pearson Education, Inc. All Rights Reserved
Courses topics at glance
Introduction Segmentation
Image Compression
Matlab Basic Intensity-based and Coding
segmentation
What is Digital
Image Processing Region-based
Segmentation
Image Restoration
and Reconstruction

Digital Image Feature Extraction


Spatial domain filtering
Fundamentals
Intensity Transformation
Image Sensing and
Acquisition Image Pattern
Histogram Processing
Classification
Arithmetic and Logic Fundamentals of Spatial
Operation Filtering AI-based Image
Geometric Operations Pattern Recognition
Perform Image
Convolution
Intro to Digital Image Advanced to Digital
Processing Image Processing
Copyright © 2015, 2011, 2007 Pearson Education, Inc. All Rights Reserved
Background
• All the image processing techniques discussed in this chapter are
implemented in the spatial domain, which we know from the
discussion in Section 2.4 is the plane containing the pixels of an
image. Spatial domain techniques operate directly on the pixels of an
image, as opposed, for example, to the frequency domain (the topic
of Chapter 4) in which operations are performed on the Fourier
transform of an image, rather than on the image itself. As you will
learn in progressing through the book, some image processing tasks
are easier or more meaningful to implement in the spatial domain,
while others are best suited for other approaches.

Copyright © 2015, 2011, 2007 Pearson Education, Inc. All Rights Reserved
The basics of intensity transformations and
spatial filtering
• The spatial domain processes we discuss in this chapter are based on
the expression

• where f (x, y) is an input image, g(x, y) is the output image, and T is


an operator on f defined over a neighborhood of point (x, y). The
operator can be applied to the pixels of a single image (our principal
focus in this chapter) or to the pixels of a set of images. Intensity
transformations are among the simplest of all image processing
techniques. As noted in the previous section, we denote the values of
pixels, before and after processing, by r and s, respectively. These
values are related by a transformation T, as given in above Eq., that
maps a pixel value r into a pixel value s.
• Image Negatives

The negative of an image with intensity levels in the range [0, L-1]is
obtained by using the negative transformation function shown as below,
which has the form: Copyright © 2015, 2011, 2007 Pearson Education, Inc. All Rights Reserved
Definition

• Point operation:
A(x, y) - Input B(x, y) - Output

• Point operations modify way in which


image fills available gray-scale range.
• Also called contrast enhancement,
contrast stretching and gray-scale
transformations (GST).

Copyright © 2015, 2011, 2007 Pearson Education, Inc. All Rights Reserved
Mathematical Definition of Point
Operation

A(x, y) - Input B(x, y) - Output

Copyright © 2015, 2011, 2007 Pearson Education, Inc. All Rights Reserved
Image Negatives
The negative of an image with intensity levels in the range [0, L-1]is
obtained by using the negative transformation function shown as below,
which has the form:

Copyright © 2015, 2011, 2007 Pearson Education, Inc. All Rights Reserved
Image Negatives
• Reversing the intensity levels of a digital image in this manner
produces the equivalent of a photographic negative. This type of
processing is used, for example, in enhancing white or gray detail
embedded in dark regions of an image, especially when the black
areas are dominant in size. Figure 3.4 shows an example. The original
image is a digital mammogram showing a small lesion. Despite the
fact that the visual content is the same in both images, some viewers
find it easier to analyze the fine details of the breast tissue using the
negative image.

Copyright © 2015, 2011, 2007 Pearson Education, Inc. All Rights Reserved
Log Transformations
• The log transformation and its inverse are nonlinear transformations used, respectively,
when we want to compress or expand the dynamic range of pixel values in an image.
Log transformations can be mathematically described as

• where r is the original pixel value, s is the resulting pixel value, and c is a constant.
The shape of the log curve is that this transformation maps a narrow
range of low intensity values in the input into a wider range of output
levels. We use a transformation of this type to expand the values of
dark pixels in an image, while compressing the higher-level values.
• This example uses the log transformation to improve the visualization and display of
Fourier transform (FT)4 results (Figure 8.10). The range of values in the matrix in part
(a) is [0, 2.8591 × 104], which—when displayed on a linearly scaled 8-bit system—
makes it hard to see anything but the bright spot at the center. Applying a log transform,
the dynamic range is compressed to [0, 10.26].

Copyright © 2015, 2011, 2007 Pearson Education, Inc. All Rights Reserved
Log Transformations
• This example uses the log transformation to improve the visualization and display of
Fourier transform (FT)4 results (Figure 8.10). The range of values in the matrix in part
(a) is [0, 2.8591 × 104], which—when displayed on a linearly scaled 8-bit system—
makes it hard to see anything but the bright spot at the center. Applying a log transform,
the dynamic range is compressed to [0, 10.26].

Copyright © 2015, 2011, 2007 Pearson Education, Inc. All Rights Reserved
Power-law (GAMMA) Transformations
• Power-law transformations have the form

• where c and g are positive constants. The following figures shows plots
of s as a function of r for various values of gamma. As with log
transformations, power-law curves with fractional values of gamma
map a narrow range of dark input values into a wider range of output
values, with the opposite being true for higher values of input levels.

Copyright © 2015, 2011, 2007 Pearson Education, Inc. All Rights Reserved
Piecewise Linear Transformation Functions
• Low-contrast images can result from poor illumination, lack of dynamic
range in the imaging sensor, or even the wrong setting of a lens
aperture during image acquisition. Contrast stretching expands the
range of intensity levels in an image so that it spans the ideal full
intensity range of the recording medium or display device.

• Above figure shows a typical transformation used for contrast


stretching. The locations of points and and the transformation is a
linear function that produces no changes in intensity. If = =0, and =L-1
the transformation becomes a thresholding function that creates a
binary image.
Copyright © 2015, 2011, 2007 Pearson Education, Inc. All Rights Reserved
Piecewise Linear Transformation Functions
• Intermediate values of ) and ) produce various degrees of spread in the
intensity levels of the output image, thus affecting its contrast. In
general, < , it prevents the creation of intensity artifacts. Figure 3.10(b)
shows an 8-bit image with low contrast.

Copyright © 2015, 2011, 2007 Pearson Education, Inc. All Rights Reserved

You might also like