# Efficient Implementation of Matrix-Based Image Processing Algorithms for IoT Applications
## 1 Introduction and Related Work
Recent methods for removing noise from images (based on sparse representation and including the use of neural networks) are illustrated in [9; 10]. Of these, those that can be expressed in matrix form can be implemented using CNN accelerators. The compressive sensing idea is based on the sparsity of the sampled signal. Sparsity means that a discrete-time signal depends on several degrees of freedom much smaller than its finite length [11; 12]. Many natural signals are sparse or compressible in the sense that they have concise representations when expressed in the proper basis or transformation \(\mathbf{\Psi}\). There is a duality between time and transformation domain (frequency) that expresses the idea that samples having a sparse representation in transformation domain (frequency) must be spread out in the domain in which they are acquired (time). We consider \(\mathbf{x}=\mathbf{\psi}\mathbf{C}\), where \(\mathbf{x}\) is an image with size \((W,H)\) pixels represented as a vector, with \(N=WH\), \(\mathbf{\psi}\) is a matrix of size \((N,N)\) and \(\mathbf{C}\) is a vector of size \((N,1)\). The small coefficients \(C_{i}\) may be discarded in the representation of \(x(n)\) without much loss. The right choice of coefficients can lead both to the elimination of noise and to the compression of the image. Let \(\mathbf{y}\) be a vector of size \((N,1)\) with \(S\) random chosen elements of \(\mathbf{x}\) in set \(S\) and the rest zero elements and \(\mathbf{\Phi}\) a matrix of size \((N,N)\) with rows of the inverse of matrix \(\mathbf{\psi}\) selected by elements in set \(S\). The coefficients can be chosen using the compressive sensing principle. The coefficients are computed as \(\mathbf{C_{1}}=\mathbf{\Phi y}\), and then, the signal is reconstructed as \(\mathbf{x}_{1}=\mathbf{\Psi}\mathbf{C}_{1}\). Vector \(\mathbf{y}\) will be selected so that \(\mathbf{x}_{1}-\mathbf{x}\) is the minimum. Vector \(\mathbf{y}\) can be chosen using the random sampling consensus (CS-RANSAC) algorithm, which works well in the presence of relatively large numbers of disrupted pixels that will be considered as outliers. The other pixels, undisturbed or disturbed by weak noise, will be considered as inliers and will be selected by the CS-RANSAC algorithm as the consensus set. The consensus set is vector \(\mathbf{y}\) and will be used in compressive sensing reconstruction as explained above. This paper analyzes a noise elimination algorithm (CS-RANSAC) based on compressing sense and RANSAC combined with DCT transform [12; 13; 14]. It is focused on the implementation of microcontrollers (for the IoT applications) and performance analysis (execution time and precision) to reduce the calculation time. This paper emphasizes the efficient implementation using CNN accelerators and compares it with classical implementations. The following sections will describe the algorithm in detail (Section 2), its performance with infinite precision (Section 3), the implementation of proposed algorithm using microcontrollers (Section 4), and the performances obtained using finite precision microcontrollers without accelerators (Section 5). Section 6 illustrates the implementation and the performance evaluation obtained using finite precision microcontrollers with integrated accelerators, and Section 7 presents the conclusion. To improve the execution time, a modified algorithm that involves DCT denoising for image regions less affected by noise and the CS-RANSAC algorithm for the image regions more affected by noise can be used. To do this, a simplified algorithm to estimate the noise power can be used [15; 16]. Finally, the results are shown and commented on. The conclusion is that such non-filtering denoising techniques can be applied with good performance to eliminate or reduce the noise in images and to compress the image, making it suitable for IoT applications.