Energy-efficient image compression algorithm for wireless sensor networks in structural health monitoring applications

In Wireless Sensor Networks (WSN), transmitting an uncompressed image consumes more energy than a compressed image, and it is, therefore, the prime requirement to establish energy-aware compression methods to extend the life of the sensor node, and ultimately the network as a whole. This work suggests an image compression algorithm with a low degree of complexity for WSNs in structural health monitoring applications. This algorithm represents a pruning approach to a Discrete Cosine Transform approximation transform in which the transformation matrix is modified to reduce the series of steps and the compression ratio achieved is better compared to the actual image which makes it easy for the data storage. Because of the reduction in the number of data bits, it enhances the lifetime of the network by reducing the number of node failures caused by resource scarcity. The implementation is tested by capturing real-time images of concrete walls in buildings using Raspberry Pi3B + WSN gateway fitted with camera modules. The scheme is also investigated in terms of a variety of parameters like Peak Signal to Noise Ratio, Mean Square Error, Structural SIMilarity Index and Compression Ratio. This technique achieves the best arbitration of energy consumption and image quality.


Introduction
Wireless Sensor Networks (WSNs) are distributed intelligent systems equipped with smart cameras with the capability to sense, process and to communicate multimedia information from the environment in real time.These data are rich in multimedia content and hence are bandwidth intensive [1].But WSNs are resource constrained to handle such bandwidth intensive content.The transmission of this raw data content also consumes considerable network resources.This demands the need for efficient algorithms to reduce the amount of information content by compression, and effective mechanisms to overcome the inefficient use of network resources by defining efficient power optimization techniques.These techniques enhance the capacity of the communication channels.
In this paper, a pruned approach to normal Discrete Cosine Transform (DCT) is considered with the reduced complexity in terms of the number of additions which implies reduced computations to conserve energy.The existing and proposed algorithms have been tested with a finite number of test image sets and the results thus attained by simulation are compared on the basis of some standard performance metrics like Peak Signal to Noise Ratio (PSNR), Mean Square Error (MSE), Compression Ratio (CR) and Structural SIMilarity index (SSIM).The processing time and implementation are tested using Raspberry Pi3B+ and Python and the graphs are plotted using Python.From the results obtained, it is inferred that improved values of the above said metrics are achieved.The section of the following work is written as follows: Section 2 discusses an overview of works and surveys carried out thus far for compression.The current DCTs are covered in Section 3. Section 4 deals with the approach proposed and Section 5 deals with the propagation model.Section 6 discusses the results acquired by the simulations, and Section 7 summarizes the conclusion of the article.

Related works
There are several efficient techniques in the literature for image compression currently, and the primary goal of these techniques is to omit non-relevant image data and to efficiently process only the useful information.However, in the process of obtaining the necessary compression ratio, both the useful and irrelevant information are affected and thus suitable methods need to be used depending on the applications.In general, the image compression schemes are classified based on the type of transform used as Discrete Cosine Transform (DCT) and Discrete Wavelet Transform (DWT).[2,3] examine and classify images compression algorithms into Transform Based Schemes and Non-Transform Based schemes which are used in resourcelimited systems.
DCT is a block-based image compression scheme that utilizes more energy and produces blocking artefacts, causing performance degradation at low bit rates [2,3].Although a key disadvantage is blocking artefacts created by the DCT, its limited processing ability, and strong localization in the frequency and time (space) domains lead to significant improvements.
All transform-based schemes under DWT require almost high memory due to the very high number of operations required for effective reconstruction in the decoding end, long processing times, etc. which makes it inappropriate for WSNs and can be used only after effective modifications.With the progressive encoding property, the EZW method is simple and effective, but it takes more passes to compress an input image for efficient reconstruction.As a result, a lot of memory is needed.It is also affected by errors in transmission and packet loss, and it lacks multiresolution scalability [2,3].As compared to EZW, SPIHT produces an output bit stream with a lower bit rate and compactness, as well as reduced computational complexity since the threshold is halved for each sorting pass and progressive encoding is supported.However, the main disadvantage of SPIHT is its high memory capacity requirements and is vulnerable to packet failures [2,3].Bit streams in EBCOT can be organized and arranged in a variety of ways.However, the EBCOT algorithm has a higher memory requirement, a longer processing time, and a higher computational complexity, all of which increase power dissipation.
Non-transform based schemes are often computationally and time-intensive, making them unsuitable for wireless sensor networks [2,3].As a result, the major disadvantages of the techniques discussed thus far that prevent them from being implemented in WSNs are primarily the high memory requirements, the increased number of operations needed to provide successful reconstruction, which results in long processing times, packet losses, and so on, as well as the fact that they can only be used with suitable modifications in the WSNs.
For WSNs, an image compression approach is proposed in [4] that use a combination of DCT and Huffman coding by leveraging the similarity between adjacent pixels, which reduces sensor energy consumption and thus maintains a long network lifetime by putting less strain on nodes.In [5], the author proposes DCT along with Least Squares Interpolation to suggest the usage of the DCT algorithm for image compression in real-time applications with the bit-based transmission.In [6], the author implements an in-exact adder architecture with the implementation of DCT transform using 180 nm CMOS process technology and proved its efficiency with minimal area and power requirement without any significant compromise in PSNR to assist in the creation of an error-resistant image and video compression applications.In [7], a three-stage DCT is proposed which is a step-by-step process that requires less energy and less delay while the accuracy level is maintained perfectly.In the first stage, all computationally expensive floating-point multiplications are removed and the DCT uses only shift operations and additions.In the second level, an appropriate filtering method is used to remove the information that is not sensitive to humans, and in the third level, an inexact adder implementation is employed to prove the reduction in energy and delay.
In [8], a set of approximations are introduced for the DCT algorithm like floor, ceil, truncation, etc. to make DCT less complex in terms of arithmetic operations with a multiplier less DCT that is incorporated with only the additions and bit shift operations.The approximations were assessed in terms of computations and JPEG-like compression efficiency and found to be a good compromise.A set of different transformations were tested in [9] to prove the effectiveness of DCT algorithms in image compression.Because of its outstanding energy compaction capabilities, DCT is used widely as discussed in [10], which proposes multiplier-free approximate DCT transformations that give greater compression performance at very minimal circuit complexity with 14 additions and extends the network lifetime.In [11], a trade-off strategy for energy consumption and distortion is proposed using fast zonal DCT.A low complexity approach was discussed in [12] that use only additions and bit shift operations to reduce the arithmetic complicacy of the DCT process, but bit shift operations consume certain power.

DCT-based image compression
The 2-D DCT computation using the direct method is highly computationally intensive with O(N 4 ) multiplications and O(N 4 )-O(N 2 ) additions for an N × N block.For example, the common value of N used in any DCT is 8, and the process requires 4096 and 4032 multiplications and additions respectively.DCT and IDCT are given by the formulae (1) and (3) respectively.
with n, m = 0, 1, . . ., N-1 Theoretically to reduce the number of operations, a 2D-DCT computation is done by using two separate 1-D DCTs, by utilizing DCT's separability characteristic.First, the transformation of 1-D DCT occurs over each row to obtain the coefficients 1-D DCT.The calculated data is further applied with 1-D DCT to provide the 2-D DCT coefficients as in ( 4), where X is an image block of size 8 × 8, D is the 8 × 8 DCT matrix, R is the domain transformation obtained from 8 × 8 blocks and "T" signifies the transpose matrix operation (Figure 1).

R = D.X.D T (4)
The D matrix is orthogonal, i.e.D −1 = D T .Therefore, the inverse 2-D DCT is expressed in (5) as The above decomposition decreases the complexity of computation from O(N 4 ) to O(2N 3 ) multiplications and O(N 4 )-O(N 2 ) to O(2N 3 )-O(2N 2 ).For example, with the value of N = 8, the number of additions reduces from 4096 to 1024 and the number of multiplications reduces from 4032 to 896, indicating at least a fourfold decrease in the number of operations.The general concept of DCT process is such that the source image is captured, applied with the DCT technique, and the output is quantized and then encoded using the run-length encoding technique which generates a stream of bits to be transmitted.At the received end, the reverse processes are carried out like inverse run-length encoding, inverse quantization, inverse DCT and the image is then reconstructed which almost looks like the original source image.But DCT corresponds to a lossy compression technique and hence the exact replica of the source image cannot be obtained which can be validated using the performance parameters like PSNR, CR, SSIM and MSE.
The DCT transform utilizes considerable energy in the processing steps involved for JPEG or any other image formats.Hence the need for appropriate methods to save time and energy is required by reducing the numerical complexity.Several techniques to minimize DCT complexity are in use and these techniques are broadly classified into two methodologies like Fast DCT and Zonal DCT.The requirement for effective implementation of this algorithm is the number of operations is reduced by assessing only a segment of the DCT coefficients by exploiting interpixel redundancy and at the same time provides effective reconstruction at the receiving end without any loss of information, generally, the lower frequency coefficients as in Figure 2 and they are chosen based on how the transform matrix "C" is modified.A slight variation in the transform matrix called pruned approach will reduce the number of computations accordingly and an efficient transform matrix can be utilized in DCT computations.
A pruned 2-D DCT computes only a segment of DCT coefficients of order N × N with N = 8.A pruned approach can be used both with a square and triangular-shaped area with the number of coefficients given by K 2 and K × (K + 1)/2 respectively with N > K.Among the two forms, the square-shaped area provides a better balance of energy distortion which computes only the lower frequency coefficients.The number of computations can be reduced effectively by pruning procedure.

Proposed algorithm -DCT with modified transform matrix
The transform matrix in DCT plays a major role in reducing the number of bits to be transmitted after compression in which it exhibits strong energy compaction and the significant energy of an image is accumulated only on a few coefficients.As many of the higher frequency coefficients are 0, and only the low frequency pixels are concentrated in the upper portion after the 2D-DCT operation, here, the transform matrix is modified with 0s and 1/2s in appropriate positions by exploiting the redundancy between pixels and computing only a subset of coefficients.Based on this modification, the resultant transform is given by ( 6) which results in 12 additions and no shift operations.As shift operation implies multiple repeated bit shift operations depending on number of bit shifts, the complexity is also reduced further by modifying the transform matrix as given by ( 6), (7) and (8).
where C is the diagonal matrix and T is the transform matrix given by ( 7) and ( 8) This is compared with the state of the art Bouguezel-Ahmed-Swamy (BAS-2008) [9] DCT process, and Pruned BAS -2008 (P.BAS -2008) which used the C matrix and the transform matrix "T" as mentioned in ( 9), ( 10) and ( 11), (12) respectively, that produces The DCT operation using Equations ( 9) and (10) makes in 18 additions and 2 shift operations and the DCT operation using Equations ( 11) and ( 12) produces 14 additions and 1 shift operation.The complexity is further reduced in the proposed method by the modified values of the transform matrix given by ( 7) and ( 8) that results in 12 additions and no shift operations.
The signal flow graph for the proposed algorithm and its comparison with the existing algorithms are shown in Figures 3-5 respectively.
The proposed model is shown in Figure 6.Basically, a DCT involves a DCT matrix, quantization, and run-length encoding.In the proposed model, a Cohen-Daubechies-Feauveau (CDF) filter which is a set of analysis filters and synthesis filters for decomposition and reconstruction respectively is also included.CDF filter possesses good compression properties and it is included to minimize the number of bits further to improve network lifetime with respect to the nodes.
The proposed model operation is such that the image is captured by a sensor node and processing of the same is done with the modified DCT algorithm.Here for the experimental purposes a Raspberry Pi 4 board fitted with camera modules is used for image capturing.Raspberry Pi can be customized and programmable based on the requirements and is cheaper with an extendable memory capacity compared to the wireless sensor   nodes like MicaZ, TelosB, Iris, etc. [13].A Raspberry Pi 4 can also be deployed as a WSN gateway with a minimum power consumption profile [14].The image is captured and applied with modified DCT.For modified DCT, the transform matrix is modified as in (10) with the elimination of fractional values in the transform matrix.This is done to avoid the bit shift operations, as the bit shift operations consume energy depending on the number of bit shift operations.The 2D-DCT operation is performed based on ( 6) and its output is then quantized.The quantization process quantizes the image coefficients into the nearby quantization levels.
The quantization step introduces quantization error, and hence the step size must be chosen appropriately so as not to produce so much loss in the reconstructed image.
The resultant coefficients are further processed by a 9/7 CDF filter [15] which is a wavelet filter normally used by JPEG images for limiting the amount of data and CDF filter proves to be have very good multiresolutional analysis.CDF filter consists of a set of decomposition low-pass (LP) and high-pass (HP) analysis filters and reconstruction low-pass (LPR) and high-pass (HPR) filters synthesis filters.The filter coefficients are adjusted to provide lossless reconstruction but with a reduction in the data size.The filter coefficients used are as shown in ( 11), ( 12), ( 13) and ( 14) for the analysis and synthesis filters respectively.
The output of the CDF filtering process is then passed through a Run Length Encoded (RLE) step to produce a stream of bits to be transmitted through a communication channel.RLE is a lossless encoding procedure that encodes the data bits from the CDF filter stage into runs of 1s and 0s as a (data value, count) pair.After CDF filtering, the image coefficients are represented as 1s and 0s with many of the coefficients as 0s.This can be represented in RLE format and transmitted.
For reconstruction of the image in the receiver end, inverse RLE, Inverse CDF filtering, Inverse quantization, and Inverse DCT are done and the reconstructed image is analysed with PSNR, MSE, CR, SSIM, etc.

Compression
1. Decompose the image into 8 × 8 blocks 2. For the 1-D DCT, Multiply the 4 × 8 transform matrix with 8 × 8 image blocks with which results in a 4 × 8 output 3. Take transpose of the transform matrix 4. Multiply the output from step 2 with the transposed matrix from step 3 to obtain the 2D-DCT output of 4 × 4 image elements 5. Quantize the coefficients obtained from step 4 6.The output from step 5 is passed through a CDF9/7 filter 7. CDF9/7 filter performs convolution of the low pass, high pass coefficients along horizontal, vertical directions and the output is in the form of LL, LH, HL, and HH sub-bands 8. Encode the output obtained from step 7 using RLE.

Decompression
The final image can be reconstructed via reverse RLE, applying reverse CDF 9/7 filtering and reverse 2D-DCT coefficients in all stages.Figure 7 shows the process as depicted in Sections 4.1.1 and 4.1.2.

Performance metrics
The compression algorithm is tested on real-time images of concrete walls of buildings captured using Raspberry pi 4 module integrated with the camera.This setup will be very mush helpful in the monitoring of heritage buildings.All the images are of size 512 × 512 and a comparison of the suggested method to existing methods of DCT is established based on different performance metrics.The standard concrete crack images dataset [16] is also analysed.

Peak signal to noise ratio and mean square error
To determine the accuracy, PSNR and MSE are the most widely used parameters, where X(i,j) is the actual image before compression and Y(i,j) is the recovered image after decompression.The absolute error between the original image and the reconstructed image is based on PSNR and MSE.PSNR displays the accuracy of the reconstructed image based on the MSE of the reconstructed image as given by (15) and represents the maximum error between the original image and the reconstructed image.Numerator term in (15) represents an image's maximum pixel value and the denominator term is the MSE that represents the collective error and the image size is represented by m × n in the MSE term.PSNR indicates that the higher the PSNR value, the lower the MSE (less error) value, which in turn provides better reconstruction. 2 (15)

Compression ratio
Compression Ratio is the proportion of the size of the actual image to the compressed image.The compressed image size shall be computed after compression using the formula as given in (16).The greater the CR value, the more the picture gets compressed.

Compression Ratio (CR)
= Size of the Original Image Size of the Compressed Image (16) Based on the value of CR from ( 16), the space savings is given by (17) as

Experimental setup and complexity analysis of various DCT methods
Table 1 shows the total number of adds and multiplications that must be computed for various DCT methods.
The consolidation is done based on the number of operations for 1D as well as 2D-DCTs and the proposed method has a lesser number of operations when compared to the various methods.The real-time images are captured using a Raspberry pi 4 module fitted with the camera as shown in Figures 8-10, and the same module is used to run the algorithm to evaluate the time  taken to compute 8 × 8 pixel blocks of an image and the code size thus obtained also shows an appropriate validation of the proposed algorithm as shown in Table 2.In Table 2, the code size, processing time, and energy consumed are calculated for a block of DCT and it is found that the values obtained are even less for the combined methods of DCT, CDF, and RLE when compared to the P.BAS-2008.

Simulation results and analysis
Images of size 512 × 512 are captured using the Raspberry Pi camera module and the algorithm's efficiency has been tested and Figure 11 indicates the set of images captured for which the simulation and testing were conducted.The algorithm is tested for the standard concrete image set also [16].The sample simulation results obtained from the modified algorithm for the captured images are shown in Figure 12   The PSNR and MSE values closely approximate to the existing methods that have been compared with as the change after the DCT compression in very minimal as represented in Figures 18 and 19.
Table 3 shows the comparison of PSNR, MSE and SSIM between the two algorithms and shows increase in PSNR.The MSE value differs proportionately on the basis of PSNR which indicates the higher values of PSNR correspond to lower MSE values.The Structural Similarity Index (SSIM) of the images that are reconstructed at the receiver end, SSIM indicates the similitude between the actual image and the reconstructed image with a value between 0 and 1 with 1 relates to 100% similarity and 0 relates to no similarity.SSIM exploits the interdependencies among the pixels and quantifies the image quality degradation induced by processing images and data during compression and the losses using this perceptual metric.The plots of PSNR, MSE, and SSIM are done using Python software which is shown in Figures 20-22 respectively, and the values obtained are better when compared to the existing method.Furthermore, the suggested method is also validated in terms of rate distortion curve.It calculates the minimum number of bits per pixel that should be sufficient so that the input image (X) can be           it suitable for implementing this algorithm in a network of nodes.

Figure 7 .
Figure 7. Flowchart of the proposed model.
-17 which indicates the (a) original image, (b) DCT output, (c) CDF filter output and (d) reconstructed image at the receiving end.

Figure 23 .
Figure 23.Comparison of rate distortion curves.

Table 1 .
Complexity analysis of various DCT methods.

Table 2 .
Code size and processing time for a 8 × 8 block.