Image compression based on 2D Discrete Fourier Transform and matrix minimization algorithm

In the present era of the internet and multimedia, image compression techniques are essential to improve image and video performance in terms of storage space, network bandwidth usage, and secure transmission. A number of image compression methods are available with largely differing compression ratios and coding complexity. In this paper we propose a new method for compressing high-resolution images based on the Discrete Fourier Transform (DFT) and Matrix Minimization (MM) algorithm. The method consists of transforming an image by DFT yielding the real and imaginary components. A quantization process is applied to both components independently aiming at increasing the number of high frequency coef ﬁ cients. The real component matrix is separated into Low Frequency Coef ﬁ cients (LFC) and High Frequency Coef ﬁ cients (HFC). Finally, the MM algorithm followed by arithmetic coding is applied to the LFC and HFC matrices. The decompression algorithm decodes the data in reverse order. A sequential search algorithm is used to decode the data from the MM matrix. Thereafter, all decoded LFC and HFC values are combined into one matrix followed by the inverse DFT. Results demonstrate that the proposed method yields high compression ratios over 98% for structured light images with good image reconstruction. Moreover, it is shown that the proposed method compares favorably with the JPEG technique based on compression ratios and image quality.


Introduction
The exchange of uncompressed digital images requires considerable amounts of storage space and network bandwidth. Demands for efficient image compression result from the widespread use of the Internet and data sharing enabled by recent advances in digital imaging and multimedia services. Users are creating and sharing images with increased size and quantity and expect quality image reconstruction. It is clear that sharing multimedia-based platforms such as Facebook and Instagram lead to widespread exchange of digital images over the Internet [1]. This has led to efforts to improve and fine-tune present compression algorithms along with new algorithms proposed by the research community to reduce image size whilst maintaining the best level of quality. For any digital image, it can be assumed that the image in question may have redundant data and can be neglected to a certain extent. The amount of redundancy is not fixed, but it is an assumed quantity and its amount depends on many factors including the requirements of the application to be used, the observer (viewer) or user of the image and the purpose of its use [2,3]. Basically, if the purpose of an image is to be seen by humans then we can assume that the image can have a variable high level of redundant data. Redundant data in digital images come from the fact that pixels in digital images are highly correlated to a level where reducing this correlation cannot be noticed by the human eye (Human Visual System) [4,5]. Consequently, most of these redundant, highly correlated pixels can be removed while maintaining an acceptable level of human visual quality of the image. Therefore, in digital images the Low Frequency Components (LFC) are more important as they contribute more to define the image contents than High Frequency Components (HFC). Based on this, the intension is to preserve the low frequency values and shorten the high frequency values by a certain amount, in order to maintain the best quality with the lowest possible size [6,7].
Image frequencies can be determined through a number of transformations such as the Discrete Cosine Transform (DCT), Discrete Wavelet Transform (DWT) and Discrete Fourier Transform (DFT) [8]. In this study we will use DFT as a first step in the process to serialize a digital image for compression. Since its discovery, the DFT has been used in the field of image processing and compression. The DFT is used to convert an image from the spatial domain into frequency domain, in other words it allows us to separate high frequency from low frequency coefficients and neglect or alter specific frequencies leading to an image with less information but still with a convenient level of quality [8][9][10].
We propose a new algorithm to compress digital images based on the DFT in conjunction with the Matrix Minimization method as proposed in Ref. [10,11]. The main purpose of matrix minimization is to reduce High Frequency Components (HFC) to 1/3 of its original size by converting each three items of data into one, a process that also increases redundant coefficients [11,12]. The main problem with Matrix Minimization is that it has a large probability data called Limited-Data [13,14,16]. Such probabilities are combined within the compressed file as indices used later in decompression.
Our previous research [13,14] used the DCT combined with Matrix Minimization algorithm yielding over 98% compression ratios for structured light images and 95% for conventional images. The main justification to use DFT in the proposed method is to demonstrate that the Matrix Minimization algorithm is very effective in connection with a discrete transform and, additionally, to investigate the DFT for image compression.
The contribution of this research is to reduce the relatively large probability table to two values only, minimum and maximum, rather than keeping the entire lookup table (referred to as Limited-Data in our previous research [10,11,12and13]). The main reason is to increase compression ratios by reducing the size of the compressed file header.    The proposed compression algorithm is evaluated and analyzed through measures of compression ratios, RMSE (Root Mean Square Error) and PSNR (Peak Signal-to-Noise Ratio). It is demonstrated that the proposed method compares well with the popular JPEG technique.

The proposed compression algorithm
The proposed compression method is illustrated in Fig. 1. Initially, an original image is subdivided into non-overlapping blocks of size M x N pixels starting at the top left corner of the image. The Discrete Fourier transform (DFT) is applied to each M x N block independently to represent the image in the frequency domain yielding the real and imaginary components. The Matrix Minimization algorithm is applied to each component and zeros are removed. The resulting vectors are subjected to Arithmetic coding and represent the compressed data.
To illustrate the process for each M x N (M ¼ N ¼ 4) block in the original image, we represent a 4 Â 4 block in Fig. 2

below:
A uniform quantization is then applied to both parts, which involves dividing each element by a factor called quantization factor Q followed by rounding the outcomes which results in an increase of high frequency coefficients probability thus reducing the number of bits needed to represent such coefficients. The result of this operation is that the compression ratio increases. Fig. 3 Fig. 4 illustrates the content of the generated three matrices.
Since the size of the LFC-Matrix is small compared to HFC-Matrices, it is very obvious that HFC matrices for both real and imaginary parts need to be reduced to get a reasonable compression. Therefore, the algorithm called Matrix-Minimization suggested by Siddeq and Rodrigues [10] is applied. The algorithm is used to reduce the size of HFC matrices by contracting every three coefficients to a single equivalent value, which can be traced back to their original values in the decompression phase. The contraction is performed on each three consecutive coefficients using Random-Weight-Values. Each value is multiplied by a different random number (Ki) and then their summation is found, the value generated is considered a contracted value of the input values. Fig. 5 illustrates the Matrix Minimization applied to M x N matrix [11,12].
It is important to note that in the decompression phase a search algorithm is required to find the three original values that are used to find the contracted value, therefore, the minimum and maximum values of the m x n block are stored. The idea behind this is to limit the range of values required to recover the original three values that made the contracted value hence increase the speed of the search algorithm at decompression stage.
Because in previous work the range of the search space are limited in the array for easy searching and this was encoded in the header file to be used at decompression stage. However, it is possible that complex images may generate large arrays which, in turn, will impair compression (make it more computationally demanding). For this reason, we suggested another method in this paper using DFT and reduced limited search area    After the Matrix-Minimization algorithm has been applied, the produced HFC-Matrix for both real and imaginary parts are examined and it is possible to see a high probability in the number of zero values than any other values in the matrix. Therefore, separating zero from non-zero values will remove redundant data and hence increase the efficiency of the arithmetic coding compression [9,10,13,14].
The implementation of the method is by isolating all zero values from the matrix while preserving all non-zero values in a new array called Value Matrix. The total number of zeros removed between each non-zero value in the HFC-Matrix is counted during the process. A new array called Zero Matrix is then created in which we append a zero value whenever we have a non-zero value at the same index in the original HFC-Matrix followed by an integer that represents the total number of zeros between any two non-zero values. Fig. 6 demonstrates the process of separating zeros and non-zero values [14][15][16].
The zero values in the Zero-Matrix reflect the actual non-zero values in sequences in the original matrix. Likewise, the integer values reflect the total number of zeros that come thereafter. Finally, the two matrices are ready for compression by a coding method which in our case is arithmetic coding [6,7]. It is important to note that the proposed method described above is also applied to the LFC-Matrix which contains the low

The decompression algorithm
The decompression algorithm is a counter compression operation which performs all functions of the compression but in reverse order. The steps to decompression start by decoding the LFC-Matrix, Value-Matrix and Zero-Matrix using arithmetic decoding followed by reconstructing a unified array based on Value and Zero matrices and reconstruct the HFC-Matrix for both parts. Siddeq and Rodrigues proposed a novel algorithm called Sequential Search Algorithm [10][11][12][13], which is based on three pointers working sequentially to regenerate the three values that constitute the contracted values with assistance of the MIN and MAX values which were preserved during the compression process. The MIN and MAX values are considered to be the limited space search values used to restore the actual HFC for both parts (real and imaginary) [14][15][16][17][18]. Finally, an inverse quantization and DFT is applied to each part to reconstruct the compressed digital image. Fig. 7 illustrates the decompression steps.

Experimental results
Experimental results shown here demonstrate the efficacy of the proposed compression technique. Our proposed method was implemented in MATLAB R2014a running on an Intel Core i7-3740QM microprocessor (8-CPUs). For clarity, we divide the results into two parts: The method applied to general 2D images of different sizes and assess their visual quality with RMSE [1,3]. Also, we applied Peak Signal-to-Noise Ratio (PSNR) for measuring image quality. This measurement widely used in digital image processing [23]. Tables 1  and 2 show the first part of results by applying the proposed compression/decompression method to six selected images whose details are shown in Figs. 8 and 9.
We apply the proposed compression technique to structured light images (i.e. a type of image used for reconstruct 3D surfaces -see Section 5).

Results for structured light images and 3D surfaces
A 3D surface mesh reconstruction method was developed by Rodrigues [8,19] with a team within the GMPR group at Sheffield Hallam University. The working principle of the 3D mesh scanner is that the scene is illuminated with a stripe pattern whose 2D image is then captured by a camera. The relationship between the light source and the camera determines the 3D position of the surface along the stripe pattern. The scanner converts a surface to a 3D mesh in a few milliseconds by        shows decompressed for Face2 2D image, that used in 3D application to reconstruct 3D mesh surface. The 3D mesh was successfully reconstructed without significant distortion at high compression ratios of 98.5%.
using a single 2D image [19,20] as shown in Fig. 10. The significance of using such 2D images is that, if the compression method is lossy and results in a noisy image, the 3D algorithms will reconstruct the surface with very noticeable artefacts, that is, the 3D surface becomes defective and degraded with problem areas easily noticeable. If, on the other hand, the 2D compression/decompression is of good quality, then the 3D surface is reconstructed well and there are no visible differences between the original reconstruction and the reconstruction with the decompressed images. Fig. 10 (left) depicts the GMPR scanner together with an image captured by the camera (middle) which is then converted into a 3D surface and visualized (right). Note that only the portions of the image that contain patterns (stripes) can be converted into 3D; other parts of the image are ignored by the 3D reconstruction algorithms [21,22]. The original images used in this research are shown in Fig. 11 (Corner, Face1  and Face2). The three images shown in Fig. 11 were compressed by the method described in this paper whose compressed sizes with RMSE and PSNR are shown in Table 3. After decompression, the images were subjected to 3D reconstruction using the GMPR method and compared with 3D reconstruction of the original images. The reconstructed 3D surfaces are shown in Figs. 12-14.

Discussion and comparative analysis
Our literature survey did not show results for image compression using the DFT alone. The reason is that by applying a DFT, it yields two sets of coefficients, real and imaginary. If one wishes to keep those for faithful image reconstruction, then it is not possible to achieve high compression ratios. We applied the DFT as described in this paper resulting in images with good visual quality and low compression complexity. A comparative analysis between compression ratios for DFT alone and DFT followed by the Matrix Minimization algorithm show Table 4 Comparative analysis of using DFT alone and our proposed method (DFT and Matrix Minimization) based on image quality and compressed size.  Table 5 Comparative analysis of compression using JPEG and our approach based on image quality and compression size.     enormous differences as shown in Table 4.
The results demonstrate that our proposed method of using a DFT in conjunction with the Matrix Minimization algorithm has the ability to compress digital images up to 98% compression ratios. It is shown that the DFT alone cannot compress images with similar ratios and quality. Although it can be seen from Table 4 that our proposed method (DFT þ Matrix Minimization algorithm) increases the overall RMSE and, while some image details are lost, reconstructed images are still high quality.
Additionally, the proposed method is compared with JPEG technique [23][24][25] which is a popular technique used in image and video compression. Also, the JPEG is used in many areas of digital image processing [26]. The main reason for comparing our method with JPEG is because JPEG is based on DCT and Huffman coding. Table 5 shows the analytical comparison between the two methods.
In above Table 5 it shown that our proposed method is better than JPEG technique to compress structured light images, while for conventional images it can be stated that both methods are roughly equivalent as image quality varies in both methods. The following Figs. 15-17 show comparisons between our approach the and JPEG technique for the images shown in Tables 4 and 5 Concerning the compression of structured light images for 3D mesh reconstruction, the comparison of our method with JPEG shows enormous potential for our approach as depicted in Figs. 11-14. Trying to compress the same images using JPEG and then using the decompressed image to generate the 3D mesh clearly shows the problems and limitations of JPEG. This is illustrated in Fig. 17, which shows the JPEG technique on two structured light images for 3D mesh reconstruction.
Comparative analysis focused on our previous work on the Matrix Minimization algorithm based on two discrete transforms DWT and DCT, as suggested by Siddeq and Rodrigues [9][10][11] performing compression and encryption at the same time. However, complexity of compression and decompression algorithms is cited as a disadvantage of previous work. Table 6 shows the decompression time for the Matrix Minimization algorithm [12] (previous work) compared with our proposed approach. The advantages of the proposed over previous work are summarized as follows: The complexity of the decompression steps is reduced in the proposed approach. This is evident from execution times quoted in Table 6 as the current approach runs faster than previous work on the same hardware. The header file information of current approach is smaller than previous work leading to increased compression ratios.
It is important to stress the significant novelties of the proposed approach which are the reduced number of steps at decompression stage and smaller header information resulting in faster reconstruction from data compressed at higher compression ratios. Table 7 shows that our proposed image compression method has higher compression ratios and better image quality (i.e. for both types conventional and structured light images) as measured by RMSE and PSNR.

Conclusion
This research has demonstrated a novel approach to compress images in greyscale, colour and structured light images used in 3D reconstruction. The method is based on the DFT and the Matrix-Minimization algorithm. The most important aspects of the method and their role in providing high quality image with high compression ratios are highlighted as follows.
After dividing an image into non-overlapping blocks (4 Â 4), a DFT is applied to each block followed by quantizing each part (real and imaginary) independently. Meanwhile, the DC value (Low Frequency Coefficients) from each block are stored in a new matrix, while the rest of the values in the block are the High Frequency Coefficients. The Matrix-Minimization algorithm is applied to reduce the highfrequency matrix to 1/3 of its original size, leading to increased compression ratios. The relatively large probability table of previous method was reduced to two values, minimum and maximum leading to higher compression ratios and faster reconstruction.
Results demonstrate that our approach yields better image quality at higher compression ratios while being capable of accurate 3D reconstruction of structured light images at very high compression ratios. Overall, the algorithm yields a best performance on colour images and structured light images used in 3D reconstruction than on standard grey images.
On the other hand, the compression steps introduced by the MM algorithm, especially at decompression stage, make the compression algorithm more complex than, for instance, standard JPEG. In general, it can be stated that decompression is slower than compression due to the search space to recover the original Low and High Frequency coefficients. In addition, arithmetic coding and decoding is applied to three sets of data (DC values, in addition to real and imaginary frequency coefficients) adding significantly more computation steps leading to increased execution time.

Conflicts of interest
The authors declare that there are no conflicts of interest regarding the publication of this paper. Cultural Research Institute (C3RI) and the Research and Innovation Office at Sheffield Hallam University for their support.