Feature Extraction - Main
Feature Extraction - Main
and Analysis
Content
•Introduction
•Feature Extraction
• Shape Features - Binary Object Features
• Histogram Features
• Color Features
• Spectral Features
•Feature Analysis
• Feature Vectors and Feature Spaces
• Distance and Similarity Measures
IMAGE FEATURE EXTRACTION
IMAGE
FEATURE TO
REPRESENTATION
OBJECT
CLASSIFICATION
FEATURE DESCRIPTION
PRESERVING
GENERAL APPLICATION EDGE BASED REGION BASED
FEATURE SPECIFIC FEATURES SPATIAL
NON
PRESERVING
PIXEL STRUCTURAL STRUCTURAL
FREQUENCY
GLOBAL
FEATURE CLASSIFICATION
TYTYPES OF FEATURE EXTEXTRACTION
TYPES OF FEATURE EXTRACTION
PES OF FEATURE EXTRACTION
SHAPE FEATURE
Introduction
The goal in image analysis is to extract useful information for solving
application-based problems.
The first step to this is to reduce the amount of image data using
methods that we have discussed before:
◦ Image segmentation
◦ Filtering in frequency domain
Introduction
The next step would be to extract features that are useful in solving
computer imaging problems.
What features to be extracted are application dependent.
After the features have been extracted, then analysis can be done.
Shape Features
Depend on a silhouette (outline) of an image
All that is needed is a binary image
Binary Object Features
In order to extract object features, we need an image that has
undergone image segmentation and any necessary morphological
filtering.
This will provide us with a clearly defined object which can be labeled
and processed independently.
Binary Object Features
After all the binary objects in the image are labeled, we can treat each
object as a binary image.
◦ The labeled object has a value of ‘1’ and everything else is ‘0’.
The area Ai is measured in pixels and indicates the relative size of the
object.
height1 width1
Ai I ( r, c)
r 0 c 0
i
Binary Object Features – Center of Area
The center of area is defined as follows:
height1 width1
1
ri
Ai
rI ( r, c)
r 0 c 0
i
height1 width1
1
ci
Ai
cI ( r, c)
r 0 c 0
i
height1 width1
2 ( r r )(c c ) I i ( r, c)
1 1
i tan height1 width1 r 0 c0
2 height1 width1
( r r ) I i ( r, c ) (c c ) I i ( r, c)
2 2
r 0 c 0 r 0 c 0
Binary Object Features – Axis of Least Second
Moment
Ai
Ti 4 2
i
P
Binary Object Features – Thinness Ratio
The thinness ratio is used as a measure of roundness.
◦ It has a maximum value of 1, which corresponds to a circle.
◦ As the object becomes thinner and thinner, the perimeter becomes larger
relative to the area and the ratio decreases.
Binary Object Features – Irregularity Ratio
The inverse of thinness ration is called compactness or irregularity ratio,
1/T.
This metric is used to determine the regularity of an object:
◦ Regular objects have less vertices (branches) and hence, less perimeter
compare to irregular object of the same area.
Binary Object Features – Aspect Ratio
The aspect ratio (also called elongation or eccentricity) is defined by the
ratio of the bounding box of an object.
This can be found by scanning the image and finding the minimum and
maximum values on the row and column where the object lies.
Binary Object Features – Aspect Ratio
The equation for aspect ratio is as follows:
cmax cmin 1
rmax rmin 1
It reveals how the object spread in both vertical and horizontal
direction.
High aspect ratio indicates the object spread more towards horizontal
direction.
Binary Object Features – Euler Number
Euler number is defined as the difference between the number of
objects and the number of holes.
◦ Euler number = num of object – number of holes
In the case of a single object, the Euler number indicates how many
closed curves (holes) the object contains.
Binary Object Features – Euler Number
Euler number can also be found using the number of convexities and
concavities.
◦ Euler number = number of convexities – number of concavities
This can be found by scanning the image for the following patterns:
0 0 0 1
0 1 1
1
Convexities Concavities
Binary Object Features – Projection
The projection of a binary object, may provide useful information
related to object’s shape.
It can be found by summing all the pixels along the rows or columns.
◦ Summing the rows give horizontal projection.
◦ Summing the columns give the vertical projection.
Binary Object Features – Projection
We can defined the horizontal projection hi(r) and vertical projection
vi(c) as:
width1
hi ( r ) I ( r, c)
c 0
i
height1
vi ( c ) I ( r, c)
r 0
i
N (g)
P( g )
M
P(g) : probability of gray level g in image
N(g) : number of pixel with gray level g in image
M : total number of pixel in image
Histogram Features
The features based on the first-order histogram probability are
◦ Mean
◦ Standard deviation
◦ Skew
◦ Energy
◦ Entropy.
Histogram Features – Mean
The mean is the average value, so it tells us something about the
general brightness of the image.
◦ A bright image has a high mean.
◦ A dark image has a low mean.
L 1 height1 width1
I ( r, c)
Mean g gP( g )
g 0 r 0 c 0 M
Histogram Features – Standard Deviation
The standard deviation, which is also known as the square root of
the variance, tells something about the contrast.
It describes the spread in the data.
◦ Image with high contrast should have a high standard deviation.
L 1
g (
g 0
g g ) 2
P( g )
Histogram Features – Skew
The skew measures the asymmetry (unbalance) about the mean in the
gray-level distribution.
Image with bimodal histogram distribution (object in contrast
background) should have high standard deviation but low skew
distribution (one peak at each side of mean).
Histogram Features – Skew
Skew can be defined in two ways:
L 1
1
SKEW
g 3 (g g )
g 0
3
P( g )
g mod
SKEW '
g
In the second method, the mod is defined as the peak, or highest value.
Histogram Features – Energy
The energy measure tells us something about how gray levels are
distributed.
The equation for energy is as follows:
L 1
ENERGY P( g )
2
g 0
Histogram Features – Energy
The energy measure has a value of 1 for an image with a constant value.
This value gets smaller as the pixel values are distributed across more
gray level values.
A high energy means the number of gray levels in the image is few.
◦ Therefore it is easier to compress the image data.
Histogram Features – Entropy
Entropy measures how many bits do we need to code the image data.
The equation for entropy is as follows:
L 1
ENTROPY P( g ) log2 P( g )
g 0
As the pixel values are distributed among more gray levels, the entropy
increases.
Color Features
Useful in classifying objects based on color.
Typical color images consist of three color planes: red, green and blue.
◦ They can be treated as three separate gray-scale images.
Mask g(k , l)
Spectral Images
The primary metric for spectral features (frequency-domain-based
features) is power.
Power is defined as the magnitude of the spectral component squared.
POWER T (u, v )
2
T (u, v)
2
Spectral Re gionPower
uREGION vREGION
Spectral Images
Spectral Images
Spectral Images
The ring measure can be used to find texture:
◦ High power in small radii corresponds to smooth textures.
◦ High power in large radii corresponds to coarse texture.
The sector power measure can be used to find lines or edges in a given
direction, but the results are size invariant.
Feature Analysis
Important to aid in feature selection process
Initially, features selected based on understanding of the problem and
developer’s experience
FA then will examine carefully to see the most useful & put back through
feedback loop
To define the mathematical tools – feature vectors, feature spaces, distance
& similarity measurement
Feature Vectors
A feature vector is a method to represent an image or part of an image.
A feature vector is an n-dimensional vector that contains a set of values
where each value represents a certain feature.
This vector can be used to classify an object, or provide us with
condensed higher-level information regarding the image.
Feature Vector
Let us consider one example:
x1
Distance & Similarity
Measures
Feature vector is to present the object and will be used to classify it
To perform classification, need to compare two feature vectors
2 primary methods – difference between two or similarity
Two vectors that are closely related will have small difference and large
similarity
Distance Measures
Difference can be measured by distance measure in n-dimensional feature
space; the bigger the distance – the greater the difference
Several metric measurement
◦ Euclidean distance
◦ Range-normalized Euclidean distance
◦ City block or absolute value metric
◦ Maximum value
Distance Measures
Euclidean distance is the most common metric for measuring the
distance between two vectors.
Given two vectors A and B, where:
A a1 a2 ... an
B b1 b2 ... bn
Distance Measures
The Euclidean distance is given by:
n
i i
a b 2
a1 b1 2 a2 b2 2 ... an bn 2
i 1
n
ai bi 2 Ri is the range of the
i 1 Ri
2
ith component.
Distance Measures
Another distance measure, called the city block or absolute value
metric, is defined as follows:
n
a i 1
i bi
This metric is computationally faster than the Euclidean distance but
gives similar result.
Distance Measures
The city block distance can also be range-normalized to give a range-
normalized city block distance metric, with Ri defined as before:
n
a i bi
i 1 Ri
Distance Measures
The final distance metric considered here is the maximum value metric
defined by:
max{ a1 b1 , a2 b2 ,..., an bn }
The normalized version:
a1 b1 a2 b2 an bn
max{ , ,..., }
R1 R2 Rn
Similarity Measures
The second type of metric used for comparing two feature vectors is the
similarity measure.
The most common form of the similarity measure is the vector inner
product.
Using our definition of vector A and B, the vector inner product can be
defined by the following equation:
Similarity Measures
n
a b a b
i 1
i i 1 1 a 2 b2 ... a n bn
This similarity measure can also be ranged normalized:
n
ai bi a1b1 a 2 b2 a n bn
2
2 2
... 2
i 1 Ri R1 R2 Rn
Similarity Measures
Alternately, we can normalize this measure by dividing each vector
component by the magnitude of the vector.
n
ai bi a1b1 a 2 b2 .. a n bn
n n
n n
a b a b
i 1 2 2 2 2
j j j j
j 1 j 1 j 1 j 1
Similarity Measures
When selecting a feature for use in a computer imaging application, an
important factor is the robustness of the feature.
A feature is robust if it will provide consistent results across the entire
application domain.
For example, if we develop a system to work under any lightning
conditions, we do not want to use features that are lightning
dependent.
Similarity Measures
Another type of robustness is called RST-invariance.
◦ RST means rotation, size and translation.
8-DIRECTIONAL CODE
301122
ADVANTAGE OF CHAIN CODE:
Information of interest is preserved.
It is a compact representation of an image.
A chain code is prior condition for image analysis.
It is translation invariant.
But it is not rotation & scale invariant.
It represents any change occurring in direction,
indicating the corner points.
Problems in chain code:
1) Starting point of code determines chain code.
So any change in rotation or size affects the chain
code in unnormalized form.
2. Merging
1. Fit & split method
This method is useful for following reasons:
i. Noise elimination
ii. Absence of relevant feature
iii. Absence of change in vertices
iv. Simplification of shape
Procedure for method :
1. Divide boundary into small segment & fit a line for
each segment.
x axis x axis
Bending energy
Thank You!