Title: Chapter 2: Image Analysis
1Chapter 2 Image Analysis
- Introduction and Preprocessing
2Overview
- Image analysis involves manipulating image data
to provide the info necessary to solve a computer
imaging problem. - It is primarily a data reduction process.
- Extract only the necessary information.
- Used in both computer vision and image processing.
3Overview
- For computer vision, the end product is typically
the extraction of high-level information. - Shape parameters, color and texture features.
- For image processing, it is used to help
determine the type of processing required and the
parameters needed. - Degradation function, enhancement algorithm, and
determining visually important information.
4System Model
5System Model
- Preprocessing is used to remove noise and
eliminate irrelevant, visually unnecessary
information. - This process may involve
- Gray-level or spatial quantization (reduction of
number of bits per pixel or image size). - Finding regions of interest for further
processing.
6System Model
- Data reduction involves either reducing the data
in spatial domain, or transforming it into
another domain (the frequency domain). - Then the data needed for the analysis process is
extracted. - Finally, the extracted features are examined and
evaluated for their use in the application.
7System Model
8System Model
9Preprocessing
- The objective is to make the data reduction and
analysis task easier. - The requirements are typically obvious and
simple. For example - Noise removal.
- Eliminate borders from images digitized from
film. - Mask out rulers in skin tumor slides.
- Convert gray-level image to binary.
10Preprocessing
- Among the preprocessing operations are
- Extracting region of interest.
- Performing basic algebraic operations on images.
- Enhancing specific image features.
- Reducing data in both resolution and brightness.
11Region-of-Interest Image Geometry
- Often, for image analysis, we want to investigate
more closely a specific area within an image. - Region of Interest (ROI).
- This requires operations that modify the spatial
coordinates of the image. - Image geometry operations.
12Region-of-Interest Image Geometry
- Examples of image geometry operations
- Crop, zoom, enlarge, shrink, translate, rotate.
- Crop is the process of selecting a small portion
of the image, and cutting it away from the rest
of the image. - After we have crop the image, we can zoom in on
it by enlarging it.
13Region-of-Interest Image Geometry
14Region-of-Interest Image Geometry
15Region-of-Interest Image Geometry
- The zoom process can be done in numerous ways,
but typically zero-order or first-order hold is
used. - Zero-order Repeating the previous pixel values,
thus creating a blocky effect. - First-order Perform linear interpolation
(averaging) between two pixels. - These methods allow us to enlarge an NxN size
image to a size of (2N-1)x(2N-1).
16Example of First-order Hold
17Region-of-Interest Image Geometry
- Another method that can achieve the same result
(first-order hold) is a mathematical process
called convolution. - The process has two steps
- Extend the image by adding rows and columns of
zeros between the existing rows and columns. - Perform convolution.
18Region-of-Interest Image Geometry
19Region-of-Interest Image Geometry
- Convolution is done using a convolution mask.
20Region-of-Interest Image Geometry
- The convolution process requires us to overlay
the mask on the image, multiply the coincident
values, and sum all these results. - The result is used to substitute the pixel value
that coincide with the center of the mask. - The process is repeated for every pixels in the
image (except the outer ones).
21Region-of-Interest Image Geometry
22Region-of-Interest Image Geometry
23Region-of-Interest Image Geometry
24Region-of-Interest Image Geometry
- Why use convolution instead of basic-averaging-of-
neighbors method? - Many computer imaging board can perform
calculation in hardware. - Convolution can be done very fast in hardware.
- Zero-order hold can also be performed using
convolution. But a different mask is used.
25Region-of-Interest Image Geometry
- Since there is no center pixel, the result need
to be put in the pixel location corresponding to
the lower-right corner.
26Region-of-Interest Image Geometry
- To enlarge by a factor of K (rather than of
2N-1) - Subtract the two adjacent values.
- Divide the result by K.
- Add the result to the smaller value, and keep
adding the result from the second step in a
running total until all (K-1) intermediate pixel
locations are filled. - This is done for every pair of adjacent pixels.
27Region-of-Interest Image Geometry
28Region-of-Interest Image Geometry
- Translation is the process of moving an ROI from
one position to another. - Rotation is the process of rotating an ROI for a
number of degrees. - These two operations can be performed by applying
equations.
29Region-of-Interest Image Geometry
- The equations for translation are given as
follows - r and c are the new coordinates.
- r and c are the original coordinates.
- r0 and c0 are the distances to move or translate
the image.
30Region-of-Interest Image Geometry
- The equations for rotation are given as follows
- r and c are the new coordinates.
- r and c are the original coordinates.
- ? is the angle of rotation of the image, defined
in a clockwise direction from the horizontal axis
at the image origin in the upper left corner.
31Region-of-Interest Image Geometry
- The translation and rotation process can be
combined into one set of equations.
32Region-of-Interest Image Geometry
- After translation, there might be a leftover
space. What to do with it? - There are two options
- Fill with constant values, either black (0) or
white (255). - Wrap around.
33Region-of-Interest Image Geometry
34Region-of-Interest Image Geometry
- After rotation, some part of the image might be
rotated off the screen (the image plane). - How can we view the full, rotated image?
Solution - Translate the image back to the center.
- Enlarge the image plane.
35Region-of-Interest Image Geometry
36Region-of-Interest Image Geometry
37Region-of-Interest Image Geometry
Example of enlarged image plane
38Image Algebra
- There are two categories of algebraic operations
that can be applied to images. - Arithmetic operations
- Addition, subtraction, division and
multiplication. - Logic operations
- AND, OR, NOT
39Image Algebra
- Addition is used to combine information in two
images. - Subtraction is used to detect motion.
- Multiplication and division are used to adjust
brightness of an image. - AND and OR are used to perform a masking
operation (an easy way to extract an ROI). - NOT creates a negative of original image.
40Image Algebra - Addition
41Image Algebra - Addition
42Image Algebra - Addition
43Image Algebra - Subtraction
44Image Algebra - Subtraction
45Image Algebra Multiplication
46Image Algebra Division
47Image Algebra - AND
- Logic operations operate in bit-wise fashion on
pixel data.
48Image Algebra - AND
49Image Algebra - OR
50Image Algebra - NOT
Original image
Result of NOT operation
51Spatial Filters
- Done for noise removal or image enhancement.
- Three types of filters will be discussed
- Mean filters.
- Median filters.
- Enhancement filters.
52Spatial Filters
- Mean and median filters are primarily used to
conceal or remove noise. - They can also be used for special applications.
- For example, mean filter adds softer look to an
image. - The enhancement filters highlight edges and
details within an image.
53Spatial Filters
54Spatial Filters
Enhancement Filter
Original image
Image after enhancement filter is applied
55Spatial Filters
- Many filters are implemented with convolution
masks. - Since the result is a weighted sum of the values
of pixel of its neighbors, it is called a linear
filter. - The overall effect on the image can be predicted
based on the general pattern of the convolution
mask.
56Spatial Filters
- If the coefficients of the mask sum to one,
average brightness is retained. - If the coefficients of the mask sum to zero, the
average brightness will be lost and will return a
dark image. - If the coefficients are alternating positive and
negative, filtering will return edge information. - If the coefficients are all positive, the image
will be blurred.
57Spatial Filters
- Mean filters are averaging filters.
- They replace the center pixel with the average of
neighboring pixels. - The 3x3 mean filter convolution mask
58Spatial Filters
- The result of applying this filter can be
guessed - Coefficients sum to one, therefore the image
brightness is retained. - The coefficients are all positive, therefore it
will blur the image.
59Spatial Filters
- Median filter replaces the center pixel value
with the median value present among its
neighbors. - Median filter is a non-linear filter
- The result cannot be found by a weighted sum of
the neighborhood pixels - It can use a neighborhood of any size, but 3x3,
5x5 and 7x7 are typical.
60Spatial Filters
61Spatial Filters
Median Filter
Original Image
Median-filtered Image
62Spatial Filters
- Enhancement filters will tend to bring out or
enhance details in the image. - We will discuss two types of enhancement filters
- Laplacian filters
- Difference filters
63Spatial Filters
- Two 3x3 convolution masks for laplacian filters
are
64Spatial Filters
- Laplacian filters will enhance detail in all
directions equally. - The difference filters will enhance details in
the direction specific to the mask selected. - There are four difference filter convolution
masks, corresponding to lines in the vertical,
horizontal, and two diagonal directions.
65Spatial Filters
66Spatial Filters
67Spatial Filters
68Spatial Filters
69Spatial Filters
70Spatial Filters
71Image Quantization
- Process of reducing image data by removing some
of the detail information by mapping groups of
data to a single point. - There are two types gray-level reduction and
spatial reduction. - Gray-level reduction
- Reduce the precision of pixel values.
- Map groups of values into one.
72Image Quantization
- Spatial reduction
- Reduce number of pixels.
- Map a group of pixels into one pixels.
- The simplest method of gray-level reduction is
thresholding. - Any pixel above the threshold is set to 1, and
the rest to 0. - This turns a gray-level image into binary image.
73Image Quantization
- A more versatile method of gray-level reduction
is by reducing the number of bits per pixel. - This can be done by masking the lower bits via an
AND operation. - The number of bits that are masked determines the
number of gray-levels available.
74Image Quantization
75Image Quantization
- The general rule goes like this. If we want to
reduce 256 gray levels to n gray levels - Find k such that 256/2k n.
- Mask the lower k bits.
- We can reduce the number of gray-levels to any
power of 2 2, 4, 8, 16, 32, 64, or 128. - As the number of gray-level decreases, contouring
increases.
76Image Quantization
77Image Quantization
78Image Quantization
- Contouring effect can be visually improved by
using IGS (Improved gray-scale) quantization
method. - It takes advantage of human visual systems
sensitivity to edge by adding small random number
to each pixel before quantization. - Results in a more visually pleasing appearance.
79Image Quantization
80Image Quantization
- The AND-based method maps the quantized
gray-level values to the low end of each range. - Alternatively, we can map the quantized
gray-level values to the high end of the range
using an OR operation.
81Image Quantization
82Image Quantization
- The quantized values can also be mapped to the
mid-point of the range. - This is done by an AND after an OR operation, or
an OR after an AND operation.
83Image Quantization
- Although AND/OR method is very efficient, it is
not very flexible since the size of the
quantization bin is not variable. - There are also gray-level quantization methods
that allow for variable bin sizes. - These methods are more complicated and the
variable bin size is application dependent.
84Image Quantization
85Image Quantization
- Quantization in spatial coordinates results in
reducing the size of the image. - This is accomplished by taking groups of pixels
that are spatially adjacent and mapping them to
one pixel.
86Image Quantization
- This can be done in one of three ways
- Averaging Find the average of the pixels
(highest visual quality). - Median Sort the pixels from lowest to highest
and find the median. - Decimation Simply choose one of the pixel
(lowest visual quality).
87Image Quantization
- The quality of a decimation quantization image
can be improved by preprocessing the image with
an averaging, or mean spatial filter. - This type of filtering is called anti-aliasing
filtering.