ISSN:2229-6093 Aditya Kumar,Pardeep Singh, Int. J. Comp. Tech. Appl., Vol 2 (3), 525-529
Enhanced Block Truncation Coding for Gray Scale Image Aditya Kumar
Pardeep Singh
Department Of Computer Science & Engineering National Institute Of Technology, Hamirpur, India adi.bond.adi @gmail.com
Department Of Computer Science & Engineering National Institute Of Technology, Hamirpur, India
[email protected]
Abstract— Block Truncation Coding (BTC) is a streamlined and competent application for image compression. An improved BTC algorithm, namely Enhanced Block Truncation Coding (EBTC), is presented in this research study. Several gray scale images are used to appraise the coding efficiency and performance of this proposed algorithm with existing image compression algorithm. It is habitually shown that proposed algorithm give better result. In the EBTC algorithm, here bit plane is encoded to improve the compression Ratio and also improve the image quality. Simulation results show that bit rate and PSNR of this proposed EBTC are better than BTC as well as the ABTC in terms of subject visual quality, and significantly improves the compression ratio of BTC. Keywords- cross-correlation, spatial redundancy block truncation coding, quantization, peak signal to noise ratio.
I. INTRODUCTION Twentieth-century technologies like computers employ graphics elegantly. Our windows based operating system such as Microsoft windows XP, VISTA etc provide better GUI (graphical user interface) [1] to display file directory as well as another working application. An example of this scenario is downloading a data using any downloader that indicates its downloading progress using progress bar (status bar). Computer graphics [2] [3] is used in many fields to convert information into graphics (image) by which we can understand information easily or efficiently but images sometimes tends to big. Solution of this we can represent a data by reducing a number of bits and decreasing correlation [3] between pixels. That is the main reason behind image compression. In image compression, information can be compressed if it is redundant [4]. It has been mentioned several times that data compression amounts to reducing or removing redundancy in the data. With lossy compression [9], however, we have a new hypothesis, namely compressing by removing irrelevancy. An image can be lossy-compressed by removing irrelevant news even if the original image does not have any redundancy. The conception of losing image information becomes more luscious when we cogitate about that how digital images are fabricated. Here are three representative cases: (1) A non-fictitious image may be scanned from a photograph.
(2) An image may be recorded by a video camera that creates pixels and stores them directly in memory [5]. (3) An image may be painted on the screen by means of a paint program. In all these cases, some information is lost when the image is digitized [3] [4]. The reality is that the spectators have a tendency to accept this loss suggests that further loss of information might be tolerable if done properly. Digitizing an image involves two steps: sampling [5] and quantization [6]. Sampling an image is the process of dividing the two-dimensional original image into small regions: pixels. Quantization [3] [6] is the process of assigning an integer value to each pixel. Notice that digitizing sound involves the same two steps, with the difference that sound is onedimensional. Here is a simple way to determine qualitatively the amount of data loss in a compressed image. Given an image X, (1) compress it to Y, (2) decompress Y to Z, and (3) subtract D = Z−X.If A was compressed without any loss and decompressed. Properly, then Z should be similar to X and image D should be uniformly white. The more data was lost in the compression, the farther will D be from uniformly white. Certain compression methods are lossy [7]. They achieve better compression ratio by losing some information. When the compressed stream is decompressed, the result is not identical to the original data stream. Such a method makes sense especially in compressing images, movies, or sounds. If the loss of data is small, we may not be able to tell the difference. The amount of portrait data extends day by day. Huge space for store and bandwidth are required to store and transmit the images, which is more costly. Hence methods to compress the image data are essentially now-a-days. The image compression techniques are categorized into two main classifications namely lossy compression techniques and Lossless compression techniques. Lossless compression [1] [2] [7] ratio presents better peculiarity of compressed images, but yields only less compression whereas the lossy compression techniques [2]
525
ISSN:2229-6093 Aditya Kumar,Pardeep Singh, Int. J. Comp. Tech. Appl., Vol 2 (3), 525-529
lead to loss of data with higher compression ratio. JPEG [8] and Block Truncation Coding [2] is a lossy image compression techniques .It is a straightforward technique which embraces less computational complexity. BTC (Block Truncation Coding) [2] is a current modus operandi used for compression of gray scale image. It is onebit adaptive moment-preserving quantizer that preserves certain statistical moments of small blocks of the input image in the quantized output. The original algorithm of BTC preserves the standard mean and the standard deviation [2] [5]. The statistical overheads mean [2] and the Standard deviation are to be coded as part of the block. The truncated block of the BTC is the one-bit output of the quantizer [2] [5] [6] for every pixel in the block .Various methods have been proposed during last twenty years for image compression such BTC and Absolute Moment Block Truncation Coding AMBTC [1]. Block Truncation Coding AMBTC [1] [9].AMBTC preserves the higher mean and lower mean of the blocks and use this quantity to quantize output. AMBTC provides better image quality than image compression using BTC. Moreover, the AMBTC is quite faster compared to BTC. After this introduction we have given BTC algorithm in section II, ABTC algorithm in section III, proposed compression algorithm in section IV, performance analysis in section V and finally the conclusion in last section VI. II. BTC ALGORITHM Block Truncation Coding (BTC) is a well-known compression scheme proposed in 1979 for the grayscale images. It was also called the moment-preserving block truncation [1] [2] because it preserves the first and second moments of each image block. The BTC algorithm involves the following steps: 1.
An image is divided into nxn block (usually 4x4, and 8x8).
2.
Assuming that a block is containing n pixel with intensity value to .
3.
Calculate the mean and variance of each block. mean p= ∑
2x2,
p
variance p = p deviation α=√mean − varinace 4.
Calculate three values for each blocks Pmax, Pmin and and Pbase. If (Pmax >=Pbase) then Pi=Pmax
121 37 16 43
p
=98.75+ 92.75 √ =204.14
p
=98.75+ 92.75 √ =16.78
The rounded value of and is 204 and 17 respectively. Put these value in table 2 the modified table is 204 17 17 17
6.
Now update the 4 pixel intensity value using following formula. p
=p
+ α√
and p
=p
- α√
Table II 17 204 17 17
17 204 17 17
17 204 204 204
It is intuitively clear that 4x4 block is compressed into 16 bit only. Now again altered block is 1 0 0 0
Table III 0 1 0 0
0 1 0 0
0 1 1 1
III. ALGORITHM OF AMBTC Lema and Mitchell [1] [2] presented a simple and fast variant of BTC, named Absolute Moment BTC (AMBTC) [10] that preserves the higher mean and lower mean of a block. The AMBTC algorithm involves the following steps: An image is divided into non-overlapping blocks. The size of a block could be (4 x 4) or (8 x 8), etc. Calculate the average gray level of the block (4x4) as equations: Pixels in the image block are then classified into two ranges of values. The upper range is those gray levels which are greater than the block average gray level ̅ and the remaining brought into the lower range. The mean of higher range and the lower range xL are calculated as:
Otherwise Pi =Pmin It is intuitively clear that count of n+ pixels are greater than base value and n- pixel less than its base value Pbase .
47 255 169 251
In this above block can calculate three parameter value mean, variance and standard deviation. The calculated value of mean and standard deviation is 98.75 and 92.75 respectively. Here and have 7 and 9 respective value. Now we can find out and using the formula which mention in our propose algorithm.
x = ∑
5.
Table I 56 247 12 7
114 200 0 5
x =
p
1 number of pixel in block − K
p
Here k is the number of pixels whose gray level [10] is greater than . Binary block, denoted by B, is also used to represent the pixels. We can use “1” to represent a pixel whose gray level is
526
ISSN:2229-6093 Aditya Kumar,Pardeep Singh, Int. J. Comp. Tech. Appl., Vol 2 (3), 525-529
greater than or equal to and “0” to represent a pixel whose gray level is less than . The encoder writes . Then the total number of bits required for a block is 8+8+16 =32 bits. Thus, the bit rate for the AMBTC algorithm is 2 bpp. AMBTC has several advantages over BTC one advantage is in the case that the quantizer is used to transmit an image from transmitter to a receiver, it is necessary to compute at the transmitter the two quantities, the sample mean [1] [3] [10] and the sample standard deviation [10] for BTC and sample first absolute central moment for AMBTC. When we compare the necessary computation for deviation information, we will see that in case of standard BTC it is necessary to compute a sum of m values and each of them will be squared while in case of AMBTC it is only necessary to compute the sum of these m values. Since the multiplication time is several times greater than the addition time in most digital processors [10], thus using AMBTC the total calculation time at the transmitter is significantly reduced. 1. 2.
IV. PROPOSED ALGORITHM Take a gray scale image M and separate it into nxn blocks (normally 2x2, 4x4, etc). Prepare a prim_num vector list which holds all prime elements such as :
if( [r][c+1]= = [r][c]) then ( [r][c+1])= =
[r][c])
Case 3: If ( [r] [c+1] >
[r][c] andalso =>1.5*mean)
Then assign [r][c+1]=( α + average of prime number mean and value of pixel [r][c)/2 Else [r][c+1]= average of all prime number between mean and pixel and pixel value. Case 4: If ( [r] [c+1]