matrix and vector representation of images › ~roseli › pee5830 › pee5830_aula08.pdf · title:...

25
1 © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 1 Matrix and Vector Representation of Images A sampled quantized image may be representation as a matrix or a 2D array of numbers: The image has M rows, each with N elements (N columns). Matrix methods may then be used in the analysis of images. However, images are not merely arrays of numbers certain constraints are imposed on the image matrix due to the physical properties of the image. (Reference: E.L. Hall, “Computer Image Processing and Recognition”, Academic Press, New York, 1979.) } ,..., 2 , 1 ; ,..., 2 , 1 : { ] [ N j M i f f ij = = = M N © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 2 Matrix and Vector Representation of Images 1. Nonnegativity and upper bound: 2. Finite energy: 3. Smoothness: B f ij 0 0 2 1 1 E f E ij N j M i = = = S j f j f j f j f j f j f j f j f f i i i i i i i i ij + + + + + - + + + + - + + - + - + - - - 1 , 1 , 1 1 , 1 1 , 1 , 1 , 1 , 1 1 , 1 8 1

Upload: others

Post on 31-Jan-2021

0 views

Category:

Documents


0 download

TRANSCRIPT

  • 1

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 1

    Matrix and Vector Representation of Images

    • A sampled quantized image may be representation as amatrix or a 2D array of numbers:

    • The image has M rows, each with N elements (N columns).• Matrix methods may then be used in the analysis of images.• However, images are not merely arrays of numbers certain

    constraints are imposed on the image matrix due to thephysical properties of the image.

    (Reference: E.L. Hall, “Computer Image Processing andRecognition”, Academic Press, New York, 1979.)

    },...,2,1;,...,2,1:{][ NjMiff ij ===M

    N

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 2

    Matrix and Vector Representation of Images

    1. Nonnegativity and upper bound:

    2. Finite energy:

    3. Smoothness:

    Bfij ≤≤0

    02

    11

    EfE ijN

    j

    M

    i

    ≤= ∑∑==

    S

    jfjfjf

    jfjf

    jfjfjf

    f

    iii

    ii

    iii

    ij ≤

    +++++−++++−+

    +−+−+−−−

    1,1,11,1

    1,1,

    1,1,11,1

    8

    1

  • 2

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 3

    Matrix and Vector Representation of Images

    The image matrix may be converted to a vector by “rowordering”:

    where f i = [ f(i,1) f(i,2). . . f(i,N)]’ is the ith row vector.

    Column ordering may also be performed.

    Energy (inner product)

    Also, (outer product)

    )1(]’...[ 21 ×= MNffff M

    ∑ ===MN

    i ifffE

    1

    2’

    )’( ffTrE =

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 4

    Matrix and Vector Representation of Images

    If the image elements are considered to be random variables,the image may be seen as a sample of a stochastic process,and characterized by:

    mean

    covariance matrix

    correlation matrix

    E { }: statistical expectation (average) operator.

    )1.(}{ MNfEf =

    )(})’)({( MNMNffffE ×−−

    )(}’{ MNMNffE ×

  • 3

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 5

    Matrix Representation of Linear Systems Relationship

    Considering the 1D linear shift-invariant system forsimplicity, we have the input-output relationship given by theconvolution integral.

    • The limits depend upon causality, the nature of h (IIR, FIR),and whether the convolution desired is linear or circular.

    • While causality is an inherent property of physical 1D signalprocessing systems, it is not always relevant in the 2D caseas blurring typically occurs in all directions.

    • The limits also depend on the reference origin chosen,whether at the sample or at the center of the signal.

    ∫ −=b

    adthftg τττ )()()( hf g

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 6

    Matrix Representation of Linear Systems Relationship

    1. IIR (Infinite Impulse Response)

    Consider the systems to be causal, with input starting at t = 0.

    ∫ −=t

    dthftg0

    )()()( τττ

    )()()(0

    jkhjfkgk

    j

    −= ∑=

  • 4

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 7

    Matrix Representation of Linear Systems Relationship

    2. FIR (Finite Impulse Response, Non-causal)

    ∫+

    −−=

    2/

    2/)()()(

    Tt

    Ttdthftg τττ

    )()()(2/

    2/

    jkhjfkgMk

    Mkj

    −= ∑+

    −=

    )2/()2/()(0

    jMhMkjfkgM

    j

    −−+= ∑=

    movingwindow

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 8

    Matrix Representation of Linear Systems Relationships

    3. Periodic or Circular Convolution

    T > (T1 + T2) to avoid wrap-around errors;T, T1, and T2 are the durations of g, f, and h, respectively;subscript p indicates periodic versions of the signals.

    )()()(1

    0

    jkhjfkg ppM

    jp −=∑

    =

    ∫ −=T

    PPP dthftg 0 )()()( τττ

  • 5

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 9

    Matrix Representation of Linear Systems Relationships

    Convolution as Matrix Operation

    1. IIR

    H is Toeplitz-like. There will be zeros in the lower-left portion of H ifh has fewer samples than f and g: H is then said to be banded.

    Hfg =

    =

    )(

    :

    )(

    :

    )2(

    )1(

    )0(

    )0(......)(

    :

    ...)(

    :

    )0()1()2(

    )0()1(

    )0(

    )(

    :

    )(

    :

    )2(

    )1(

    )0(

    Nf

    Mf

    f

    f

    f

    hNh

    Mh

    hhh

    hh

    h

    Ng

    Mg

    g

    g

    g

    )()()(0

    jkhjfkgk

    j

    −= ∑=

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 10

    Matrix Representation of Linear Systems Relationships

    Convolution as Matrix Operation

    2. FIR

    H is banded and Toeplitz-like.Each row (except the first) is a right-shift of the previous row.

    Hfg =

    +

    =

    2

    :

    :

    :

    :2

    1

    2

    2...

    20

    :

    :

    :

    :

    02

    ......)0(......2

    0

    02

    ......)0(...122

    )(

    :

    :

    :

    )2(

    )1(

    )0(

    MNf

    Mf

    Mf

    Mh

    Mh

    Mhh

    Mh

    Mhh

    Mh

    Mh

    Ng

    g

    g

    g

    )2/()2/()(0

    jMhMkjfkgM

    j

    −−+= ∑=

  • 6

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 11

    Matrix Representation of Linear Systems Relationships

    3. Periodic or Circular Convolution

    But

    and by periodicity.

    Therefore

    and so on.

    )()()(1

    0

    jkhjfkg ppM

    jp −=∑

    =

    )()( kMhkh p −=−

    ),1()1(...)1()1()0()0()0( +−−++−+= MhMfhfhfg ppppppp

    ppp fHg =

    )1()1(...)1()1()0()0()0( ppppppp hMfMhfhfg −++−+=

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 12

    Matrix Representation of Linear Systems Relationships

    −−−

    −−−

    =

    − )1(

    )1(

    )0(

    )0()3()2()1(

    )2()1()0()1(

    )1()2()1()0(

    )1(

    )1(

    )0(

    Mf

    f

    f

    hMhMhMh

    hMhhh

    hMhMhh

    Mg

    g

    g

    p

    p

    p

    pppp

    pppp

    pppp

    p

    p

    p

    ...

    . . .

    ......

    . . .. . .

    • Each row of Hp is a right-shift (circular-shift) of the previousrow.

    • Hp is square.• Hp is a circulant matrix.• An important property of a circulant matrix is that it is

    diagonalized by the DFT.

    )()()(1

    0

    jkhjfkg ppM

    jp −=∑

    =

  • 7

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 13

    Matrix Representation of Linear Systems Relationships

    Consider the general circulant matrix

    Let

    Then, Wk, k = 0, 1, 2,…,N - 1, are the N distinet roots of unity,as Wkn = 1.

    Now consider

    −−−

    =

    )0()3()2()1(

    )2()1()0()1(

    )1()2()1()0(

    CCCC

    NCCCNC

    NCCCC

    C

    . . .

    ...

    . . .. . .

    1,2

    exp −=

    = i

    NiW

    π

    .)1(...)2()1()0()( )1(2 kNkk WNCWCWCCk −−++++=λ

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 14

    Matrix Representation of Linear Systems Relationships

    i.e., λ(k)W(k) = CW(k),were W(k) = [ 1Wk W2k…W(N-1)]’ .• Thus λ(k) is an eigenvalue and W(k) is an eingenvector of the

    circulant matrix C.• Since there are N values Wk, k = 0, 1,…N-1, that are distinct,

    there are N distinct eigenvectors W(k), which may be writtenas tha N x N matrix

    that is related to the DFT.

    ,)0()3()2()1()(

    )3()0()1()2()(

    )1()2()1()0()1()(

    )1(2)1(

    )1(22

    2

    kk

    k

    NkkN

    Nkkk

    kkkk

    WCWCWCCWk

    WNCWCWNCNCWk

    NWNCWCWCNCWk

    −−

    ++++=

    −+++−+−=

    −−++++−=

    λ

    λ

    λ . . .

    ...

    . . .

    . . .

    [ ])1()...1()0( −= NWWWW

    .)1(...)2()1()0()( )1(2 kNkk WNCWCWCCk −−++++=λ

  • 8

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 15

    Matrix Representation of Linear Systems Relationships

    • The eigenvalue relationship may be written as:

    where all the terms are N X N matrices, and Λ is a diagonalmatrix whose terms are equal to λ(k), k=-0,1,…, N-1.

    • Thus a circulant matrix is a diagonalized by the DFT matrix W.• Returning to periodic convolution, since Hp is circulant, we

    have

    CWW =Λ

    1−Λ= WWC

    ppp fWDWgandWDWH11 −− ==

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 16

    Matrix Representation of Linear Systems Relationships

    Interpretation:• W-1 fp is the DFT of fp ;• multiplication of this by D corresponds to

    point-by-point transform-domain filteringwith the DFT of h;

    • W corresponds to the inverse DFT.

    Clarification:

    k = 0, 1,…,N - 1, are the DFTs of fp and gp.

    −=

    −=

    ∑−

    =

    =

    N

    kjijg

    NkG

    N

    kjijf

    NkF

    p

    N

    j

    p

    N

    j

    π

    π

    2exp)(

    1)(

    2exp)(

    1)(

    1

    0

    1

    0

    pp fWDWg1−=

    DFT

    filtering

    DFT-1

  • 9

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 17

    Matrix Representation of Linear Systems Relationships

    We defined the eigenvalues of the circulant matrix using thefirst row of Hp, i.e. hp(-j). Thus the diagonal elements are:

    Since hp is periodic, summation from 0 to -(N-1) is equal tosummation from 0 to (N-1). Thus -j may be replace by j:

    Let the DFT of hp(j) be

    .2

    exp)(1

    0

    −= ∑

    = N

    kjijhD p

    N

    jkk

    π

    .2

    exp)(1

    0

    −= ∑

    = N

    kjijhD p

    N

    jkk

    π

    .)(N

    DkH kk=

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 18

    Matrix Representation of Linear Systems Relationships

    The frequency-domain representation of circular convolution is

    which may be evaluated rapidly using the FFT.

    It could further be shown that 2D periodic convolution may berepresented by a block-circulant matrix, which is diagonalized bythe 2D DFT.

    ),()()( kFkHNkG =

  • 10

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 19

    Matrix Representation of Linear Systems Relationships

    Block-Circulant MatricesFor two digitized images f(x,y) and h(x,y) of size AxB and CxD,respectively, extended images of size MxN may be formed bypadding the functions with zero.

    and

    The extended functions fe(x,y) and he(x,y) are periodicfunctions in 2D with M and N in the x and y directions.

    −≤≤−≤≤−≤≤−≤≤

    =110

    1010),(),(

    MyBorNxA

    ByandAxyxfyxfe

    −≤≤−≤≤−≤≤−≤≤

    =110

    1010),(),(

    MyDorNxC

    DyandCxyxhyxhe

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 20

    Matrix Representation of Linear Systems Relationships

    • The convolution of the two functions is given by:

    for x = 0,1, 2,…,M-1, and y = 0,1, 2,…, N - 1.• The result is periodic with the same period (M x N) as of fe(x,y)

    and he(x,y).• Overlap of the individual convolution periods is avoided by

    choosing M ³ (A+C-1) and N ≥ (B+D-1).• The complete discrete degradation model is given by

    where ηe(x,y) is an M x N extended discrete noise image.

    ),,(),(),(1

    0

    1

    0

    nymxhnmfyxg eeN

    n

    M

    me −−= ∑∑

    =

    =

    ),,(),(),(),(1

    0

    1

    0

    yxnymxhnmfyxg eeeN

    n

    M

    me η+−−= ∑∑

    =

    =

  • 11

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 21

    Matrix Representation of Linear Systems Relationships

    • Let f, g, and n be MN-dimensional vectors formed by atackingthe rows of the M x N functions fe(x,y), ge(x,y), and ηe(x,y).

    • Now, the degradation model may be written as

    where f, g; and n are of dimension MN x 1,and H is of dimension MN x MN.

    nHfg +=

    =

    −−−

    −−

    0321

    3012

    2101

    1210

    HHHH

    HHHH

    HHHH

    HHHH

    H

    MMM

    M

    MM . . .. . .

    . . .. . .

    ......

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 22

    Matrix Representation of Linear Systems Relationships

    −−−

    −−−

    =

    )0,()3,()1,()1,(

    )3,()0,()1,()2,(

    )2,()1,()0,()1,(

    )1,()2,()2,()0,(

    jhNjhNjhNjh

    jhjhjhjh

    jhNjhjhjh

    jhNjhNjhjh

    H

    eeee

    eeee

    eeee

    eeee

    j

    . . .. . .

    . . .. . .

    ......

    Hj is a circulant matrix, and the blocks of H are subscripted ina circular manner; H is a block-circulant matrix.

  • 12

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 23

    Matrix Representation of Linear Systems Relationships

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 24

    Matrix Representation of Linear Systems Relationships

  • 13

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 25

    Matrix Representation of Linear Systems Relationships

    • The degradation model expression looks simple.

    • However, a direct solution of this expression to obtain f is amonumental processing task for images of practical size.

    • For example, if M = N = 512, H is of size 262,144 x 264,144.

    • To obtain f directly would require the solution of a system of262,144 simultaneous linear equations.

    • Fortunately, the complexity of this problem can be reducedconsiderably by taking advantage of the circulant propertiesof H.

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 26

    Matrix Representation of Linear Systems Relationships

    Diagonalization of block-circulant matrices

    Let

    Define a Matrix W of size MN x MN,containing M2 partitions of size N x N.The imth partition of W is

    For i,m = 0,1, 2,…, M - 1.

    =

    =

    knN

    jnk

    imM

    jmi

    N

    M

    πω

    πω

    2exp),(

    2exp),(

    NM WmimiW ),(),( ω=

  • 14

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 27

    Matrix Representation of Linear Systems Relationships

    WN is an N X N matrix with elements

    for k,n = 0, 1, 2,…, N-1.The inverse matrix W -1 is also of MN x MNwith W2 partitions of size N x N.The imth partitions of W -1, symbolized as W-1(i,m), is

    for i,m = 0, 1, 2,…, M-1.

    ),(),( nknkW nn ω=

    −=

    =

    −−−

    imM

    jmi

    WmiM

    miW

    M

    NM

    πω

    ω

    2exp),(

    ,),(1

    ),(

    1

    111

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 28

    Matrix Representation of Linear Systems Relationships

    The matrix WN-1 has elements

    for k,n = 0, 1, 2,…, N - 1.Direct substitution of elements of W and W-1 shows that

    Where Ι is the MN x MN identity matrix.

    −=

    =

    −−

    knN

    j

    nkN

    nkW

    N

    NN

    πω

    ω

    2exp

    ),,(1

    ),(

    1

    11

    Ι== −− WWWW 11

  • 15

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 29

    Matrix Representation of Linear Systems Relationships

    If H is a block-circulant matrtix, it can de show that

    or

    where D is a diagonal matrix whose elements D(k,k) are relatedto the DFT of he(x,y).

    the transpose of H is.

    1−=WDWH

    HWWD 1−=

    1*’ −= WWDH

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 30

    Orthogonal Functions and Transforms

    In signal analysis, it is often useful to represent a signal x(t)over the t0 to t0 + T by an expansion of the form.

    where the functions φm(t) are mutually orthogonal, i.e.,

    if C = 1 the functions are orthonormal.

    ∑∞

    =

    =0

    )()(m

    mm tatx φ

    ∫+

    ≠=

    =Tt

    t nm nm

    nmCdttt

    0

    0 0)()( *φφ

  • 16

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 31

    Orthogonal Functions and Transforms

    The coefficients am may be obtained as

    i.e., am is the projection of x(t) on to φ m(t).

    The set {φm(t)} is said to be complete or closed if there existsno square-integrable function x(t) for which

    If this is true, x(t) should be a member of the set.When the set {φm(t)} is complete, it is said to be anorthogonal basis, and may be used for accuraterepresentation of signals, e.g., the Fourier seriesNote: x(t) and the φm(t)’s must be square-integrable.

    ∫+

    ==Tt

    t mmmdtttx

    Ca

    0

    0

    ,...,2,1,0,)()(1 *φ

    ,...2,1,0,0)()(0

    0

    * ==∫ + mdtttxTt

    t mφ

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 32

    Orthogonal Functions and Transforms

    With the signal or image expressed as an MN x 1 vector orcolumn matrix, we may consider representation oftransformations using MN x MN orthogonal matrices:

    representing

    i = 1, 2,…,MN.For images of size M x N. the transformation matrices will beof size MN x MN , leading to computational difficulties.

    FLfandLF

    LL

    *’

    1*’

    ===

    ,1

    *

    1j

    MN

    jjii

    MN

    jjiji FLfandfLF ∑∑

    ==

    ==

  • 17

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 33

    Orthogonal Functions and Transforms

    General representation of image transforms:

    where g(m, n, k, l) is the forward transform kernel and h(m, n, k, l)is the inverse transform kernel.

    The kernel is said to be separable if g(m, n, k, l) = g1 (m, k) g2 (n, l),and symmetric in addition if g1 and g2 are functionally equal.

    Then, the 2D transform may be computed in two simpler steps:1D row transforms followed by 1D column transforms.

    ),,,(),(1

    ),(1

    0

    1

    0

    lknmgnmfN

    lkFN

    n

    N

    m∑∑

    =

    =

    =

    ),,,,(),(1

    ),(1

    0

    1

    0

    lknmhlkFN

    nmfN

    t

    N

    k∑∑

    =

    =

    =

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 34

    Orthogonal Functions and Transforms

    The 2D Fourier transform kernel

    is separable and symmetric.

    .1,...,1,0,),(),(),(

    ,1,...1,0,),(),(),(

    1

    1

    0

    1

    01

    −==

    −==

    ∑−

    =

    =

    NlkkmglmFlkF

    NlmlngnmflmF

    N

    m

    N

    n

    ]/2exp[]/2exp[]/)(2exp[ NnljNmkjNnlmkj πππ −−=+−

  • 18

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 35

    Orthogonal Functions and Transforms

    The 2D DFT may be written as

    where f is the NxN image matrix, and W is a symmetric NxNmatrix with , (only N distict values).

    WfWN

    F1=

    ]/2exp[ NkmjWkm π−=

    12346670

    24604460

    36142250

    40400040

    52741630

    64206420

    76543210

    00000000

    WWWWWWWW

    WWWWWWWW

    WWWWWWWW

    WWWWWWWW

    WWWWWWWW

    WWWWWWWW

    WWWWWWWW

    WWWWWWWW

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 36

    Orthogonal Functions and Transforms

    Phasor diagram illustrating the N roots of unity for N=8.

  • 19

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 37

    Orthogonal Functions and Transforms

    The DFT matrix is symmetric and unitary:

    i.e., the rows/columns are mutually orthogonal

    Then,

    A number of transforms such as the Fourier, Walsh, Hadamard,and Discrete Cosine may be expressed as F = A f A.The transform matrices may be decomposed into products ofmatrices with fewer nonzero elements, reducing redundancyand computational requirements.The DFT matrix may be factored into a product of 2 ln N sparseand diagonal matrices, which may be considered to be the basisof the FFT algorithm.

    ≠=

    =∑−

    = 1

    1

    0*

    1

    0 k

    kNWW mlmk

    N

    m

    .**1

    *11 FWW

    NfandW

    NW ==−

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 38

    Orthogonal Functions and Transforms

    The Walsh-Hadamard Transform

    The orthogonal, complete set of Walsh functions defined over theinterval 0 ≤ x ≤ 1 is given by the iterative relationships (in 1D);

    where [n/2] is the integral part of n/2.

    ,2/1

    2/1

    1

    1;1)( 10 ≥

    <

    ==x

    xx φφ

    ,,2/1

    ,2/1

    2/1

    )12(

    )12(

    )2(

    )(

    ]2/[

    ]2/[

    ]2/[

    evenn

    oddn

    x

    x

    x

    x

    x

    x

    x

    n

    n

    n

    n

    ≥≥<

    −−−=

    φφφ

    φ

  • 20

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 39

    Orthogonal Functions and Transforms

    First eight Walsh functions [from Ahmed and Rao (1975)]

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 40

    Orthogonal Functions and Transforms

    2D Walsh-Hadamard basismatrices for N=8.Black represents+1/N and whiterepresents -1/N[From Harmuth(1972)].

  • 21

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 41

    Orthogonal Functions and Transforms

    φn is generated by compression of φ[n/2] into its first half and± φ[n/2] into its second half, and is even/odd as n.

    To generate discrete Walsh functions, the number ofsamples (equispaced) should be 2n to satisfy the aboverequirement.

    Walsh functions are ordered by the number of zero-crossings in the interval (0,1), called sequency.

    If the Walsh functions with the number of zero-crossings ≤ (2n - 1) are sampled with N = 2n uniformly-spaced points,we get a square matrix representation, which is orthogonalwith rows ordered with increasing number of zero-crossings.

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 42

    Orthogonal Functions and Transforms

    For N = 8:

    The major advantage of the Walsh transform is that the kernelhas integers with values +1 and -1 only, i.e., the transforminvolves only addition and subtraction of the image pixels.

    −−−−−−−−

    −−−−−−−−

    −−−−−−−−

    −−−−

    11111111

    11111111

    11111111

    11111111

    11111111

    11111111

    11111111

    11111111

    x

    u

  • 22

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 43

    Orthogonal Functions and Transforms

    Except for the ordering of rows, discrete Walsh matrices areequivalent to Hadamard matrices of rank 2n, which are easilyconstructed as

    Then, letting , the Walsh-Hadamardtransform may be expressed as

    applications: image coding, sequency filtering, patternrecognition.

    =

    =NN

    NNN HH

    HHHH 22 ;11

    11

    NHN

    H1=

    HfHfHfHF == ,

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 44

    Orthogonal Functions and Transforms

    The Karhunen-Loève TransformAlso known as the Principal Component, Hotelling transform,or the Eigenvector transform (Ref: Hall).This transform is based on statistical properties of the givenimage, which is treated as a random vector X.

    Mean vector:

    Covariance matrix:

    where σij = E{(xi - µi)(xj - µj)}; µj = E{xi}; i,j = 1, 2,…, n.

    dXXpXXE )(}{ ∫==µ

    =

    −=−−=∑

    221

    112211

    ’}’{})’)({(

    nnnn

    n

    XXEXXE

    σσσ

    σσσ

    µµµµ

    ...

    ...

    ... .. . .. .

  • 23

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 45

    Orthogonal Functions and Transforms

    The diagonal terms σ2ij are the variances of the componentsof the random vector.

    Σ is symmetric: σij =σji

    Scatter or autocorrelation matrix S=E{XX’} gives some infoas Σ, but is not normalized.

    To fully normalize Σ, define correlation coefficients

    Then

    jjiiijij σσσρ /2=

    11 ≤≤− ijρ

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 46

    Orthogonal Functions and Transforms

    correlation matrix

    Absolute scale of variation retained in a diagonal standarddeviation matrix:

    Then

    =

    1...

    ::

    ...1

    ...1

    1

    221

    112

    n

    n

    n

    R

    ρ

    ρρρρ

    =

    nn

    D

    σ

    σσ

    ...00

    ::

    0...0

    0...0

    22

    11

    DRD=∑

  • 24

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 47

    Orthogonal Functions and Transforms

    NOTE:

    Two random vectors Xi and Xj are

    • Uncorrelated if E {X’ I Xj} = E {X’ I} E{X j}(then Σ is diagonal and R is the identity matrix}

    • Orthogonal if E {X’ I Xj} = 0(if E {X’ I} = 0 or E {X’ I} = 0, orthogonal = uncorrelated)

    • Statistically independent if p(Xi,Xj) = p(Xi)p(Xj)(then Xi and Xj are uncorrelated).

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 48

    Orthogonal Functions and Transforms

    A random vector X may be represented without error bydeterministic transformation of the form:

    where A = [A1 A2 . . . An], A ≠ 0.The matrix A may be considered to be made up of n.linearly-independent column vectors, called the basis vectorwhich span n-dimensional space containing X.Let A be orthogonal, i.e.,

    if follows that A’A = Ι or A-1 = A’ .

    ∑=

    ==n

    iii AyAYX

    1

    ≠=

    = .0

    1’ji

    jiAA ji

  • 25

    © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 49

    Orthogonal Functions and Transforms

    Then, Y = A’X = Σni=1 A’ ixi..

    Each component of Y contributes to the representation of X.

    Suppose we wish to the use m