Sei sulla pagina 1di 43

DIGITAL IMAGE PROCESSING

SIGNAL & IMAGE


PROCESSING & RECOGNITION
Prof. Silvana Dellepiane

2013/2014

Department of Electrical, Electronic, Telecommunications Engineering and Naval Architecture (DITEN)


University of di Genoa- ITALY

A.6 Texture Analysis


Prof. Silvana Dellepiane

A.A. 2013/2014

Department of Electrical, Electronic, Telecommunications Engineering and Naval Architecture (DITEN)


University of di Genoa- ITALY

TEXTURE ANALYSIS
Texture is characterized by the spatial organization of elementary structures called
texels (TEXture element). The texel is a visual primitive, characterized by the
property of invariance, which is spatially repeated in a given area, although
deformed, rotated, and shifted. Texture provides important information about
the spatial arrangement of the grey levels, then about their relationship with the
surrounding elements.

Depending on the use of these primitives in the analysis of weaving process we


can classify two main classical approaches: the structural and the statistical
approach.
3

STRUCTURAL METHODS
They are looking for the primitives at the basis of the weave development,
describing its generation in general terms. This approach is appropriate to the
description of textures characterized by a strong regularity, from which we can
extract precise production rules. As a consequence, this approach is suitable for
the image analysis of artificial objects compared with the description of natural
scenes, for which neither generating primitives nor patterns are uniform and
constant. A grammar is definitely a very powerful method for the description of
the generation rules of a regular texture; the grammar describes how to generate
a pattern by applying production rules, recursively, to a small set of symbols.
Zucker (1976) has postulated that a natural texture can be described through
structural rules, before building an orderly and regular weaving through
patterns and grammars, and then distort it to make it natural, with deterministic
or stochastic rules (Fu, 1974). However, as we have already pointed out, even
with this kind of approach the results of natural textures are usualy
unsatisfactory.
4

STRUCTURAL METHODS
Example
Suppose we have a production rule in the form:
S aS ; a = " replicate to the right "
The production indicates the S form that can be written through the rule a applied
to itself (recursively). If the rule a indicates to replicate the texel (or primitive
element) to the right you can get a pattern of type Texture "A".
Now we suppose to add another production rule:
S bS baS ; b = " replicate in the lower right ";
We'll get a texture of type Texture "B"
Texel

Regola di produzione A

Regola di produzione B

Texture "A"

Texture "B"

STATISTICAL METHODS
Generally a natural texture does not have the characteristics of regularity that
allow you to take full advantage of the potentialities offered by structural
methods. The changes that it reveals cannot be described by more or less
regular forms, but through a classification that uses statistical models. Indeed
statistical parameters related to the structure of the image are used as local
features.
We will see in more detail:
Methods based on first-order statistics;
Methods based on filters;
Methods based on transforms;
Methods based on second-order statistics;
Fractal geometry

First-order analysis
PARAMETERS BASED ON THE HISTOGRAM
Some features can be extracted by analysing the histogram (statistical description
of grey level occurrencies).
Statistical analysis of a distribution is usually carried out by using the moments of
order k.
Let us define l the grey level index and p(l) the related probabilitymaxof occurrence.
The first-order absolute moment, i.e., the mean value, is
The central moment of order k is:
max

k l m p(l )
l 0

m l p(l )
l 0

First-order analysis
PARAMETERS BASED ON THE HISTOGRAM
Useful first-order statistical parameters are:
max

MEAN (m)

k l m p(l )
k

l 0

VARIANCE (2) is an indicator of the region uniformity; only if we have an


uniform grey level, its value is 0.
SKEWNESS (3) it indicates how the histogram is symmetrical, its value is 0 if
the histogram is perfectly symmetrical about the mean value.
KURTOSIS (4) indicates the similarity with a normal distribution.

First-order analysis
PARAMETERS BASED ON THE HISTOGRAM

ENTROPY () indicates the disorder degree of the distribution; the maximum value
is related to the uniform distribution.
Entropia log 2 p (l ) p (l )
l

First-order features can be computed for the whole image or on small windows
(local parameters).

First-order analysis
PARAMETERS BASED ON THE HISTOGRAM

Original SIDNEY
10

Local Mean image

First-order analysis
PARAMETERS BASED ON THE HISTOGRAM

mean
11

variance

METHODS BASED ON FILTERS


In the image spatial domain one can apply local filtering and take the
outputs of different linear filters as parameters for texture
classification.
An example are the masks of Laws
This technique is based on the properties of Laws' functions through
convolution operations with the original signal. Laws introduced a
class of weaving parameters based on the average rate of similarity
between the pixels of a given neighbourhood and a set of standard
masks.

12

METHODS BASED ON FILTERS


Let us now see the construction of the Laws masks .
Given the following three vectors of length 3:
L3 = (1,2,1)
E3 = (1 ,0, 1 )
S3 = (1,2,1)
we make the convolution between them, thus obtaining five vectors
of length 5:
L5 = L3*L3 = (1,4,6,4,1)
local mean (when divided by 16)
S5 = E3*E3 = L3*S3 = (1,0,2,0,1)
spot detection
R5 = S3*S3 = (1,4,6,4,1)
ripple detector
E5 = L3*E3 = (1,2,0,2,1)
edge detection
W5 = E3*S3 = (1,2,0,2,1)
wave detector
13

METHODS BASED ON FILTERS

If we multiply the column vectors of length 3 or 5 with the


corresponding row vectors, we get Laws masks 3x3 or 5x5.
To describe the texture of an image by using these masks we do the
convolution between the image under analysis and the masks and
we use the results as textural parameters.

14

Methods based on transforms:


FOURIER ANALYSIS
Methods based on the spectral Fourier analysis take advantage of the
spatial periodicity of the signal. The spectrum of a periodic signal
has peaks at the fundamental and harmonic frequencies.
If the texture can be thought as a repetition of primitives, we will
consider the different peaks of the spectrum as basic features. If
we globally look at the spectrum it is possible to lose information
on the structure of the texture considered.
We have to consider the spectrum by splitting it in regions, which
may be radial or angular, representative of textural spatial
frequencies and directions.

15

Methods based on transforms:


FOURIER ANALYSIS
Given F(u,v) is the Fourier transform of the image f(x,y), then we can define two
kinds of features: radial and angular.
F (u, v )

f ( x, y )e

j ( ux vy )

dxdy

16

FOURIER ANALYSIS
The radial features Vr1,r2 are defined as:

V (r1 , r2 ) | F (u , v) |dudv
where the integral is performed on the ring between the two rays r1 and r2 that is:
r12 v 2 u 2 r22 ; 0 u,v n 1
Thus we extract a features vector V , using different values of rl and r2.
u

17

FOURIER ANALYSIS
If an image is a quite smooth surface, not wrinkled, the spatial frequencies willbe
very low, and we'll find that for small r1 and r2 radius the vector V components
will be large values.

On the contrary, if we analyze a very wrinkled surface, having high spatial


frequencies, we will have high values of V components corresponding to rings
with high radius values.

18

FOURIER ANALYSIS
The angular spectral features related with the aspect of the structure directionality:

Z (1 , 2 ) | F (u , v) |dudv
The integral is executed in the circular sector region included between the two
angles 1 and 2 that is:
1

1 tan ( v / u) 2 0 u, v n 1

As above, well have a feature vector Z defined for various values of the angles.
With this measure we discriminate the spatial frequencies in different directions. If
a weaving has many lines or edges perpendicular to the direction given by , the
u
corresponding value of Z will be very high.

19

FOURIER ANALYSIS
Original image

20

DFT Magnitude

Second-order analysis:
CO-OCCURRENCE MATRICES

We define a probability matrix related to the directions and to


the step used to analyze the statistics of the L grey levels in a
given image. We indicate p(i,j|,) the probability that a grey
level i follows a grey level j in a scan along the directions
given by the parameter with a step (or distance) . The
p(i,j|,) constitute a probability matrix M(i,j), of size LxL.

M , i, j Pr

21

P2 P1 y

grey level P1 i, grey level P2 j , P2 P1 , atn


2 1 x

CO-OCCURRENCE MATRICES
P2

P1

It is possible to analyze second-order statistics according to


many directions. We analyze pairs of points organized as in the
figure :
i

22

=1, =135

CO-OCCURRENCE MATRICES
Example

of co-occurrence matrices for an image window 5x5:


0
0
Window 4x4 Imagne I =
0

1
M
=
1,0 24

4
2
1
0

2
4
0
0

1
0
6
1

2 1 3

1 1 2 1
M
=
1,135 18 3 1 0

0 0 2

23

0
0
1

2
0
0

0
0
2
2

1
1
2
3

1
1
2

6 0 2

1 0 4 2
M
=
1,90 24 2 2 2

0 0 2

0
0

1 1
M
=
1,45 18 0

0
0

1
2
2
0

0
2
4
1

CO-OCCURRENCE MATRICES
The size of matrix M depends on the numbers of grey levels in the
image. In order to avoid too large matrices, sometimes is suggested
to reduce the grey levels quantization and/or to make a histogram
equalization in order to reduce the number of occurrences.
In the following some parameters are introduced to describe
several texture properties in function of the parameters , and the
window size (it controls the trade-off between spatial resolution
and reliability of statistics); for example the maximum likelihood
max{pij}.

24

CO-OCCURRENCE MATRICES

Examples of parameters:
CONTRAST:

(i j )2 p(i, j )
i, j

p (i, j )

HOMOGENEITY: i , j 1 i j
ENTROPY:
ENERGY:

log 2 p(i,(from
j ) pthe
(i,co-occurrence
j)
matrix)
i, j

i, j

p( i, j )

These parameters are useful to extract the information content of the


matrix M and to provide some features useful for texture classification.
25

CO-OCCURRENCE MATRICES

The first one gives an indication about the most significative


matrix element; the next two provide information about the
dominance of the values on the main diagonal; the last provides
information on the randomness of the spatial distribution.

EXAMPLE:
When a co-occurence matrix has predominant elements on the
main diagonal we say that the texture is compact in the given
direction and distance. It indicates that the texture is
characterized by a repetitiveness with step along the direction
(the contrast gives information about texture repetitiveness,
instead entropy is in relation to the directional anisotropy).

26

CO-OCCURRENCE MATRICES

Sydney IKONOS
27

Contrast

CO-OCCURRENCE MATRICES

Homogeneity
28

CO-OCCURRENCE MATRICES

Entropy
29

CO-OCCURRENCE MATRICES

Energy
30

CO-OCCURRENCE MATRICES

Correlation
31

FRACTAL ANALYSIS

Fractal geometry is a branch of mathematic, recently formalized, particularly


suitable for the modeling, simulation and characterization of natural phenomena and
shapes. The classical Euclidean geometry is not very efficient in the treatment of
chaotic systems frequently present in nature.
To characterize a particolar phenomenon or shape means to describe it through a
certain number of parameters which are significant (i.e, they are able to
discriminate, and give the possibility to reproduce a similar shape).

32

For example, if we want to describe the outline of a very rugged coastline


with segments, curves, or other instruments of Euclidean geometry we
would be forced to use an infinite number of parameters. Fractal geometry
provides tools capable of overcoming these limitations.
The Euclidean geometry objects are characterized by a topological
dimension; the topological dimension of a line is one (one dimension), that
of a surface is two, that of a volume is three, and so on. A line is
characterized by a finite and not null length (for a finite set), but it has area
and volume both null; a surface has an infinite length, a finite and not null
area and a volume equal to zero; similarly for the volume
Line

Length = L
Area = 0
Volume = 0

33

Surface

Length = +
Area = A
Volume = 0

Volume

Length = +
Area = +
Volume = V

To calculate the various values (length, area, etc.) we can proceed in this way :

We consider an element B() of width (a segment, a box, otherwise a sphere)


We count the minimum number N() of elements Bi( ) necessary to cover our set
S (in the example the set is a line).

N ( ) min N :

= 1 cm N() = 13
34

B ( )
i

i 0

=0.5 cm N() = 27

We can evaluate the following measures:

L lim N ( )
- Length:
0

- Area:

- Volume:

A lim 2 N ( )
0

V lim 3 N ( )
0

Starting from these formula we can define a non integer measure


by simply generalizing the exponent ( Hausdorff dimension):

Md lim d N ( )
0

There are some finite sets (curve, surfaces, etc.) which are so folded back on
themselves that does not exist a finite and not null dimension of them
(length, area, etc.).

35

Topological
Dimension
Dt

Fractal
Dimension

1.5

Df

Definition:

We define the fractal dimension D the d value for which the


Hausdorff dimension is finite and not null. That value is :
log N ( )
0
log( )

D lim

36

Example:
The Koch square curve
It is a curve, then it belongs to a one-dimensional Euclidean space, with an unlimited
length and a null area.
a) We start from a unit-length-segment
b) We replace the previous segment with 8 segments with a length of 1/4 as in figure.
c) Recursive repetition of step b) on the generated segments

GENERAZIONE DELLA CURVA


QUADRATICA DI KOCH

Passo 1

37

Passo 2

Passo 3

The length of this curve is:


Step 0:
Step 1:
Step 2:
Step k:

L=1
L = 8*1/4 = 2
L = 8*8*1/16 = 4 ...
L = 8k * 4-k = 23k * 2-2k = 2k

then for k that goes to infinit the length tends to infinit.


Using the previous formula for area and volume and considering a linear element of
analysis B() with k = 2-2 k , k tends to zero for k which tends to infinity we obtain
that:
2
4 k
3k
k

A( ) N ( ) 2

V ( ) 3 N ( ) 26 k 23 k 23 k
When k goes to infinit they tend to zero.
Its fractal dimension is:

D lim
0

38

log N ( )
log( )

lim
k

log 23k

2 k

log(2 )

15
.

FRACTAL DIMENSION FOR IMAGE ANALYSIS


Images are considered as the result of the sampling of a surface in
the three-dimensional space whose axies are (x, y), the grey level
value being the height.
In this case, the fractal dimension characterizes the image in terms
of roughness; thus to a higher fractal dimension corresponds to a
higher roughness, and viceversa, as we can see in these images.

D = 2.10

D = 2.50

Surfaces with different fractal dimension


39

ESTIMATION OF FRACTAL DIMENSION OF


IMAGES
Box-counting method

We divide the three-dimensional space of the image in boxes of size


and count the number N() of boxes containing part of the image. We
can obtain:
N()=k -D
log(N())=log(k)-D log()
If we draw a graph x = log ; y = log N(), we obtain a straight line
with slope -D in a two-logarithmic plane. Therefore the D value can
be estimated in this plane through linear regression.

40

Algorithm: estimate of D for a discretized surface (image) through box-counting


a) we consider a set of k possible scales
(i.e. , from 30 to 5 pixels, 1 = 30, 2 = 25, 3 = 20, ..., n = 5)
b) for each k = 1 n, we divide the image with a box grid of size k and we
count the number N(k)=N(k) of boxes containing at least one pixel.
c) through the linear regression on the two-logarithmic plane of samples
(k N(k)) obtained; we estimate the correct value of D.
ldg

Quadrato di lato

d) This estimate is very sensitive to noise, to grid location, then imprecise.


41

Blanket method

By using the given formula for area and volume, we have that a surface with fractal
dimension D has a volume going to zero, with the following trend:
V( ) = k (3-D) = 3 N( )
To estimate the volume of the image function f(x,y) the blanket method is used which
requires calculation of a superior surface U(x,y,) and inferior surface L(x,y,)
defined as:
U(x,y,) = {set of the points above f(x,y) whose maximum distance from f(x,y) is }
L(x,y,) = {set of the points under f(x,y) whose maximum distance from f(x,y) is }
L(x,y,) < f(x,y) < U(x,y,)
These two surfaces could be easily extracted by applying the morphological
operators of dilation (we obtain U(x,y,)) and erosion (L(x,y,)).
The value of D is estimate in the two-logarithmic plane.

42

BLANKET ALGORITHM
D estimate for a dicretized surface (image):
a)
We consider a set of possible scale dk (ex. From 30 to 5 pixel, d1 = 30, d2 = 25,
d3 = 20, ..., dn = 5)
b)

For each k:
We expand the image with an element of width d k, we elevate the function
of dk obtaining U(x,y,k)

We erode the image with an element of width dk, we subtract to the


function dk obtaining L(x,y,k)

We calculate V(dk)=V(k)

V (k ) U x, y , k L x, y, k
x, y

Through linear regression on the two-logarithmic plane of obtained samples


(dk,V(k)); then we estimate the correct D value ( the slope of regression line is
3 D)

c)

43

Potrebbero piacerti anche