A New Image Compression Scheme Based on Locally Adaptive Coding Chair Professor Chin-Chen Chang Feng Chia University
Introduction Image compression technique w h Image Index table Vector Quantization Encoder
Introduction (Cont.) Image compression technique w h Image Index table Vector Quantization Decoder
Introduction (Cont.) Histogram VQ Index table Image 207 246 : 218 223 … VQ Histogram Index table Image
Introduction (Cont.) Locally adaptive scheme Ex: a a b b c a c a b d c c e f b a List List a b a 0 1 List List List List … c b a a c b c a b a c b 002 012 102 002 012 102 002 012 102 002 012 102 0 a 1 0 0 b 1 0 0 c 1 10 1 01 1 01 … 0: the symbol does not exist in list 1: index existed in list Concept: Moving the Recently Used to the Front
The Proposed Method Image I Divide the temporary codebook into two Parts (frequently-used and infrequently-used) Refine the frequently-used part of temporary codebook Divide image into non-overlapping blocks Generate temporary codebook Image I Refine the infrequently-used part of temporary codebook generated codebook Output Compress I by referencing the generated codebook Compression code
The Proposed Method (Cont.) The proposed method includes two phases for codebook generation Temporary codebook generation Codebook refining
Temporary Codebook Generation The codebook generation is based on the concept of locally adaptive coding Temporary Codebook w Bi = {84, 170, 166, 167, 83, …, 168} G1 = { g1,1={199, 96, 84, 167, 83, …, 130}, g1,2={201, 97, 90, 167, 85, …, 132}, g1,3={200, 95, 82, 167, 81, …, 131}} h G2 = { g2,1={84, 170, 166, 167, 84, …, 170}, g2,2={86, 168, 165, 170, 90, …, 165}} G3 = { g3,1={184, 83, 194, 170, 166, …, 110}, g3,2={180, 80, 194, 166, 168, …, 114}, g3,3={185, 85, 190, 172, 160, …, 120}, g3,4={191, 88, 197, 170, 162, …, 107}} ∵ d(Bi , g2,1) = 2.24 TH = 25 ∴ add Bi into G2 and move G2 to be the first one Image Gn = { gn,1={244, 83, 174, 210, 166, …, 127}, gn,2={243, 80, 175, 213, 168, …, 128}, gn,3={240, 85, 176, 209, 160, …, 126}, gn,4={244, 88, 178, 213, 162, …, 127}} *d(•): Euclidean distance function
Temporary Codebook Generation (Cont.) G1 = { g1,1={199, 96, 84, 167, 83, …, 130}, g1,2={201, 97, 90, 167, 85, …, 132}, g1,3={200, 95, 82, 167, 81, …, 131}} G2 = { g2,1={84, 170, 166, 167, 84, …, 170}, g2,2={86, 168, 165, 170, 90, …, 165}, g2,3={84, 170, 166, 167, 83, …, 168}} G2 = { g2,1={84, 170, 166, 167, 84, …, 170}, g2,2={86, 168, 165, 170, 90, …, 165}, g2,3={84, 170, 166, 167, 83, …, 168}} G1 = { g1,1={199, 96, 84, 167, 83, …, 130}, g1,2={201, 97, 90, 167, 85, …, 132}, g1,3={200, 95, 82, 167, 81, …, 131}} G3 = { g3,1={184, 83, 194, 170, 166, …, 110}, g3,2={180, 80, 194, 166, 168, …, 114}, g3,3={185, 85, 190, 172, 160, …, 120}, g3,4={191, 88, 197, 170, 162, …, 107}} G3 = { g3,1={184, 83, 194, 170, 166, …, 110}, g3,2={180, 80, 194, 166, 168, …, 114}, g3,3={185, 85, 190, 172, 160, …, 120}, g3,4={191, 88, 197, 170, 162, …, 107}} Gn = { gn,1={244, 83, 174, 210, 166, …, 127}, gn,2={243, 80, 175, 213, 168, …, 128}, gn,3={240, 85, 176, 209, 160, …, 126}, gn,4={244, 88, 178, 213, 162, …, 127}} Gn = { gn,1={244, 83, 174, 210, 166, …, 127}, gn,2={243, 80, 175, 213, 168, …, 128}, gn,3={240, 85, 176, 209, 160, …, 126}, gn,4={244, 88, 178, 213, 162, …, 127}}
Temporary Codebook Generation (Cont.) w G2 = { g2,1={84, 170, 166, 167, 84, …, 170}, g2,2={86, 168, 165, 170, 90, …, 165}, g2,3={84, 170, 166, 167, 83, …, 168}} Bj = {220, 212, 182, 179, 240, …, 246} h G1 = { g1,1={199, 96, 84, 167, 83, …, 130}, g1,2={201, 97, 90, 167, 85, …, 132}, g1,3={200, 95, 82, 167, 81, …, 131}} G3 = { g3,1={184, 83, 194, 170, 166, …, 110}, g3,2={180, 80, 194, 166, 168, …, 114}, g3,3={185, 85, 190, 172, 160, …, 120}, g3,4={191, 88, 197, 170, 162, …, 107}} Image Gn = { gn,1={244, 83, 174, 210, 166, …, 127}, gn,2={243, 80, 175, 213, 168, …, 128}, gn,3={240, 85, 176, 209, 160, …, 126}, gn,4={244, 88, 178, 213, 162, …, 127}} ∵ No any block satisfies d(Bj, gk) TH = 25 ∴ Create a new group Gn+1, add Bj into Gn+1, and move Gn+1 to be the first one
Temporary Codebook Generation (Cont.) G2 = { g2,1={84, 170, 166, 167, 84, …, 170}, g2,2={86, 168, 165, 170, 90, …, 165}, g2,3={84, 170, 166, 167, 83, …, 168}} Gn+1 = { gn+1,1={220, 212, 182, 179, 240, …, 246}} G2 = { g2,1={84, 170, 166, 167, 84, …, 170}, g2,2={86, 168, 165, 170, 90, …, 165}, g2,3={84, 170, 166, 167, 83, …, 168}} G1 = { g1,1={199, 96, 84, 167, 83, …, 130}, g1,2={201, 97, 90, 167, 85, …, 132}, g1,3={200, 95, 82, 167, 81, …, 131}} G1 = { g1,1={199, 96, 84, 167, 83, …, 130}, g1,2={201, 97, 90, 167, 85, …, 132}, g1,3={200, 95, 82, 167, 81, …, 131}} G3 = { g3,1={184, 83, 194, 170, 166, …, 110}, g3,2={180, 80, 194, 166, 168, …, 114}, g3,3={185, 85, 190, 172, 160, …, 120}, g3,4={191, 88, 197, 170, 162, …, 107}} G3 = { g3,1={184, 83, 194, 170, 166, …, 110}, g3,2={180, 80, 194, 166, 168, …, 114}, g3,3={185, 85, 190, 172, 160, …, 120}, g3,4={191, 88, 197, 170, 162, …, 107}} Gn = { gn,1={244, 83, 174, 210, 166, …, 127}, gn,2={243, 80, 175, 213, 168, …, 128}, gn,3={240, 85, 176, 209, 160, …, 126}, gn,4={244, 88, 178, 213, 162, …, 127}} Gn = { gn,1={244, 83, 174, 210, 166, …, 127}, gn,2={243, 80, 175, 213, 168, …, 128}, gn,3={240, 85, 176, 209, 160, …, 126}, gn,4={244, 88, 178, 213, 162, …, 127}} Gn+1 = { gn+1,1={220, 212, 182, 179, 240, …, 246}}
Codebook Refining ||Gn+1|| =1 Frequently-used ||G2|| =3 Gn ||G1|| =3 IF ||Gi|| > THF = 3 Then Add Gi into Frequently-used part Else add Gi into Infrequently-used part Temporary Codebook Gn+1 = { gn+1,1={220, 212, 182, 179, 240, …, 246}} ||Gn+1|| =1 G2 = { g2,1={84, 170, 166, 167, 84, …, 170}, g2,2={86, 168, 165, 170, 90, …, 165}, g2,3={84, 170, 166, 167, 83, …, 168}} Frequently-used ||G2|| =3 G1 = { g1,1={199, 96, 84, 167, 83, …, 130}, g1,2={201, 97, 90, 167, 85, …, 132}, g1,3={200, 95, 82, 167, 81, …, 131}} Gn ||G1|| =3 G3 G3 = { g3,1={184, 83, 194, 170, 166, …, 110}, g3,2={180, 80, 194, 166, 168, …, 114}, g3,3={185, 85, 190, 172, 160, …, 120}, g3,4={191, 88, 197, 170, 162, …, 107}} ||G3|| =4 Infrequently-used Gn+1 Gn = { gn,1={244, 83, 174, 210, 166, …, 127}, gn,2={243, 80, 175, 213, 168, …, 128}, gn,3={240, 85, 176, 209, 160, …, 126}, gn,4={244, 88, 178, 213, 162, …, 127}} G2 ||Gn|| =4 G1
Codebook Refining (Cont.) For frequently-used part c3={185, 84, 194, 170, 164, …, 113} Compute Gi’s centroid cn={243, 85, 176, 211, 164, …, 127} G3 = { g3,1={84, 83, 94, 170, 166, …, 210}, g3,2={80, 80, 94, 166, 168, …, 214}, g3,3={85, 85, 90, 172, 160, …, 220}, g3,4={91, 88, 97, 170, 162, …, 207}} : ∵ d(c3, cn) = 32 THH = 35 ∴ Combine c3 and cn by c3’ = (c3 + cn)/2 Use the centroids to represent the codewords c3={185, 84, 194, 170, 164, …, 113} Gn = { gn,1={244, 83, 174, 210, 166, …, 127}, gn,2={243, 80, 175, 213, 168, …, 128}, gn,3={240, 85, 176, 209, 160, …, 126}, gn,4={244, 88, 178, 213, 162, …, 127}} cn={243, 85, 176, 211, 164, …, 127} c3’={214, 85, 185, 191, 164, …, 120} : Centroid of Gn
Codebook Refining (Cont.) For infrequently-used part c1={200, 96, 85, 167, 83, …, 131} c2={85, 170, 166, 169, 86, …, 168} Compute Gi’s centroid cn+1={220, 212, 182, 179, 240, …, 246} Gn+1 = {gn+1,1={220, 212, 182, 179, 240, …, 246}} cn+1={220, 212, 182, 179, 240, …, 246} Use the centroids to represent the codewords G2 = {g2,1={84, 170, 166, 167, 84, …, 170}, g2,2={86, 168, 165, 170, 90, …, 165}, g2,3={84, 170, 166, 167, 83, …, 168}} c2={85, 170, 166, 169, 86, …, 168} G1 = { g1,1={199, 96, 84, 167, 83, …, 130}, g1,2={201, 97, 90, 167, 85, …, 132}, g1,3={200, 95, 82, 167, 81, …, 131}} c1={200, 966, 85, 167, 83, …, 131}
Codebook Refining (Cont.) Frequently-used part C3’={214, 85, 185, 191, 164, …, 120} : ∵ d(c3’, c1) = 132.57 THL = 135 ∴ Delete c1 from Infrequently-used part Infrequently-used part c1={200, 96, 85, 167, 83, …, 131} c1={200, 96, 85, 167, 83, …, 131} c2={85, 170, 166, 169, 86, …, 168} c2={85, 170, 166, 169, 86, …, 168} cn+1={220, 212, 182, 179, 240, …, 246} cn+1={220, 212, 182, 179, 240, …, 246}
Codebook Refining (Cont.) Frequently-used part C3’={214, 85, 185, 191, 164, …, 120} C3’={214, 85, 185, 191, 164, …, 120} c2={85, 170, 166, 169, 86, …, 168} : : Infrequently-used part c2={85, 170, 166, 169, 86, …, 168} ∵ No any codeword cj from frequently-used part satisfies d(c2, cj) THL = 135 ∴ Add c2 into frequently-used part and delete c2 from infrequently-used part cn+1={220, 212, 182, 179, 240, …, 246}
Codebook Refining (Cont.) Frequently-used part C3’={214, 85, 185, 191, 164, …, 120} C3’={214, 85, 185, 191, 164, …, 120} c2={85, 170, 166, 169, 86, …, 168} c2={85, 170, 166, 169, 86, …, 168} cn+1={220, 212, 182, 179, 240, …, 246} : : Generated codebook Infrequently-used part cn+1={220, 212, 182, 179, 240, …, 246} ∵ No any codeword cj from frequently-used part satisfies d(cn+1, cj) THL = 135 ∴ Add cn+1 into frequently-used part and delete cn+1 from infrequently-used part Empty
Image Compression Generated codebook : Index table Image 1 w h 1 C0={214, 85, 185, 191, 164, …, 120} c1={85, 170, 166, 169, 86, …, 168} : cn={220, 212, 182, 179, 240, …, 246} Index table Image
Experimental Results (a) Alan (b) Goldhill (c) Lena (d) Tiffany
Experimental Results (Cont.) (a) Codebook size comparison
Experimental Results (Cont.) (b) PSNR comparison with different THs
Experimental Results (Cont.) Methods Images Proposed method (TH = 25, THH =30, THL = 115) VQ PSNR CR number of codewords Alan 31.82 0.0547 77 31.75 0.0625 256 Boat 28.68 229 28.85 Goldhill 28.96 180 29.55 Jet 29.47 178 29.81 Lena 30.27 170 31.15 Pepper 30.56 177 30.94 Tiffany 30.87 107 30.92 Toys 30.53 233 29.10 Zelda 33.320 136 34.29 Average 30.50 0.0608 165.2222 30.71
Conclusions The proposed method significantly reduces the size of codebook and maintains a good image quality of the compressed images.