{'fraction_non_alphanumeric': 0.032778526423134356, 'fraction_numerical': 0.013949084022289398, 'mean_word_length': 4.5203055890631285, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
New Real-Time Impulse Noise Removal Method Applied to Chest X-ray Images

In this paper, we propose a new Modified Laplacian Vector Median Filter (MLVMF) for real-time denoising complex images corrupted by “salt and pepper” impulsive noise. The method consists of two rounds with three steps each: the first round starts with the identification of pixels that may be contaminated by noise using a Modified Laplacian Filter. Then, corrupted pixels pass a neighborhood-based validation test. Finally, the Vector Median Filter is used to replace noisy pixels. The MLVMF uses a 5 × 5 window to observe the intensity variations around each pixel of the image with a rotation step of π/8 while the classic Laplacian filters often use rotation steps of π/2 or π/4. We see better identification of noise-corrupted pixels thanks to this rotation step refinement. Despite this advantage, a high percentage of the impulsive noise may cause two or more corrupted pixels (with the same intensity) to collide, preventing the identification of noise-corrupted pixels. A second round is then necessary using a second set of filters, still based on the Laplacian operator, but allowing focusing only on the collision phenomenon. To validate our method, MLVMF is firstly tested on standard images, with a noise percentage varying from 3% to 30%. Obtained performances in terms of processing time, as well as image restoration quality through the PSNR (Peak Signal to Noise Ratio) and the NCD (Normalized Color Difference) metrics, are compared to the performances of VMF (Vector Median Filter), VMRHF (Vector Median-Rational Hybrid Filter), and MSMF (Modified Switching Median Filter). A second test is performed on several noisy chest x-ray images used in cardiovascular disease diagnosis as well as COVID-19 diagnosis. The proposed method shows a very good quality of restoration on this type of image, particularly when the percentage of noise is high. The MLVMF provides a high PSNR value of 5.5% and a low NCD value of 18.2%. Finally, an optimized Field-Programmable Gate Array (FPGA) design is proposed to implement the proposed method for real-time processing. The proposed hardware implementation allows an execution time equal to 9 ms per 256 × 256 color image.


Introduction
The processes of creating, acquiring, saving, and transmitting images often generate noise. A random alteration that an image undergoes can change the intensity of certain pixels to the minimum or maximum value, either 0 or 255. This phenomenon, known as impulsive noise or "salt and pepper" noise, can appear in a digital image due to data transmission errors, the presence of fine particles on the sensor elements of the camera, or faulty memory locations in the storage hardware. The presence of such noise considerably affects the process of understanding the image. Edge detection and segmentation are thus biased. This is the reason why work dedicated to the filtering and denoising of images has, for several years, taken an important place in the field of computer vision.
Among the families of filters mentioned above, the basic vector filters, the adaptive vector filters, and the hybrid vector filter are best suited for real-time implementation [17][18][19][37][38][39][40]. These filters are not greedy in terms of resources. This generally involves applying one or more simple heuristics and performing a noisy image scan by calculating a measurement for each pixel (a normalized sum of multiplications), making it possible to distinguish the very strong frequency variations. Methods based on VMF (Vector Median Filter) have always shown very good behavior in the case of low percentage impulsive noise. Methods based on AVMF (Adaptive Vector Median Filter), as well as HVF (Hybrid Vector Filter), are more complex to implement but far better in the case of high percentage impulsive noise [41]. Cited families (based on VMF, AVMF, or HVF) look, firstly, for corrupted pixels: we talk about noisy pixels identification. This step is very important and determines the quality of the image restoration. If some noisy pixels are not identified, they remain unchanged in the final result and disrupt the comprehension process. Otherwise, if non-noisy pixels are identified as being noise, they will be replaced, which negatively affects the quality of the restored image.
In this paper, we propose a new approach to refine the search and identification of noisy pixels. Considering a 5 × 5 window, our proposed MLVMF uses a modified Laplacian filter to observe the intensity variations around each pixel of the image with a rotation step of π/8 while the classic Laplacian filters often use rotation steps of π/2 or π/4 [42][43][44][45]. Reducing the angle of rotation around the pixel makes it possible to take advantage of additional information about its neighborhood. MLVMF does not stop at this stage. Identification of corrupted pixels can still fail against a high percentage of impulsive noise. Indeed, two or more noisy pixels having the same intensity (0 or 255) can be 4-connected or 8-connected. The local second derivative around this kind of pixel will not be able to detect strong variations. Once the noisy pixels are detected thanks to the new proposed filters, then eliminated by a simple VMF, a second round is initiated to search for the adjacent noisy pixels. We propose a second set of filters calculating, in eight directions, the intensity variations around each pixel of the image without taking into account the eight direct neighbors.
To validate our method, MLVMF is tested on standard images with a noise percentage varying from 3% to 30%. Obtained performances in terms of PSNR (Peak Signal to Noise Ratio) and NCD (Normalized Color Difference) are compared to the performances of VMF (Vector Median Filter) [1], VMRHF (Vector Median-Rational Hybrid Filter) [40], and MSMF (Modified Switching Median Filter) [46]. The results obtained show the effectiveness of the proposed approach.
The third and last contribution in this paper is the hardware implementation of the proposed nonlinear approach. Research has adopted hardware acceleration as a solution to reduce implementation complexity. In [47], using two hardware architectures, authors implement standard and multi-level median filters. According to [48], a novel 3 × 3 window median filtering algorithm is developed based on a bit-serial sorting algorithm with a high speed of operation and low hardware complexity. In [40], a hardware implementation of the VMRHF for color images is described. The relational function implementation is simplified using some approximations in this hardware architecture. To implement VMF efficiently, authors in [49] suggest a fast parallel architecture. VMF filter implementations in this architecture use approximation to implement L2 norms. However, these hardware architectures need more development time and lack the adaptability of design upgrading. In fact, Low-Level Synthesis (LLS) using Hardware Description Language (HDL) on an FPGA circuit is used to build and implement these systems. With LLS design, the Register Transfer Level (RTL) description can be modified to produce an excellent, efficient netlist. However, creating such an RTL description takes a lot of work and time, especially for complicated applications [50][51][52]. This is because each low-level circuit's activities must be described. Nevertheless, only hardware designers with specialized knowledge and abilities are capable of creating a sophisticated system. Therefore, in order to decrease the complexity of the FPGA design, it is imperative to go from Low-Level Synthesis (LLS) to High-Level Synthesis (HLS) [53][54][55]. The HLS tool synthesizes the formalized algorithms into a behavioral and structural RTL hardware description utilizing software high-level languages (systemC, C/C++, etc.). Thereby, several academic and commercial HLS tools are developed, such as Xilinx Vivado HLS, Intel OpenCL, Catapult-C, and ROCCC. Thus, our objective in this part is to use HLS flow to generate various hardware architectures for our proposed denoising algorithm. These architectures are designed in terms of FPGA cost and execution time. The best-designed architecture will be implemented and validated on the Xilinx Zynq FPGA.
This paper is organized as follows. In Section 2, we present the proposed denoising algorithm (MLVMF) by detailing its different stages as well as the filters used. To validate the proposed method, Section 3 shows the MLVMF results tested on standard images with a noise percentage varying from 3% to 30%. Obtained performances in terms of processing time, as well as image restoration quality through the PSNR and the NCD measurement, are compared to the performances of VMF, VMRHF, and MSMF. An additional test is performed on noisy chest x-ray images used in cardiovascular disease diagnosis as well as COVID-19 diagnosis. Finally, the HLS designs for the MLVMF are described in Section 4.

Modified Laplacian Vector Median Filter-MLVMF
A noisy pixel is always associated with a high frequency in its direct neighborship. Impulsive noise is no exception to this rule. To identify a noisy pixel, it is, therefore, necessary to calculate the variations in intensity locally. A double derivative around the pixel makes it possible to measure this variation: this is the Laplacian operator. Let I be an image of size n × m. Let (x,y) be the position of a pixel in the image I. The Laplacian L(x, y) of an image with pixel intensity values I(x, y) is given by: Since the input image is represented as a set of discrete pixels, we have to find a discrete convolution kernel that can approximate the second derivatives in the definition of the Laplacian. Two commonly used small kernels are shown in Figure 1. When searching for and identifying noisy pixels of the impulsive type, there is a tendency to widen the Laplacian filters. In general, these filters are of size 5 × 5 instead of 3 × 3. This is dictated by the concern to ensure that it is indeed an isolated pixel in terms of intensity. For these same reasons and contrary to the search for edges, the convolution is not conducted all at once but rather in several directions around the pixel.   When searching for and identifying noisy pixels of the impulsive type, there is a tendency to widen the Laplacian filters. In general, these filters are of size 5 × 5 instead of 3 × 3. This is dictated by the concern to ensure that it is indeed an isolated pixel in terms of intensity. For these same reasons and contrary to the search for edges, the convolution is not conducted all at once but rather in several directions around the pixel. Figure 2 shows the four commonly used kernels in the case of impulsive noise identification. When searching for and identifying noisy pixels of the impulsive type, there is a tendency to widen the Laplacian filters. In general, these filters are of size 5 × 5 instead of 3 × 3. This is dictated by the concern to ensure that it is indeed an isolated pixel in terms of intensity. For these same reasons and contrary to the search for edges, the convolution is not conducted all at once but rather in several directions around the pixel. Figure 2 shows the four commonly used kernels in the case of impulsive noise identification.  Figure 2, the rotation step of the Laplacian is equal to : kernel at 0, kernel at , kernel at , and kernel at . A smaller rotation step allows a deeper investigation of the neighborhood of a pixel. However, the rectangular aspect of the pixels and the small size of the search window show no more than four discernible directions. Increasing the size of the window will increase the calculation time. It is nevertheless possible to approximate new directions. We propose, in Figure 3, four new kernels in order to estimate the variations of intensity according to the directions , , , and . New kernels are: kernel at , kernel at , kernel at , and kernel at . Identification of corrupted pixels can still fail against a high percentage of impulsive noise. Indeed, two or more noisy pixels having the same intensity (0 or 255) can be 4-connected or 8-connected. The local second derivative around this kind of pixel will not  Figure 2, the rotation step of the Laplacian is equal to π 4 : kernel K 1 at 0, kernel K 2 at π 4 , kernel K 3 at π 2 , and kernel K 4 at 3π 4 . A smaller rotation step allows a deeper investigation of the neighborhood of a pixel. However, the rectangular aspect of the pixels and the small size of the search window show no more than four discernible directions. Increasing the size of the window will increase the calculation time. It is nevertheless possible to approximate new directions. We propose, in Figure 3, four new kernels in order to estimate the variations of intensity according to the directions π 8 , 3π 8 , 5π 8 , and 7π 8 . New kernels are: kernel K 5 at π 8 , kernel K 6 at 3π 8 , kernel K 7 at 5π 8 , and kernel K 8 at 7π 8 . When searching for and identifying noisy pixels of the impulsive type, there is a tendency to widen the Laplacian filters. In general, these filters are of size 5 × 5 instead of 3 × 3. This is dictated by the concern to ensure that it is indeed an isolated pixel in terms of intensity. For these same reasons and contrary to the search for edges, the convolution is not conducted all at once but rather in several directions around the pixel. Figure 2 shows the four commonly used kernels in the case of impulsive noise identification.  Figure 2, the rotation step of the Laplacian is equal to : kernel at 0, kernel at , kernel at , and kernel at . A smaller rotation step allows a deeper investigation of the neighborhood of a pixel. However, the rectangular aspect of the pixels and the small size of the search window show no more than four discernible directions. Increasing the size of the window will increase the calculation time. It is nevertheless possible to approximate new directions. We propose, in Figure 3, four new kernels in order to estimate the variations of intensity according to the directions , , , and . New kernels are: kernel at , kernel at , kernel at , and kernel at . Identification of corrupted pixels can still fail against a high percentage of impulsive noise. Indeed, two or more noisy pixels having the same intensity (0 or 255) can be 4-connected or 8-connected. The local second derivative around this kind of pixel will not Identification of corrupted pixels can still fail against a high percentage of impulsive noise. Indeed, two or more noisy pixels having the same intensity (0 or 255) can be 4connected or 8-connected. The local second derivative around this kind of pixel will not be able to detect strong variations. We propose a second set of filters calculating in eight directions the intensity variations around each pixel of the image without taking into account the eight direct neighbors. Figure 4 shows the proposed eight kernels: K 9 to K 16 .

As shown in
be able to detect strong variations. We propose a second set of filters calculating in eight directions the intensity variations around each pixel of the image without taking into account the eight direct neighbors. Figure 4 shows the proposed eight kernels: to . The calculation of the variation is carried out as follows. For each position ( , ) in the image , we compute the absolute value of the convolution product noted between the kernel and the image .
where varies from 1 to 3, such as is the image red component, is image green component, and is the image blue component. A first scan of the image is performed with filters to . For each image pixel, we, therefore, obtain 24 measurements of variation. To judge the importance of the intensity variation around a pixel ( , ), we observe the minimum value ( , ) among the 24 measurements obtained.
If ( , ) exceeds a predefined threshold then the pixel ( , ) is considered a candidate to be an impulsive noise. At this precise moment, we retrieve the color layer of the image giving this minimum measurement and declare the pixel as noise if its intensity at this layer is 0 or 255. To eliminate the noisy pixel, we use the VMF method [1]. The image obtained and noted is then scanned again. This scan is performed with filters to .
( , ) = ⨂ , = 9. .16, The calculation of the variation is carried out as follows. For each position (x, y) in the image I, we compute the absolute value of the convolution product noted V ij between the kernel K i and the image I j .
where j varies from 1 to 3, such as I 1 is the image red component, I 2 is image green component, and I 3 is the image blue component. A first scan of the image is performed with filters K 1 to K 8 . For each image pixel, we, therefore, obtain 24 measurements of variation. To judge the importance of the intensity variation around a pixel (x, y), we observe the minimum value M 1 (x, y) among the 24 measurements obtained.
If M 1 (x, y) exceeds a predefined threshold T then the pixel (x, y) is considered a candidate to be an impulsive noise. At this precise moment, we retrieve the color layer of the image giving this minimum measurement and declare the pixel as noise if its intensity at this layer is 0 or 255.
if I j ind (x, y) = 0 or 255 then pixel (x, y)is an impulsive noise To eliminate the noisy pixel, we use the VMF method [1]. The image obtained and noted I c is then scanned again. This scan is performed with filters K 9 to K 16 .
where j varies from 1 to 3, such as I c1 is the image red component of I c , I c2 is image green component of I c , and I c3 is the image blue component of I c . For each image pixel, we also obtain 24 measurements of variation. We observe the minimum value M 2 (x, y) among the 24 measurements obtained.
To declare a pixel as noise, we proceed in the same way as for the first scan using the same value of predefined threshold T. To eliminate the noisy pixel, we use the VMF method [1]. Figure 5 shows the MLVMF flowchart.
To declare a pixel as noise, we proceed in the same way as for the first scan using the same value of predefined threshold . To eliminate the noisy pixel, we use the VMF method [1]. Figure 5 shows the MLVMF flowchart.

MLVMF Performances
The proposed MLVMF filter is assessed in terms of image restoration quality and execution time to remove the impulsive "salt and pepper" in color images. We compare

MLVMF Performances
The proposed MLVMF filter is assessed in terms of image restoration quality and execution time to remove the impulsive "salt and pepper" in color images. We compare MLVMF performances to the performances of VMF, VMRHF, and MSMF filters. The metrics used in this comparative study are: The Peak Signal to Noise Ratio (PSNR) and the Normalized Color Difference (NCD). PSNR is defined by (6)- (8).
where l the index of the color channel of a color image (r = red, g = green, b = blue). I represents the original image. I c is the filtered image. n is the number of rows of an image and m the number of columns. Color distortion is estimated using the NCD, which is defined by (9).
where Y represents the original image luminance, Y c is the filtered image luminance, U and V are original image chrominance components, U c and V c are filtered image chrominance components. The proposed MLVMF is developed using C/C++ programming language, compiled by Visual C++ 2010 software tool. Execution is performed under Core™i7-1165g7@2.80ghz Intel processor. The processor timer is used to determine the execution time. We choose five test images (Figure 6), including two standard images (Lena and Peppers) and three chest x-ray images (CXR1, CXR2, and CXR3) [56]. All images used are 256 × 256 in size. Test images are corrupted by various levels of "salt and pepper" impulsive noise. These levels are 3%, 5%, 10%, 20%, and 30%. Based on several experimental tests, we set the threshold T at 75. Table 1 shows the values of quality measurements according to PSNR and NCD after the filtering process performed by VMF, VMRHF, MSMF, and proposed MLVMF filters. According to this table, we can notice that the MLVMF is more efficient than the other three filters. Compared to the MSMF, which has the best performance among the three filters in question in terms of PSNR, the MLVMF provides a high PSNR value of 5.5%. Compared to the VMF, which has the best performance among the same three filters in terms of NCD, the MLVMF provides a low NCD value of 18.2%. Moreover, subjective measurement confirms the efficiency of our proposed MLVMF. Figure 6 confirms that the filtered images (Lena, Peppers, CRX1, CRX2, and CRX3) obtained after MLVMF processing are too close to the original images, thanks to a better quality of restoration. Figure 7 shows the comparison of performances measured in terms of PSNR and NCD metrics using Lena, Peppers, CRX1, CRX2, and CRX3 images for various levels of impulsive noise (3%, 5%, 10%, 20%, and 30%). In addition to the fact that the MLVMF is clearly superior in the case of a low and medium noise percentage, the proposed filter is clearly distinguished from other filters when the noise is high. This mainly comes down to the investigation carried out by the filters K9 to K16 and which succeeded in identifying the adjacent corrupted pixels. The execution time of the proposed MLVMF under Core™i7-1165g7@2.80ghz Intel processor reaches 1483 ms per 256 × 256 color image. To decrease this execution time and allow real-time calculation, Section 4 describes a proposed High-Level Synthesis (HLS) design for the MLVMF filter.

High-Level Synthesis (HLS) Designs for the MLVMF Filter
The HLS flow used with FPGA is an important tool for engineers to quickly explore the design space from a given behavioral description based on a high-level programming language (e.g., SystemC, C/C++). Because of this, the HLS has become a useful and effective tool for boosting design productivity and decreasing design cycle time. Various HLS tools have been developed in this regard, such as the Xilinx Vivado HLS tool, which offers a number of directives to produce an optimum hardware design for any algorithm. In fact, the RESOURCE directive allows the arrays to be implemented as registers or

High-Level Synthesis (HLS) Designs for the MLVMF Filter
The HLS flow used with FPGA is an important tool for engineers to quickly explore the design space from a given behavioral description based on a high-level programming language (e.g., SystemC, C/C++). Because of this, the HLS has become a useful and effective tool for boosting design productivity and decreasing design cycle time. Various HLS tools have been developed in this regard, such as the Xilinx Vivado HLS tool, which offers a number of directives to produce an optimum hardware design for any algorithm. In fact, the RESOURCE directive allows the arrays to be implemented as registers or memories. Additionally, the ALLOCATION directive can be used to optimize how the arithmetic operation is implemented. Furthermore, using the PIPELINE and UNROLL directives, the loops can be pipelined, not unrolled, or fully/partially unrolled to increase the loop iterations' performance (i.e., to reach a higher throughput). Figure 8 shows the block diagram of the hardware architecture generated for the MLVMF filter. The generation process is performed by Xilinx Vivado HLS 18.1 tool from a specific C/C++ code. Our architecture uses 5 DMA (Direct Memory Access) to transfer five image lines in parallel in order to increase the throughput of our MLVMF filter. The hardware architecture of the proposed MLVMF is based on a 5 × 5 modified Laplacian filter and a 3 × 3 VMF filter. Each denoising RGB pixel (in 24 bit) is concatenated and stored in 256 × 256 × 24-bit internal memory. To optimize the architecture, some directives (such as PARTITION and PIPELINE) are incrementally introduced to the MLVMF C/C++ code. So, we produce various MLVMF hardware designs. We then retain the optimized design, which gives a compromise between hardware cost and processing time. The hardware requirements in terms of Lookup- Table (LUT), Flip-Flops (FF), BRAM blocks, and DSP blocks for the various MLVMF designs on the Zynq XCZU9EG FPGA are shown in Table 2. In Table 2, Solution 1 presents the hardware architecture without any optimization. It is clear that this solution is not greedy in terms of resources but requires a very large number of clock cycles to filter the entire image. With a clock frequency equal to 115 MHz, Solution 1 needs 1810 ms per 256 × 256 color image. In Solution 2, we propose to apply the PIPELINE directive. Hardware cost increases but is still well below the maximum capacities of the hardware. On the other hand, the number of clock cycles decreases by 97.5%. An image can, therefore, be processed in 46 ms. With the aim of further reducing the number of clock cycles, we add in Solution 3 the PARTITION directive, which allows splitting the filtering window ( Figure 8) into small blocks and promoting parallel access to data. Thank to Solution 3, we reach a computation time equal to 9 ms, i.e., 200 times faster than Solution 1. Hardware resources will be consumed more but remain well below hardware capacity. Finally, it should be noted that the quality of the filtering with Solution 2 and Solution 3 are the same obtained during the software implementation of Section 3.

Conclusions
In this work, a new Modified Laplacian Vector Median Filter (MLVMF) for real-time denoising complex images corrupted by "salt and pepper" impulsive noise is proposed. The aim is to provide a real-time architecture capable of restoring the chest x-ray images as well as possible. This will allow experts to better diagnose possible pathologies such as cardiovascular diseases, asthma, lung cancer, pneumonia, COVID-19, and tumors. We propose two sets of modified Laplacian filters to identify corrupted pixels. The first set investigates images using a smaller rotation step compared to existing methods. This allows better detection of corrupted pixels. The second set of proposed filters allows the detection of adjacent noisy pixels. These pixels go unnoticed in front of conventional filters, which leads to a bad reconstruction of the image when the percentage of impulsive noise is high. New High-Level Synthesis (HLS) Designs for the proposed MLVMF Filter are presented. The proposed MLVMF shows better performances compared to VMF, VMRHF, and MSMF filters in terms of PSNR and NCD measurements. In fact, The MLVMF provides a high PSNR value of 5.5% and a low NCD value of 18.2%. A proposed Hardware implementation based on High-Level Synthesis (HLS) designs of the MLVMF enabled real-time processing allowing an execution time equal to 9 ms per 256 × 256 color image.
Our method allows, as shown by the experimental results, a very good detection of impulsive noise. However, the work presented here does not deal with the operation of replacing the corrupted pixel. To eliminate a noisy pixel after having identified it, we use the VMF approach. We believe that a more intelligent estimation of the true color of the noisy pixel is possible. However, this estimate can be costly in terms of resources and computation time. Future work will focus on this point because a better estimate of the true color of a corrupted pixel, added to the very good identification presented in this work, can bring us closer to the ideal denoising.