Induction to Wavelet Transform and Image Compression

Embed Size (px)

Citation preview

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    1/47

    Introduction to Wavelet

    Transform and Image

    Compression

    Student: Kang-Hua Hsu

    Advisor: Jian-Jiun Ding

    E-mail: [email protected] Institute of Communication Engineering

    National Taiwan University, Taipei, Taiwan, ROC

    DISP@MD531 1

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    2/47

    Outline (1) Introduction

    Multiresolution Analysis (MRA)- Subband Coding- Haar Transform- Multiresolution Expansion

    Wavelet Transform (WT)

    - Continuous WT- Discrete WT- Fast WT- 2-D WT

    Wavelet Packets

    Fundamentals of Image Compression- Coding Redundancy- Interpixel Redundancy- Psychovisual Redundancy- Image Compression Model

    DISP@MD531 2

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    3/47

    Outline (2) Lossless Compression

    - Variable-Length Coding

    - Bit-plane Coding

    - Lossless Predictive Coding

    Lossy Compression

    - Lossy Predictive Coding- Transform Coding

    - Wavelet Coding

    Conclusion

    Reference

    DISP@MD531 3

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    4/47

    Introduction(1)-WT v.s FTBases of the

    FT: time-unlimited weighted sinusoids with different

    frequencies. No temporal information.

    WT: limited duration small waves with varying frequencies,

    which are called wavelets. WTs contain the temporal time

    information.

    Thus, the WT is more adaptive.

    DISP@MD531 4

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    5/47

    Introduction(2)-WT v.s TFA Temporal information is related to the time-frequency

    analysis.

    The time-frequency analysis is constrained by the

    Heisenberg uncertainty principal.

    Compare tiles in a time-frequency plane (Heisenberg cell):

    DISP@MD531 5

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    6/47

    Introduction(3)-MRA It represents and analyzes signals at more than one

    resolution.

    2 related operations with ties to MRA:

    Subband coding

    Haar transform

    MRA is just a concept, and the wavelet-based

    transformation is one method to implement it.

    DISP@MD531 6

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    7/47

    Introduction(4)-WT The WT can be classified according to the of its input

    and output.

    Continuous WT (CWT)

    Discrete WT (DWT)

    1-D 2-D transform (for image processing)

    DWT Fast WT (FWT)

    DISP@MD531 7

    recursive relation of the coefficients

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    8/47

    MRA-Subband Coding(1)

    DISP@MD531 8

    Since the bandwidth of the resulting subbands is smaller

    than that of the original image, the subbands can be

    downsampled without loss of information.

    We wish to select so that the

    input can be perfectly reconstructed.

    Biorthogonal

    Orthonormal

    0 1 0 1, , ,h n h n g n g n

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    9/47

    MRA-Subband Coding(2)

    Biorthogonal filter bank:

    Orthonormal (its also biorthogonal) filet bank:

    : time-reversed relation,where 2K denotes the number of coefficients in each filter.

    The other 3 filters can be obtained from one prototype filter.

    DISP@MD531 9

    ? A ? A ? A

    ? A ? A

    ? A ? A ? A

    ? A ? A

    0 0

    0 1

    1 1

    1 0

    , 2

    , 2 0

    , 2

    , 2 0

    g k h n k n

    g k h n k

    g k h n k n

    g k h n k

    H

    H

    ! !

    !

    !

    1 0( ) ( 1) (2 1 )

    ( ) (2 1 ), {0,1}

    n

    i i

    g n g K n

    h n g K n i

    !

    ! !

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    10/47

    MRA-Subband Coding(3)

    1-D to 2-D: 1-D two-band subband coding to the rows andthen to the columns of the original image.

    Where a is the approximation (Its histogram is scattered, andthus lowly compressible.) and d means detail (highlycompressible because their histogram is centralized, and thuseasily to be modeled).

    DISP@MD531 10

    FWT can be implemented by subband coding!

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    11/47

    Haar Transform

    will put the lower frequency components of X

    at the top-left corner of Y. This is similar to the

    DWT.

    This implies the resolution (frequency) and location (time).

    DISP@MD531 11

    1 / 2 1 / 2 1 / 2 1 / 2

    1 / 2 1 / 2 1 / 2 1 / 2

    1 / 2 1 / 2 0 0

    0 0 1 / 2 1 / 2

    H

    !

    TY H X H !

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    12/47

    Multiresolution Expansions(1) , : the real-valued expansion coefficients.

    , : the real-valued expansion functions.

    Scaling function : span the approximation of the

    signal.

    : this is the reason of its name.

    If we define , then

    , : scaling function coefficients

    DISP@MD531 12

    ( ) ( )k kk

    f x xE J! kE

    ( )k xJ

    xJ

    /2

    , ( ) 2 (2 )j j

    j k x x kJ J!

    _ a, ( )j j kk

    V span xJ!0 1 2... ....V V V

    2 2n

    x h n x nJ

    J J! h nJ

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    13/47

    Multiresolution Expansions(2)

    DISP@MD531 13

    4 requirements of the scaling function:

    The scaling function is orthogonal to its integer translates.

    The subspaces spanned by the scaling function at low scales

    are nested within those spanned at higher scales.

    The only function that is common to all is .

    Any function can be represented with arbitrary coarse

    resolution, because the coarser portions can be represented

    by the finer portions.

    jV _ a0 f x V g! !

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    14/47

    Multiresolution Expansions(3)

    DISP@MD531 14

    The wavelet function : spans difference between any

    two adjacent scaling subspaces, and .

    span the subspace .

    x]

    jV 1jV

    2, 2 2j

    j

    j k x x k] ]! jW

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    15/47

    Multiresolution Expansions(4)

    DISP@MD531 15

    ,

    : wavelet function coefficients

    Relation between the scaling coefficients and the wavelet

    coefficients:

    This is similar to the relation between the impulse responseof the analysis and synthesis filters in page 11. There is

    time-reverse relation in both cases.

    ( ) ( ) 2 (2 )n

    x h n x n]

    ] J!

    ( )h n]

    ( ) ( 1) (1 )n

    h n h n] J!

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    16/47

    CWT

    DISP@MD531 16

    The definition of the CWT is

    Continuous input to a continuous output with 2 continuous

    variables, translation and scaling.

    Inverse transform:

    Its guaranteed to be reversible if the admissibility criterion is

    satisfied.

    Hard to implement!

    1

    ,

    | |

    xW s f x dt

    ss

    J

    XX ]

    g

    g

    !

    2

    0

    1,

    xf x W s d ds

    sC s s]

    ]

    XX ] X

    g g

    g

    !

    2( ) |

    | |

    fC df

    f

    ]

    =! g

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    17/47

    DWT(1) wavelet series expansion:

    DISP@MD531 17

    0 0

    0

    , ,( ) ( ) ( ) ( ) ( )

    j j k j j k

    k j j k

    f x c k x d k xJ ]g

    !

    !

    : arbitrary starting scale0j

    0( )jc k

    ( )jd k

    : approximation or scaling coefficients

    : detail or wavelet coefficients

    0 0 0, ,( ) ( ), ( ) ( ) ( )j j k j kc k f x x f x x dxJ J! ! % %

    , ,( ) ( ), ( ) ( ) ( )j j k j kd k f x x f x x dx] ]! ! % %

    This is still the continuous case. If we change the integral

    to summation, the DWT is then developed.

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    18/47

    DWT(2)

    DISP@MD531 18

    0

    0

    0 , ,

    1 1

    ( ) ( , ) ( ) ( , ) ( )j k j kk j j kf x W j k x W j k xM MJ ]J ]

    g

    !! % %

    0

    1

    0 ,

    0

    1( , ) ( ) ( )

    M

    j k

    x

    W j k f x xM

    J J

    !

    ! %

    1

    ,0

    1

    ( , ) ( ) ( )

    M

    j kx

    W j k f x xM] ]

    !! %

    The coefficients measure the similarity (in linear algebra,

    the orthogonal projection) of with basis functions

    and .

    f x

    0 ,( )j k xJ

    %, ( )j k x]%

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    19/47

    FWT(1)

    DISP@MD531 19

    2 2n

    x h n x nJJ J! ( ) ( ) 2 (2 )

    n

    x h n x n]] J!

    By the 2 relations we mention in subband coding,

    We can then have

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

    n k km

    W j k h m k W j m h n W j n] ] J ] J ! u! !

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

    n k km

    W j k h m k W j m h n W j nJ J J J J ! u! !

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    20/47

    FWT(2)

    DISP@MD531 20

    When the input is the samples of a function or an image, we canexploit the relation of the adjacent scale coefficients to obtain all

    of the scaling and wavelet coefficients without defining the

    scaling and wavelet functions.

    2 , 0( , ) ( 2 ) ( ) ( 1,, )( 1 ) n k km

    W j k h m k W j m h n W j n] ] ] JJ ! u! ! 2 , 0

    ( , ) ( 2 ) ( ) ( 1,, )( 1 )n k k

    m

    W j k h m k W j m h n W j nJ J J J J ! u! !

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    21/47

    FWT(3)

    DISP@MD531 21

    FWT resembles the two-band subband coding scheme!

    1 :FWT

    The constraints for perfect reconstruction is the same

    as in the subband coding.

    0

    1

    ( ) ( )

    ( ) ( )

    h n h n

    h n h n

    J

    ]

    !

    !

    0 0

    1 1

    ( ) ( ) ( )

    ( ) ( ) ( )

    g n h n h n

    g n h n h n

    J

    ]

    ! !

    ! !

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    22/47

    2-DWT(1)

    DISP@MD531 22

    ( , ) ( ) ( )

    ( , ) ( ) ( )

    ( , ) ( ) ( )

    ( , ) ( ) ( )

    H

    V

    D

    x y x y

    x y x y

    x y y x

    x y x y

    J J J

    ] ] J

    ] J ]

    ] ] ]

    !

    !

    ! !

    2-D1-D (row)

    1-D (column)

    These wavelets have directional sensitivity naturally.

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    23/47

    2-DWT(2)

    DISP@MD531 23

    Note that the upmost-leftmost subimage is similar to the

    original image due to the energy of an image is usually

    distributed around lower band.

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    24/47

    Wavelet Packets

    DISP@MD531 24

    A wavelet packet is a more flexible decomposition.

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    25/47

    Fundamentals of Image

    Compression(1)

    3 kinds of redundancies in an image:

    Coding redundancy

    Interpixel redundancy

    Psychovisual redundancy

    Image compression is achieved when the redundancies

    were reduced or eliminated.

    DISP@MD531 25

    Goal: To convey the same information with

    least amount of data (bits).

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    26/47

    Fundamentals of Image

    Compression(2) Image compression can be classified to

    Lossless(error-free, without distortion after

    reconstructed)

    Lossy

    Information theory is an important tool .

    DISP@MD531 26

    Data Information{ : information is carried by the data.

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    27/47

    Fundamentals of Image

    Compression(3)

    DISP@MD531 27

    1

    2

    R

    nC

    n!

    11

    DC

    !

    Evaluation of the lossless compression:

    Compression ratio :

    Relative data redundancy :

    Evaluation of the lossy compression:

    root-mean-square (rms) error

    121 1

    0 0

    1

    , ,

    M N

    rms

    x ye f x y f x yMN

    ! !

    !

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    28/47

    Coding Redundancy

    We can obtain the probable information from the histogram

    of the original image.

    Variable-length coding: assign shorter codeword to more

    probable gray level.

    DISP@MD531 28

    If there is a set of codeword to represent theoriginal data with less bits, the original data is

    said to have coding redundancy.

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    29/47

    Interpixel Redundancy(1)

    B

    ecause the value of any given pixel can bereasonably predicted from the value of its neighbors,

    the information carried by individual pixels is

    relatively small.

    DISP@MD531 29

    Interpixel redundancy is resulted from the

    correlation between neighboring pixels.

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    30/47

    Interpixel Redundancy(2)

    To reduce interpixel redundancy, the original imagewill be transformed to a more efficient and nonvisual

    format. This transformation is called mapping.

    Run-length coding. Ex. 10000000 1,111

    Difference coding.

    DISP@MD531 30

    7 0s

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    31/47

    Psychovisual Redundancy

    For example, the edges are more noticeable for us.

    Information loss!

    We truncate or coarsely quantize the gray levels (or

    coefficients) that will not significantly impair the perceived

    image quality.

    The animation take advantage of the persistence of vision to

    reduce the scanning rate.

    DISP@MD531 31

    Humans dont respond with equal importanceto every pixel.

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    32/47

    Image Compression Model

    DISP@MD531 32

    The quantizer is not necessary.

    The mapper would

    1.reduce the interpixel redundancy to compress directly,

    such as exploiting the run-length coding.

    or

    2.make it more accessible for compression in the later

    stage, for example, the DCT or the DWT coefficients are

    good candidates for quantization stage.

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    33/47

    Lossless Compression

    No quantizer involves in the compression procedure.

    Generally, the compression ratios range from 2 to 10.

    Trade-off relation between the compression ratio and the

    computational complexity.

    DISP@MD531 33

    It can be reconstructed without distortion.

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    34/47

    Variable-Length Coding

    It merely reduces the coding redundancy.

    Ex. Huffman coding

    DISP@MD531 34

    It assigns fewer bits to the more probable gray levels than

    to the less probable ones.

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    35/47

    Bit-plane Coding

    DISP@MD531 35

    A monochrome or colorful image is decomposed into a series ofbinary images (that is, bit planes), and then they are compressed

    by a binary compression method.

    It reduces the interpixel redundancy.

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    36/47

    Lossless Predictive Coding

    It reduces the interpixel redundancies of closely spaced

    pixels.

    The ability to attack the redundancy depends on the

    predictor.

    DISP@MD531 36

    It encodes the difference between the actual and predictedvalue of that pixel.

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    37/47

    Lossy Compression

    It exploits the quantizer.

    Its compression ratios range from 10 to 100 (much more

    than the lossless cases).

    Trade-off relation between the reconstruction accuracy and

    compression performance.

    DISP@MD531 37

    It can not be reconstructed without distortiondue to the sacrificed accuracy.

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    38/47

    Lossy Predictive Coding

    It exploits the quantizer.

    Its compression ratios range from 10 to 100 (much more

    than the lossless cases).

    The quantizer is designed based on the purpose for

    minimizing the quantization error.

    Trade-off relation between the quantizer complexity and less

    quantization error.

    Delta modulation (DM) is an easy example exploiting the

    oversampling and 1-bit quantizer.

    DISP@MD531 38

    It is just a lossless predictive coding containinga quantizer.

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    39/47

    Transform Coding(1)

    DISP@MD531 39

    Most of the information is included among a small number

    of the transformed coefficients. Thus, we truncate or coarsely

    quantize the coefficients including little information.

    The goal of the transformation is to pack as much informationas possible into the smallest number of transform coefficients.

    Compression is achieved during the quantization of the

    transformed coefficients, not during the transformation.

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    40/47

    Transform Coding(2)

    DISP@MD531 40

    More truncated coefficients Higher compression ratio, butthe rms error between the reconstructed image and the original

    one would also increase.

    Every stage can be adapted to local image content.

    Choosing the transform:

    Information packing ability

    Computational complexity needed

    KLT WHT DCT

    Information packing ability Best Not good Good

    Computational complexity High Lowest Low

    Practical!

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    41/47

    Transform Coding(3)

    DISP@MD531 41

    Disadvantage: Blocking artifact when highly compressed(this causes errors) due to subdivision.

    Size of the subimage:

    Size increase: higher compression ratio, computational

    complexity, and bigger block size.

    How to solve the blocking artifact problem? Using the WT!

    ?

    ?

    ?

    ?

    ??

    ?

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    42/47

    Wavelet Coding(1)

    No subdivision due to:

    Computationally efficient (FWT)

    Limited-duration basis functions.

    Avoiding the blocking artifact!

    DISP@MD531 42

    Wavelet coding isnot only

    the transforming coding

    exploiting the wavelet transform------No subdivision!

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    43/47

    Wavelet Coding(2)

    We only truncate the detail coefficients.

    The decomposition level: the initial decompositions would

    draw out the majority of details. Too many decompositions is

    just wasting time.

    DISP@MD531 43

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    44/47

    Wavelet Coding(3)

    Quantization with dead zone threshold: set a threshold to

    truncate the detail coefficients that are smaller than the

    threshold.

    DISP@MD531 44

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    45/47

    ConclusionThe WT is a powerful tool to analyze signals. There are

    many applications of the WT, such as image

    compression. However, most of them are still not

    adopted now due to some disadvantage. Our future

    work is to improve them. For example, we could

    improve the adaptive transform coding, including the

    shape of the subimages, the selection of transformation,

    and the quantizer design. They are all hot topics to be

    studied.

    DISP@MD53145

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    46/47

    Reference[1] R.C Gonzalez, R.E Woods, Digital I age Processing,

    2nd edition, Prentice Hall, 2002.[2] J.C Goswami, A.K Chan, Funda entals ofWavelets,

    John Wiley & Sons, New York, 1999.

    [3] Contributors of the Wikipedia, Arithmetic coding,

    available inhttp://en.wikipedia.org/wiki/Arithmetic_coding.

    [4] Contributors of the Wikipedia, Lempel-Ziv-Welch,available in http://en.wikipedia.org/wiki/Lempel-Ziv-

    Welch.[5] S. Haykin, Co unication Syste , 4th edition, John

    Wiley & Sons, New York, 2001.

    DISP@MD53146

  • 8/6/2019 Induction to Wavelet Transform and Image Compression

    47/47

    47