You are on page 1of 8

1

Statistical Description Statistical Description


of Images of Images - - KL KL
Ing-Tsung Hsiao
Dept MIRS
Chang Gung University
Statistical Description
In a set of images, we need the statistical
description of images, so that we can capture
the common characteristics.
To represent an image with fewer bits and
reconstruct it with minimum error on
average
Approximate an image in
MMSE
KL transforman transform that
allows its representation in terms of
uncorrelated data with minimum
mean square error
Random Field
A Spatial function that assigns a random
variable at each spatial position
Random variable the value assigned to
the outcome of a random experiment
How do we describe random
variables
In terms of Distribution functions =>
the probability of an event happening
An event a collection of outcomes of
the random experiment
Probability
1. All possible outcomes prob = 1
2. The prob of two events without common
outcomes = sum of these two events
The distribution of a R.V.
The distribution of a r.v. f is a function which
tells us how likely it is for f to be less than the
argument of the function
} Pr{ ) ( z f z P
f
s =
0 ) ( =
f
P 1 ) ( = +
f
P
2
PDF: prob density function
r
T
c
h f h g =
Mean and Variance
Many R.V.s
Relationship bwt R.V.s
Uncorrelated
Example
Show that if the covariance of two random
variables is zero, the two variables are
uncorrelated
ij
c
Define a random field
t
Example
t
3
Example
t
Two RVs in the same Random Field
t
Two RVs in the same Random Field
t
Two RVs in two different Random Fields
t
Example Homogeneous RF
If the expectation value of a random field does
not depend on r, and if its autocorrelation
function is translation invariant, then the field
is called homogeneous.
4
Example Spatial Statistics in a RF
Ergodic
A random field is ergodic
when it is ergodic w.r.t. the mean and
w.r.t. the autocorrelation function
Ergodic w.r.t. the mean
A random field is ergodic w.r.t. the mean, if it is
homogeneous and its spatial average, , is
independent of the outcome on which f depends
It is a constant and is equal to the ensemble average
defined by
as
) (
i
e
dz r z zp r f E r
f i f
) ; ( )} ; ( { ) (
}
+

= = e
Ergodic w.r.t. the autocorrelation function Example
5
Example Example
Example Example
Example Example
6
Example What is the implication of Ergodicity?
IF an ensemble of images is ergodic, then we
can calculate its mean and autocorrelation
function by simply calculating spatial averages
over any image of the ensemble images.
Ergodicity for reducing info transmission
IF we can transmit uncorrelated pixel
values, then we can maximize the
transmitted info.
Invoke ergodicity to calculate the
necessary transformation
Autocorrelation of a RF with Uncorrelated RVs
The autocorrelation function of two
uncorrelated RVs defined at positions r1 and r2
If these two RVs are with zero-mean, then
If an image g is represented by a column vector, the
we have integer indices, i.e. i and j, then the
AutoCorr function R
gg
becomes a 2-dim matrix.
For uncorrelated zero mean data, Rgg is a diagonal
matrix with diagonal elements = variances at each
pixel
)} ; ( { )} ; ( { ) , (
2 1 2 1 i i ff
r f E r f E r r R e e =
) , (
2 1
r r R
ff
otherwise
r r r f E
r r R
i
ff
2 1
2
1
2 1
if
0
} ) ; ( {
) , (
=

=
e
To Transform an Image st. its autoCorr matrix is
diagonal
Assume the transformation takes the form:
) (
~
m g A g =
A: the transformation matrix; g=original image
m=arbitrary vector, and = transformed image
Assume ergodicity, then the mean vector is
g
~
) ( )} ( { }
~
{ ~ m A m g A E g E
g g
= = =
Note that: taking expectation means ensemble average, but
since we assume ergodicity simply finding average grey
value of g, and then all the elements of E{g} will be equal to
this value.
Transform an Image st. its autoCorr matrix is
diagonal II
We can conveniently choose
so that has zero mean 0 ~ =
g

Since it has zero mean, then its AutoCorr function


( ) is equal to its AutoCovariance function
( ) as:
g
~
} {g E m
g
= =
} )] ( )[ ( { }
~ ~
{ ~ ~
T T
g g
m g A m g A E g g E C = =
} ) )( ( {
T T
A m g m g A E =
T T
g g
A g g E A }] ) )( {( [ =
T
gg
A AC =
} )
~
)(
~
{( ~ ~
T
g g
g g E
}
~ ~
{
T
g g E
7
Transform an Image st. its autoCorr matrix is
diagonal III
Since
g g
C ~ ~
T
gg
A AC =
If we choose A by the eigenvectors of , then
becomes a diagonal matrix, and its diagonal
elements are the eigenvalues of
gg
C
g g
C ~ ~
gg
C
Note: the AutoCovariance matrix of g can be
calculated from the image itself since we assumed
ergodicity (no ensemble images are needed).
gg
C
then we can transform an image st its autoCorr
matrix is a diagonal matrix.
Calculate Spatial AutoCorr Matrix of an Image? 1
An NxN Image matrix with index (k, l)
transformed into column vector (put row-by-row in
the image matrix) at position i, then
i i
l N k i + = * ) 1 (
then we can from each index i, we have
1 ) 1 (
mod
+ =
N i
i k
N k i l
i i
* ) 1 ( =
for example, for an 64x64 image, at pixel (10,10),
what is i ?
Also, in its vector form, if j =1000, then what is its
corresponding (k,l) ?
Calculate Spatial AutoCorr Matrix of an Image? 2
Element of the AutoCorr matrix is averaging
over all pairs of pixels in the same relative position
where and are the same for all
pixels i and j. We can find:
j i
k k
j i
l l
Then the AutoCorr matrix becomes
ij
C
> =<
j i ij
g g C
] * ) 1 ( [ ] * ) 1 ( [
0
N k j N k i l l l
j i j i
= =
] ) 1 [( ] ) 1 [(
mod mod 0 N N j i
j i k k k = =
N k k j i
j i
* ) ( ] [ =
0 0 ,
, , ,
0 0
l k l k g g C
l l k k kl ij
> =<

We need to decide the range for both k and l.
There are two conditions for k:
and
Calculate Spatial AutoCorr Matrix of an Image? 3
Since
These two lead to
N k k s s
0
1 N k s s 1
) , min( ) 1 , 1 max(
0 0
k N N k k + s s +
Same for and
And thus
N l l s s
0
1 N l s s 1
) , min( ) 1 , 1 max(
0 0
l N N l l + s s +
0 0 ,
, , ,
0 0
l k l k g g C
l l k k kl ij
> =<

Calculate Spatial AutoCorr Matrix of an Image? 4
Finally

+
+ =
+
+ =

=
) , min(
) 1 , 1 max(
) , min(
) 1 , 1 max(
, 2
0
0
0
0
0 0
1
k N N
k k
l N N
l l
l l k k kl
g g
N
0 0 ,
, , ,
0 0
l k l k g g C
l l k k kl ij
> =<

] * ) 1 ( [ ] * ) 1 ( [
0
N k j N k i l l l
j i j i
= =
] ) 1 [( ] ) 1 [(
mod mod 0 N N j i
j i k k k = =
N k k j i
j i
* ) ( ] [ =
Approximate g from its KL transformation
If we set the last few eigenvalues of C
gg
equal to 0,
then matrix A will have its corresponding rows
replaced by zeros, and so will the transformed g
~
8
Example Example
If we set the last few eigenvalues of C
gg
equal to 0,
then matrix A will have its corresponding rows
replaced by zeros, and so will the transformed g
~
Example
eigenimages
. 3 31 . 2 21 . 1 11
~ ~ ~
e g e g e g g
g
+ + + =
Error of approximation Using KL Transform
If we use only the first few eigenvalues of C
gg
to
express the original image, then the error of the
approximation is g g
~


+ = = =
=
2 2
1 1 1
N
K i
i
K
i
i
N
i
i

The error of the approximation is

You might also like