• No results found

Chapter 3 Analysis of Still image Compression and Encryption

3.1 Image compression using wavelet transform

The Wavelet Transform (WT) is a frequency domain transform designed to analyse and decompose finite-energy signals at multi-resolutions. WTs differ from the Fourier transform in that they provide simultaneous spatial and frequency support. The Discrete Wavelet Transform (DWT) is a special case of the WT and provides a compact efficient representation of a signal in time and frequency. The DWT is used to decompose a signal into frequency sub-bands at different scales. The level 1 wavelet transform of images works by first transforming each row, into its low and high frequency sub- bands, followed by transforming the two resulting sub-bands column-wise. Therefore, the wavelet transform of an image partitions it into four different frequency sub-bands, namely Low-Low (LL) sub-band, Low-High (LH), High-Low (HL) and High-High (HH) sub-band. The output can be decomposed in different ways to subsequent levels. The pyramid scheme is the most commonly used decomposition, where at each subsequent level only the current level LL sub-band is analysed creating a multi- resolution frequency analysis of the input image. At resolution depth of k>1, the

48

pyramidal scheme decomposes an image I into 3k +1 sub-bands, {LLk, LHk, HLk, HHk,

LHk-1, HLk-1… LH1, HL1}, with LLk being the lowest-pass sub-band, (see Figure 3.1

below).

There are large number wavelet filters that are used for a variety of image processing, that differ from each other in terms of filter length and according to whether they are “orthogonal” or “bi-orthogonal”. Their use for image compression is influenced by efficiency consideration as well as effect on image quality (see Jinming Ma, 2002). For simplicity of implementation and efficiency purposes, we shall only use the Haar (db1) filter for wavelet transformation. However, in chapter 6 we shall investigate other filters and compare performances.

There are several algorithms for image compression based on wavelet transform, such as, Embedded Zero Tree Wavelet (EZW), Set Partitioning in Hierarchical Tree (SPIHT), Wavelet Difference Reduction (WDR) and Adapting Scanned Wavelet Difference Reduction, in this section the EZW algorithms is described.

Image

LL1 HL1 LH1 HH1 HL1 LH1 HH1 HL2 LH2 HH2 LL2

Level 1 decomposition Level 2 decomposition

a b

DWT DWT

Figure 3.1 WT image decomposition :(a) first-level and (b) second-level.

The EZW algorithmic is progressive encoding scheme to compress an image into a bit- stream with high accuracy in capturing the most significant features that persist at different frequency resolution. EZW exploits an important correlation property between the wavelet coefficients of the multi-resolution signal analysis. First of all the wavelet coefficients in the LL sub-band are large compared with coefficients in the higher frequency sub-bands. Secondly, each coefficient in a low level non-LL sub-band has four descendants in the next higher sub-band resolution whose significance are inter- related to that of the parent, as shown in Figure 3.2a. As shown in figure, X2 /HL2 has four descendants X3/HL1,X4/HL1,X7/HL1 and X8/HL1(quad-tree) in the next higher

49

sub-band L1. The zero-tree method, extracts the significant coefficients from this quad- tree structure for image compression at low bit rate.

Figure 3. 2 (a) the sub-bands of WT for 8x8image (b) the quad-tree for each coefficient HL3 and X2/HL2 sub-bands.

Therefore, by Morton scan (see Figure 3.3), the zero-tree is constructed based on the relationships between the wavelet coefficients in different sub-bands. The coefficients in LL sub-band are called parents and the other coefficients are called children, see Figure 3. 2.

Figure 3.3 Morton scan

The EZW algorithms encode the coefficients of the zero-tree in descending order, in multiple passes, and for every pass a threshold is chosen against all wavelets coefficients measured. If coefficient is larger than threshold, it is encoded and removed

50

from the transformed image; otherwise it is left for next pass. In the next scan the previous value of threshold is halved.

The main steps of the EZW algorithms are as follows:

Step 1: Initialize threshold; choose the initial threshold,𝑇 = 𝑇0 such that all coefficient value are less than 𝑇0 and at least one coefficient is equal to or greater than T0/2, and

calculated by applying this formula

𝑇0 = 2⌊𝑙𝑜𝑔2 (𝑚𝑎𝑥(|𝑤|))⌋ 3. 1

Where, w is the wavelet coefficient.

Step 2 Update threshold: let 𝑇𝑘 = 𝑇𝑘−1/2 ; k=0, 1, 2,..,iiteration If k=0 skip this step

Step 3 Dominant pass (Significance pass): Morton Scan through coefficient values and m is the scanning index. Test each value w (m) as follows;

the wavelet coefficient w(m) is compared with threshold 𝑇𝑘, if it is larger than 𝑇𝑘, it is encoded as significance coefficient and assigned quantization value 𝑤𝑄(m) equal to

value of threshold, and also assigned symbol (p) to significance coefficient if its value positive or symbol (n) if its value negative and these significance coefficient are removed from transformed image. If the absolute value of coefficient is less than threshold 𝑇𝑘 and all its descendants are less than𝑇𝑘, then assign symbol (R) zero-tree

root, in this case only symbol R is sent to the decoder and the descendants are not encoded. If at least one of descendants is larger than threshold 𝑇𝑘 then symbol (I) is assigned which means isolated zero, and the descendants will be encoded.

Step 4 Refinement pass (subordinate pass): scan through significant values assigned in step3 with the higher threshold value 𝑇𝑗, for j < k (if k=1 skip this step). For each significance value w (m), do the following

If |𝑤(𝑚)| ∈ [ 𝑤𝑄(𝑚), 𝑤𝑄(𝑚) + 𝑇𝑘), then Output bit 0

Else if |𝑤(𝑚)| ∈ [ 𝑤𝑄(𝑚) + 𝑇𝑘, 𝑤𝑄(𝑚) + 2𝑇𝑘), then output 1 Replace value of 𝑤𝑄(𝑚) by 𝑤𝑄(𝑚) + 𝑇𝑘 .

In refinement pass or known subordinate pass, the significance coefficients which are specified in significance pass will be quantized by quantization transform, in which all significance coefficients are scanned and (0) bits will be assigned for the coefficients w

51

coefficients that are located within intervals [𝑤𝑄(𝑚) + 𝑇𝐾, 𝑤𝑄(𝑚) + 2𝑇𝑘). Therefore, in each refinement pass the quantization value of significance coefficient is approaching to the real value of coefficient, see Figure 3.4.

Step 5: Loop: Repeat steps 2 through 4.

The output from each scan is like the following stream:

𝑇0, P, n, n, n, n, p, p, p, p, R, R, R, R, R, I, I, I, R, R, R, for significance pass

0, 1, 1, 1, 0, 1, 0, 0, 1 for refinement pass (Rao and Yip 2010) (Valens 1999)

Figure 3.4 Quantization transforms

Example

To illustrate EZW methods, we select a block (X) size (8x8) pixels from Lena image. The DWT (Harr, level 3) has been applied to X and the result is W as shown in Figure 3.5a. The coefficients of W are scanned in order index as shown in Figure 3.5 b. The initial threshold 𝑇0 is determined by applying equation 3.1 and the result 𝑇0 = 1024.

1 2 5 6 17 18 21 22 3 4 7 8 19 20 23 24 9 10 13 14 25 26 29 30 11 12 15 16 27 28 31 32 33 34 37 38 49 50 53 54 35 36 39 40 51 52 55 56 41 42 45 46 57 58 61 62 43 44 47 48 59 60 63 64

Figure 3.5 (a) a block 8x8 pixels from Lena image that is DWT (b) Three-level scan order A

52

Based on step 3, The W coefficients are scanned and a symbol is assigned for every coefficient, if the coefficient is larger than 𝑇0 a ‘p ‘(+) is coded, if the coefficient is smaller than −𝑇0 a ‘n ‘ (-) is coded, if the coefficient and its descendants is the root of a zero-tree (smaller than threshold) then an R is coded and all descendants are not scanned. If the coefficient is smaller than the threshold but it is not the root of a zero- tree (one of descendants is larger than threshold), then I (isolated zero) is coded. Finally, all coefficients that are assigned as significance coefficients (coefficients which are assigned p or n) are taken out and processed in subordinate pass (step-4) and their locations in the block are filled with zeroes.

For instance, in the first iteration of EZW, the W(1,1) coefficient (1341) is greater than 𝑇0 (1024), therefore only W(1,1) will be assigned as p and the children: W(1,2), W(2,1), W(2,2) (-21, 57, 41) are assigned as R. Thus, the output symbols of first

dominant pass D1 are p, R R,R. W(1,1) will be processed in subordinate pass and

WQ(1,1) = 1024 . As result, W(1,1) will be in the interval [WQ(1,1), WQ(1,1) +

1024) i.e.1341∈ [1024,2048) then 0 is output from first subordinate pass (S1=0), see Figure 3.6. This iteration is repeated with update threshold until the exact bitrate specified by the user has been reached. It can be seen from Figure 3.6 that all descendants of (R) are assigned (×) to indicate they are not scanned.

Figure 3.6 (a) Iteration 1, threshold = 1024. (b) Iteration 6 threshold = 64 A

53

Related documents