Image Compression Based on SVD and MPQ-BTC

In this paper we will provide a new way of images compression based on two mathematic concepts, these two concepts are Singular Value Decomposition (SVD), and Block Truncation Coding. The input image either is in JPEG format or in BMP format, and the current way suitable for both color and gray scale images. The input image will be compressed first by reducing the image matrix rank, which achieved by using the SVD process, and then the result matrix compressed by using BTC. The proposed algorithm gives further lossless compression to JPEG compression process and the rate of compression reach more than 99%.


INTRODUCTION
With the growth of using multimedia such as images, video, graphs, and audio in different application and internet, large amount of data are transmitted through network. Using of these data increase the requirements of storage capacity and transmission bandwidth. Image compression means minimizing the size of files in bytes without degrading the quality of the image to an unacceptable level. The main task of compression is to remove the redundancy ( Nivedita Sonika Jindal. 2012). Image compression deals with the problem of reducing the amount of data required to represent a digital image. Compression is achieved by the removal of three basic data redundancies: 1) coding redundancy, which is present when less than optimal; 2) Inter-pixel redundancy, which results from correlations between the pixels; 3) Psycho-visual redundancies, which is due to data that is ignored by the human visual (Doaa Mohammed, Abou Chadi, 2011).
There are two types of image compression namely lossy image compression and lossless image compression, the lossless compression mean the possibility to reconstruct the origin image and message without losing any data, while the lossy compression stand for the idea of losing some of information and data after decompressed the image.
Lossless data compression is ideal for text (D.Harihara Santoch, 2011). Lossy compression yields good compression ratio comparing with lossless compression while the lossless compression gives good quality of compressed images. JPEG and Block Truncation Coding (BTC) is a lossy image compression techniques. It is a simple technique which involves less computational complexity. BTC is a recent technique used for compression of monochrome image data. It is one-bit adaptive moment preserving quantizer that preserves certain statistical moments of small blocks of the input image in the quantized output. There are some papers suggested to use the SVD with other compression techniques such as. (Awwal et. al. 2014) presented new compression technique using SVD and the wavelet difference reduction WDR. The WDR used for further reduction. This technique tested with other techniques such as WDR and JPEG 2000 and gives better result than these techniques. Using WDR with SVD enhance the PSNR and compression ratio. (Adiwijaya et. al. 2013) suggested new compression method based on Wavelet-SVD, which used a graph coloring technique in the quantization process. This technique work well and enhanced the PSNR and compression ratio. The generated compression ratio by this paper ranged between 50-60%, while the average PSNR ranged between 40-80.

SINGULAR VALUE DECOMPOSITION (SVD)
SVD is robust and reliable orthogonal matrix decomposition method. Due to SVD conceptual and stability reasons, it becomes more and more popular in signal processing area. SVD is an attractive algebraic transform for image processing. SVD has prominent properties in imaging. Although some SVD properties are fully utilized in image processing, others still needs more investigation and contributed to.
A key property of SVD is its relation to the rank of a matrix and its ability to approximate matrices of a given rank. Digital images are often represented by low rank matrices and, therefore, able to be described by a sum of a relatively small set of eigen images. This concept rises the manipulating of the signal as two distinct subspaces (Rowayda A. Sadek, 2012).
The use of Singular Value Decomposition (SVD) in image compression has been widely studied (D.Harihara Santoch, 2011& Rowayda A. Sadek 2012, if the image when considered as a matrix, has low rank, or can be approximated sufficiently well by a matrix of low rank, then SVD can be used to find this approximation, and further this low rank approximation can be represented much more compactly than the original image. Every real matrix A m×n can be decompose into a product of three matrices A=USV T , where U and V are orthonormal matrices, where U T U=I, V T V=I, and S=diagonal (s 1 ,s 2 ,…). The diagonal entries of S are called the singular values of A and the columns of U are calls the right singular vectors of A, the columns of V are calls the left singular vectors of A. This decomposition is known as the SVD of A. SVD is one of the most useful tools of linear algebra with several applications to multimedia including image compression (Aleksandr et al. 2006) The m × n matrix A can be written as the sum of rank-one matrices.

A=
Where r is the rank of A, and and are the ith columns of U and V, respectively (Angel R. Pineda and Teav Vuthy, 2010) This property is known as the low-rank approximation property of the (SVD). We get the best least squares approximation to A of rank K ≤ r by keeping only the first k terms of a matrix A and the other terms left are ignored (Angel R. Pineda and Teav Vuthy, 2010) The rank of matrix A is equal to the number of its nonzero singular values". In many applications, the singular values of a matrix decrease quickly with increasing rank. This propriety allows us to reduce the noise or compress the matrix data by eliminating the small singular values or the higher ranks.
When an image is SVD transformed, it is not compressed, but the data take a form in which the first singular value has a great amount of the image information. With this, we can use only a few singular values to represent the image with little differences from the original.
The rank of A is the maximal number of linearly independent column vectors in A, i.e. the maximal number of linearly independent vectors among {a1; a2; : : : ; an}. If A = 0, then the rank of A is 0. SVD can offer low rank approximation which could be optimal sub rank approximations by considering the largest singular value that pack most of the energy contained in the image (Meftah M. Almrabet et al. 2009) (S. Vimala, et al. 2011). SVD shows how a matrix may be represented by a sum of rank-one matrices. The approximation a matrix A can be represented as truncated matrix Ak which has a specific rank k.

DIMENSION REDUCTION
One way to compress the image A is to approximate A by a matrix of smaller rank. If k < r then the closest approximation to A, (rank A = r) Since the singular values are arranged in descending order, when k goes nearly to r, S k+1 is very small (about near zero).Then S k+1 U k V k T is very small and in this case the effects of it on the matrix is trivial.
Thus A=A K (k≤ r) where r is a rank of matrix A For example when we take Lena image, the dimensions of this matrix image is (512×512), therefore rank of this matrix equals to 512, since the matrix can be written as a linear combination based on the singular values, the singular values are in descending order and not all with zero values. The first borders are significant in the construction of the matrix. Fig.1. shows how the images resolution affected with reducing the image rank.

BLOCK TRUNCATION CODING
Block Truncation Coding (BTC) works by dividing the image into small sub blocks and then reducing the number of gray levels within each block. This reduction is performed by a quantizer that adapts to the local image statistics. The basic form of BTC divides the whole image into N blocks and codes each block using a two-level quantizer (a, and b).
For each block the pixel values will be changed to (0, or 1) depending on the mean value ( ), the pixels value greater than or equal to mean replaced by "1", while the pixel values less than the mean ( ) replaced by "0". The collection of 1s and 0s for each block is called a bit plane, B. In BTC, two Statistical moments (a) and (b) are computed using the relations (1) and (2) and are preserved along with the bit plane for reconstructing the image. The compressed image is transmitted or stored as a set {B, a, b} a= (1)

b= (2)
Where, is the number of pixel values greater than or equal to and is the number of pixels whose gray levels are less than the mean .
While in the reconstructing the image, the 0 in the bit plane is replaced by a, and the 1 in the bit plane is replaced by b.

MOMENT PRESERVING QUANTIZER TECHNIQUES MPQ-BTC
The difference between BTC and MPQ-BTC is in the way of writing relations (1), and (2). Terms of mathematical operation are conducted in the same style, but the relations (1) and (2) are rewritten in the following form (3) (4)

METHODS AND MATERIALS
The SVD and MPQ-BTC algorithm combined together to compress the image in this paper, according to following steps The input image which has to be compressed is in the JPEG format or may be in the BMP format and compress with JPEG. This image stored as array of integers.
SVD will be computing for the input image (A = USV), and then compress the image by reducing the image rank, we choose the best k≤ r where r is the rank of image matrix. Image compressed by rebuild the image matrix (A = USV T ) with new reduced rank.
The result image from the SVD compression process will be divided to non overlapping square blocks; For each block we measuring the mean and the standard deviation, and then determine the values of (a, and b) as in relations (3, and 4). Each pixel value greater than the mean, will be replaced by the value (1) while the pixels value less than the mean will be replaced by the value (0), as in the following example for block 4x4 (mean for this example equal 142.18).
A= → a=115, b=168 The bit plain matrix B (x, x) which is the same size of the block (where x is the number of rows and columns for square matrix) will be reconstructed to new size depending on the origin block size (the result matrix will be rectangle matrix with (x/2) rows and (2x) columns.
2×2 block size will be reconstructed to size 1×4. And 4×4 block size will be reconstructed to size 2×8, and so on. So the above bit plane matrix becomes: C= At this case each 8 bits will be converted to one byte or to the corresponding decimal value inserted in the one dimension matrix D, which also included the value of (a, and b) at the last two rows.

D =
This process repeats for all the image blocks.

DECOMPRESSION PROCESS
The decompression process is the inverse of compression process: 1. The compressed image will be divided into one dimension blocks according to the following relation ((n + 2) / 2) + 1. (Where n is the block size during the compression process).
2. Convert the values of each byte for each block (except the last two rows) to the equivalent binary numbers.
3. Reconstruct the two dimension square matrix according to block size (n).
4. Each 0 in the resulted binary matrix will be replaced by the value a, while the value 1 replaced by b.
For the above example the recompressed matrix will be B =

1.
The proposed algorithm tested with many images some of them showed in Fig. 2, it is clear the decompression images are perceptually similar to origin images, note the rank in this test was 100, and the block size was 4x4.

2.
The compression ratio and PSNR of images varied when compression images by reducing the image rank in the SVD process as showed in Fig. 3, and Fig.  4.   Fig. 3: Relation between image rank and compression ratio.

3.
Compression ratio and PSNR for images when applying only the MPQ-BTC method showed in Fig. 5.

4.
Appling the proposed algorithm on (JPEG) gray scale image give the compression ratio begin with 95.4% according to block size, as shown in Fig. 6, the compression and decompression time shows in Fig. 7, while the PSNR, bit per pixel (bpp), and mean square error (MSE) shows in Table 1.

5.
The algorithm applied for color images and the compression ratio showed in Fig. 8, while the PSNR showed in Fig. 9.

6.
Changing the rank of image during the SVD process did not affect the compression ratio too much when applying the proposed copmression algorithm, it is almost the same compression ratio as shown in Fig.  10, but it was little bit changing in PSNR as shown in Fig. 11.

7.
We test the proposed algorithm with bmp images, these images compressed with three steps, first we compressed it with JPEG algorithm, and then compressed with SVD (rank equal 100), finally compressed with MPQ-BCT for different block size. The compression ratio were very high as shown in Fig.  12, also we test the compression and decompression time as in Fig. 13, and PSNR as in Fig. 14.   Fig. 12: total compression ratio when the input images was bmp images (rank=100).

8.
The proposed algorithm compared with different techniques and gives very good results, as shown in

CONCLUSIONS
We introduced in this paper new compression algorithm based on combine both SVD and MPQ for the compressed JPEG images. Using these techniques further compression is obtained in addition to compression achieved by JPEG format. The contribution of this paper is higher compression ratio is achieved due to additional compression; without compromising much on the quality of the image.
In the current proposed algorithm, we advice to use image rank = 100 for compression with SVD. Also we suggest using 4x4 block size for the MPQ-BCT compression technique.
The proposed algorithm compared with other algorithm and give very promised results.