International Journal of Engineering Trends and Technology (IJETT) – Volume23 Number 4- May 2015 Hybrid Image Compression Technique for ROI based compression Kuldip K. Ade*, M. V. Raghunadh΅ Dept. of Electronics and Communication Engineering National Institute of Technology Warangal-506004, India Abstract— This paper presents the hybrid method for compression of images. In any image region of interest is the significant part, which should be compressed with high PSNR while the rest of the image can be compressed with low PSNR for achieving a good compression ratio. The method proposed in this paper separates the face of the person from the image (Images with a human face as ROI) and compress it with visually lossless wavelet based image compression and the rest of the image with DCT based JPEG compression. Areas, corresponding to ROI are compressed for maximum reconstruction quality, while remaining areas are coarsely approximated. The paper also proposes the face detection technique for automatic ROI selection based on skin color detection and dimensions of the human face. This method achieves better PSNR for ROI while providing a remarkable compression ratio for image. Keywords—ROI (Region of interest); PSNR (peak signal to noise ratio); CR (Compression ratio); Huffman coding; Face detection. I. INTRODUCTION Region of interest oriented image compression mainly focused on viewer’s interest. It is a type of compression that allocates a given amount of information to a region in an image where a viewer has more interest, (ROI) [1] more preferred than the remaining region, which is non-ROI. This approach results in higher restored image quality for ROI than that for non-ROI. This prevents an unallowable loss of the information for most important regions such as the tumor in Brain is the focus in the medical imaging [2]. ROI image compression is an interesting topic in the field of image compression. In various image compression standards, the whole image is compressed either by lossless compression or by lossy compression. These image compression standards treats the ROI and non ROI equally which results in the loss of information related to the highly desirable areas. Information related to the region of interest in an image can be preserved by compressing the region with either lossless or visually lossless method of image compression and the region other than region of interest should be compressed by lossy compression which helps in achieving better compression for whole image. In images like voter Identity cards, Adhar card and images with a human face, the main focus of the image is the face of the person. The quality of such image judged by viewer depends on the quality of reconstructed ROI (human face in this context). It will be appropriate to use either lossless or compression that appears to be lossless for face. If ISSN: 2231-5381 lossless or near lossless compression is used, then the compression ratio achieved will be very less. Compression ratio should be significant to handle the large database. This problem can be solved by using lossy compression with high CR for the rest of the image. This technique not only helps in achieving good quality for ROI [3] but also provides better CR for full image transmission or storage. Image compression algorithms used nowadays, determines ROI region manually before image transmission, which is time consuming when processing a large database containing number of images. Therefore, people need to solve the batch processing of the image ROI extraction problem. This paper deals with separation of ROI with simple and fast face detection technique, which serves as the best method to compress the large database of voter Identity cards or Adhar cards. This algorithm will solve the issue of handling large database by providing good compression at the same time it will preserve the quality of an image by providing a good PSNR for ROI [4]. It ensures no loss of important information at the same time; it can effectively compress the data. Compression algorithm proposed in this paper appears to be lossless for ROI region, but it is lossy. This algorithm is designed to achieve a good CR, with the appearance of the reconstructed ROI region in the image will be same as original. Hence, as compared to other lossy compression techniques it resembles the characteristics of lossless technique. The percentage of loss by proposed algorithm is less as compared to other lossy compression techniques. Algorithm explained in this paper detects the face of a person from the color image and form a mask to separate the image in ROI and non ROI image. ROI is then compressed by wavelet transform based compression [5] and non ROI region is compressed with DCT based JPEG image compression [6]. Stream of transformed and quantized pixels from both the region are combined into a single stream which is then preceded for Huffman coding. Reconstruction (decoding) procedure is exactly reverse of the encoding. This technique serves as the best in both aspect of achieving better CR and a good PSNR for ROI as compared to the individual wavelet based compression or DCT based JPEG compression. This algorithm is also adaptable for other near lossless compression techniques in ROI region and lossy compression techniques in the non ROI region. http://www.ijettjournal.org Page 203 International Journal of Engineering Trends and Technology (IJETT) – Volume23 Number 4- May 2015 Condition1: II. ROI SELECTION 10/7 RegionHeig ht RegionWidt h The method used for face detection [7] [8]in this paper is (4) based on skin color filtering, but it has some limitations. These 3/10 RegionHeig ht limitations can be compensated by using other filtering methods simultaneously with skin color filtering [9]. While Condition 2: detecting face by skin color, face is not only object that could be found in an image, also neck, arms, legs, and palms will 1.6 RegionWidt h RegionHeig ht (5) found by the skin color filtration method. This issue can be 1.19 RegionWidt h solved by applying the criteria of height to width ratio [10] of the standard human face to sort out face region from skin color detected regions [9]. Step 8. Segment the face from an image by using obtained mask. A. Algorithm to detect face Step 1. Input the image. III. COMPRESSION BASED ON WAVELET TRANSFORM Step 2. Find out the normalized RGB image (rgb(i, j)) and HSV image (HSV(i, j)) from the input image. Step 3. For each pixel (i,j), get the corresponding normalized r and g value, also H and S values. Step 4. Fix the threshold for r, g, H, S to get the mask for separating the skin region from the image. Mask 10 H(i, j) 0.5934 or (1) 6.0563 H(i, j) 6.2657 Mask 2- 0.2 S(i, j) 0.757 (2) Mask 3- 0.4 r(i, j) g(i, j) Algorithm explained in this paper uses part of compression based on discrete wavelet transform for ROI. A wavelet, in the sense of the Discrete Wavelet Transform [5] is an orthogonal function which can be applied to a finite group of data. The wavelet basis is a set of functions which are defined by a recursive difference equation, M 1 (x) k 0 k 1 - r(i, j) and 2 (3) (6) c j (k) j , k (t) n jk dn (k) n, k (t) (7) Where, the coefficients in the wavelet expansion series c j (k) and dn (k) are called as the discrete wavelet transform of the g(i, j) r(i, j) function f (t) . j , k (t) Step 5. Multiply these three masks to get the final mask. Step 6. Perform Binary Mask Post-Processing This can be achieved by performing morphological operations on the mask image, which removes holes and unnecessary regions in the mask and also eliminates some small masked regions. The operations to be carried out on the image are erosion followed by the dilation. Step 7. Image Segmentation on the basis of Shape Based Filtering This processed mask image is segmented using a connected component labeling. Segmentation to be carried out has to pass the test of shape based feature which is an aspect ratio of width to height of the region. Conditions that to be passed, for the region to be recognized as face region are as follows: ISSN: 2231-5381 k) Where, the range of the summation is determined by the specified number of nonzero coefficients M. Any function f(t) belonging to the L2(R) space can be represented in wavelet expansion series in terms of the scaling function as follows: f (t) 0.6 and ck (2 x and n, k (t) are defined as follows, j , k (t) 2 j /2 (2 j t k) (8) n, k (t) 2n/2 (2n t k) (9) Further, c j (k) and dn (k) are described by following formulae which are basic of wavelet based filtering, which is defined as a combination of a low pass filter and high pass filter, both followed by a factor of two decimation. c j (k) d j (k) n n h(n 2 k)c j 1 (n) (10) g(n 2 k)c j 1 (n) (11) This can be explained by following diagram. http://www.ijettjournal.org Page 204 International Journal of Engineering Trends and Technology (IJETT) – Volume23 Number 4- May 2015 c j-2 h After knowing the basics of DWT, the method of image compression based on DWT can be easily understood by the figure given below. 2 c j-1 h 2 dj-2 cj h DWT based Im age com pression steps g 2 2 Tile Decomposition dj-1 g c j+1 g 2 DWT 2 Compressed Image data Source Image dj DWT based Im age Decom pression steps Fig. 1 Three stage analysis sub band coding. An image is represented as an array of coefficients, which are brightness intensity of the pixels. The image consists of smooth variation, termed as low frequency variations and the sharp edges as high frequency variations. Discrete Wavelet Transform (DWT) is used to separate smooth variations and the details of the image. In DWT analysis filter pair consists of a low pass filter and a high pass filter as shown in fig. The low pass and high pass filter are so chosen that they exactly halve the frequency range between them. This process is explained in Fig. 2. Scheme of decomposition of image can be best explained by following figure. LL2 LH2 LL1 HL2 HH2 LH1 Original HL1 Tile Integration IDWT Dequantizer Fig. 4 Wavelet based image compression and decompression. IV. DCT BASED JPEG COMPRESSION DCT-based JPEG compression [6] (without entropy encoding) is used for the compression of non ROI in an image. It will be appropriate to go through the basics of this compression technique. A. 8x8 FDCT and IDCT At the time of encoding, source image samples are grouped into 8x8 blocks, shifted from unsigned integers with range [0, 2p – 1] to signed integers with a range [-2(p-1), 2(p-1)-1] and input to the Forward DCT (FDCT). At the decoder side, the Inverse DCT (IDCT) outputs 8x8 sample blocks to form the reconstructed image. The following equations are the mathematical definitions of the 8x8 FDCT and 8x8 IDCT: 7 7 x=0 y=0 cos LL1 HL1 (2y +1)vπ 16 HH1 f(x, y) = 1 4 7 7 c(u) c(v)F(u,v)cos x=0 y=0 cos LL2 LH2 LH1 HLL1 HL1 (2u +1)xπ 16 (2v +1)yπ 16 LH1 HL2 HH2 HH1 HL1 HH1 Where; c(u),c(v) = 1 ; for 2 u, v = 0 ; Fig. 3 Scheme of decomposition up to second level ISSN: 2231-5381 (12) LH1 Original Image H1 (2x +1)uπ 16 f(x, y)cos Fig. 2 Scheme of decomposition L1 Entropy Decoder Compressed Image data Reconstructed Image 1 F(u, v) = c(u) c(v) 4 HH1 LLL1 Entropy Encoder Quantizer http://www.ijettjournal.org Page 205 (13) International Journal of Engineering Trends and Technology (IJETT) – Volume23 Number 4- May 2015 Step 5. Apply the wavelet based image compression on ROI Otherwise; c(u),c(v) =1 ; to obtain the stream or vector of data obtained after quantization without entropy encoding (Process M1). Procedure of JPEG image compression based on DCT can be explained by the figure given below. Step 6. Combine both the stream of quantized pixel values obtained from both compression techniques. DCT based JPEG Image compression steps 8x8 blocks FDCT Source Image Table Specifications Quantizer Step 7. Apply Huffman encoding on this data stream to obtain a sequence of variable length codes. Entropy Encoder Compressed Image data Table Specifications DCT based JPEG Image Decompression steps IDCT Reconstructed Image Table Specifications Dequantizer Table Specifications B. Decompression Step 1. Apply Huffman decoding procedure to obtain the symbols (pixel values) provided as input to Huffman encoding. Step 2. Separate the stream of pixel values obtained from Huffman decoding in to ROI and non ROI stream of pixel values. Entropy Decoder Compressed Image data Fig. 5 DCT based JPEG image compression and decompression. V. HUFFMAN ENCODING Huffman code [11] is a variable-length code. The variable length code assigns codes which are of variable length to symbols to be encoded. Huffman coding provides a way to encode the symbols in a lossless way of compression. Huffman codes are widely used lossless image compression technique. Step 3. Apply the DCT based JPEG image decompression (without entropy decoding) on non ROI stream to obtain non ROI (Process Inverse M2). Step 4. Apply the wavelet based image decompression (without entropy decoding) on ROI stream to obtain ROI (Process Inverse M1). Step 5. Combine ROI and non ROI to get the final reconstructed image. Step 6. Output is reconstructed image with preserved ROI with better CR. The Huffman code procedure is based on the two implications. ROI Huffman Encoding Face detection 1) Symbols with higher frequency will have shorter code words than symbol that occur less frequently. 2) The two symbols those occur least frequently will have the same length. M1 Non ROI Source Image M2 Compressed bit stream VI. ALGORITHM Inverse M1 A. Compression Step 1. Input the image having human face. ROI bit stream Huffman Decoding Step 2. Send the image for face detection and get the mask of face detected region. Reconstructed Image Inverse M2 Non ROI bit stream Compressed bit stream Fig. 6 Implemented Hybrid compression and decompression algorithm Step 3. Segment the image in ROI and a non ROI image using the mask obtained from step2. VII. EXPERIMENTAL RESULTS Step 4. Apply the DCT based JPEG image compression on non ROI to obtain the stream or vector of data obtained after quantization without entropy encoding (Process M2). ISSN: 2231-5381 The algorithm is operated on color images having human face. A database of images has been operated are Adhar card, Identification cards, election commission Id cards and other images with a human face in it. Performance of discussing compression technique is tested on basis of CR and PSNR. PSNR and CR obtained by this hybrid approach [12] are compared with PSNR and CR obtained by individual methods http://www.ijettjournal.org Page 206 International Journal of Engineering Trends and Technology (IJETT) – Volume23 Number 4- May 2015 which are used for a hybrid approach. Compression ratio or with technique providing good visual quality of the image criteria are tested on whole images, while PSNR for this at the same time good compression ratio is achieved for image method is compared on the basis of PSNR of ROI and non compression. The proposed algorithm provides good picture ROI. In this method ROI is compressed relatively lossless and quality even at high compression. ROI is kept visually the rest of the image compressed in a lossy manner. Hence lossless; hence PSNR for ROI is high and non ROI is PSNR of ROI and non ROI is calculated separately. compressed by lossy compression, which helps in achieving a Experimental results show that, good CR can be achieved by better compression ratio. This algorithm can be used in many compromising PSNR of non ROI, while maintaining highest applications [16]depending on the criteria of selection of ROI. quality of ROI (here in this context face of the person). Table I Medical images found to be best suitable for this algorithm, if shows that Hybrid image compression technique [13] ROI selection is based on unwanted or forensic materials in providing nearly equal CR as that of DCT based JPEG image the human body. compression, while maintaining better PSNR for ROI region. Compression achieved by this approach is much higher than wavelet based image compression, maintaining comparable PSNR for ROI area. Peak Signal to noise ratio (PSNR) is calculated by following formulae, m n MSE i 1j PSNR [ X (i, j ) Y (i, j )]2 m n 1 (14) (a) DCT based JPEG compression (b) Wavelet based compression (15) 20 log10 [255 / MSE ] Where, X(i, j) = Original image; (c) Hybrid approach for image compression Y(i, j) = Recovered image after decompression; Fig. 7 Reconstructed images of Adhar card for different image compression methods. m and n are height and width of the image; MSE = Mean Square Error; Compression ratio (CR) is calculated by following formulae, Compression ratio Original image size Compressed image size (15) Values of CR and PSNR are calculated for different images using DCT based JPEG compression, Wavelet based image compression [14] and for Hybrid image compression discussed in this paper. PSNR obtained by Hybrid method of compression for ROI, is better than both the individual methods. PSNR for non ROI has nearly same as that of PSNR obtained by DCT based JPEG image compression also the CR obtained is remarkable and comparable to DCT based JPEG compression method. This signifies that a hybrid approach is providing the benefits of both individual methods (a good PSNR from DWT based compression and good CR from DCT based JPEG compression method). The average of the compression ratio and Average of PSNR (for ROI) for images operated under this algorithm is found to be 15.3499 and 41.1862 respectively. (a) DCT based JPEG compression (b) Wavelet based compression (c) Hybrid approach for image compression Fig. 9 Reconstructed images of Canada PM for different image compression methods. VIII. CONCLUSION The algorithm proposed in this paper, Hybrid Image Compression Technique for ROI [15] [13] based compression. The algorithm provides a better way to compress the image on the basis of priority of regions. In this approach ROI is compressed with relatively less lossy compression technique ISSN: 2231-5381 http://www.ijettjournal.org Page 207 International Journal of Engineering Trends and Technology (IJETT) – Volume23 Number 4- May 2015 digital still images," in Image Processing and Communications Challenges 3. Springer, 2011, pp. 59-64. [8] H. H. K. Tin, "Robust Algorithm for Face Detection in Color Images," International Journal of Modern Education and Computer Science (IJMECS), vol. 4, no. 2, p. 31, 2012. [9] J. Park, J. Seo, D. An, and S. Chung, "Detection of human faces using skin color and eyes," in Multimedia and Expo, 2000. ICME 2000. 2000 IEEE International Conference on, vol. 1, 2000, p. 133–136. (a) ROI for Adhar card image (b) ROI for Canada PM image [10] K. Sandeep and A. N. Rajagopalan, "Human Face Detection in Cluttered Color Images Using Skin Color, Edge Information.," in ICVGIP, 2002. Fig. 8 Region inside the red box is the ROI and the rest of the image is non ROI. [11] R. C. Gonzalez, R. E. Woods, and S. L. Eddins, "Digital image processing using MATLAB," Upper Saddle River, N. J: Pearson Prentice Hall, 2004. REFERENCES [12] S. Suchitra and K. Wahid, "Hybrid DWT-DCT algorithm for biomedical image and video compression applications," in Information Sciences Signal Processing and their Applications (ISSPA), 2010 10th International Conference on. IEEE, 2010, pp. 280-283. [1] B. Brindha and G. Raghuraman, "Region based lossless compression for digital images in telemedicine application," in Communications and Signal Processing (ICCSP), 2013 International Conference on. IEEE, 2013, p. 537–540. [2] V. K. Bairagi and A. M. Sapkal, "Automated region-based hybrid compression for digital imaging and communications in medicine magnetic resonance imaging images for telemedicine applications," Science, Measurement \& Technology, IET, vol. 6, no. 4, pp. 247-253, 2012. [3] P. Zhao, J. Dong, and L. Wang, "Image compression algorithm based on automatic extracted ROI," in 2014 11th International Conference on Fuzzy Systems and Knowledge Discovery (FSKD),, 2014, pp. 788-792. [4] S. Han and N. Vasconcelos, "Object-based regions of interest for image compression," in Data Compression Conference, 2008. DCC 2008. IEEE, 2008, pp. 132-141. [13] V. Vlahakis and R. I. Kitney, "ROI approach to wavelet-based, hybrid compression of MR images," in Image Processing and Its Applications, vol. 2, 1997, pp. 833-837. [14] S. Fukuma, S. Ikuta, M. Ito, S. Nishimuru, and M. Nuwate, "An ROI image coding based on switching wavelet transform," in ISCAS'03. Proceedings of the 2003 International Symposium on Circuits and Systems, 2003., vol. 2, 2003, pp. II-420-II-423. [15] H. Yang, M. Long, and H. M. Tai, "Region-of-interest image coding based on EBCOT," in In Vision, Image and Signal Processing, IEE Proceedings, 2005, pp. 590-596. [16] S. Chintalapati and M. V. Raghunadh, "Automated attendance management system based on face recognition algorithms," in Computational Intelligence and Computing Research (ICCIC), 2013 IEEE International Conference on, 2013, pp. 1-5. [5] C. A., "Lossless image compression using integer to integer wavelet transforms," in International Conference on Image Processing,, vol. 1, 1997, pp. 596-596. [6] G. K. Wallace, "The JPEG still picture compression standard," in Consumer Electronics, IEEE Transactions on, vol. 38, 1992, p. xviii– xxxiv. [7] T. Orczyk and P. Porwik, "Feature based face detection algorithm for TABLE I COMPARISON OF HYBRID IMAGE COMPRESSION ON THE BASIS OF PSNR AND CR IMAGES PSNR (By Hybrid approach for ROI) PSNR (By Hybrid approach for non ROI) PSNR (By DCT based JPEG comp. on whole image) PSNR (By DWT based comp. on whole image) CR (By Hybrid approach) CR (By DCT based JPEG comp. approach) CR (By DWT based comp.) Canada PM 40.4023 30.4477 13.0719 33.59261 20.9628 29.9474 15.7079 Election ID 42.1817 21.2049 23.0197 28.1238 12.0531 13.3337 3.8176 Adhar card 45.5398 23.7561 20.6229 30.3115 16.6520 18.7335 5.1684 Company ID 40.1242 25.4295 19.3462 31.3405 12.3700 14.7108 7.4426 President 37.6601 27.6090 16.2533 31.7178 14.7116 21.8770 9.6139 ISSN: 2231-5381 http://www.ijettjournal.org Page 208