## 3 The Lossless Image Compressor
### Simulation Results  
As the proposed compression algorithm is lossless, the reconstructed image is identical to the original image. In Figure 7, several original and reconstructed images are shown with compression ratio (CR) mentioned. The average CR of a number of WLI endoscopic images and video frames are shown in Table 4.  
From Table 4, it is found that the proposed lossless compression algorithm produces approximately 78% average compression ratio (CR) for different types of images. The CR of NBI images are also shown in Table 5. In this case, the algorithm produces an average CR of 84%. \begin{table}
\begin{tabular}{c c c c} \hline
**Mode** & _dY_ & _dE_ & _dF_ \\ \hline \multirow{2}{*}{WLI} & 2 & 0 & 0 \\  & (Golomb-Rice) & (unary) & (unary) \\ \hline \multirow{2}{*}{NBI} & 3 & \multirow{2}{*}{Not sampled} \\  & (Golomb-Rice) & & \\ \hline \end{tabular}
\end{table} 
Table 3: \(K\) parameter for encoding component differences. Figure 7: Original and reconstructed images; they are identical since the algorithm is lossless in nature; optional corner clipping is used. It is noted that in our implementation (also in Tables 4 and 5), we have used integer precision with 8-bits. As mentioned before for Equations (2)-(4), the integer division in the RGB-YEF conversion discards the fraction bits. It may generate very small variations in pixel values at the output stream which is visually unnoticeable to human eyes when displayed as an image. However, in order to generate theoretically reversible compressed bit stream, one may add additional bits to preserve the fractions. The average CR for different number precision bits for both WLI and NBI video sequences are shown in Table 6. \begin{table}
\begin{tabular}{l l c c} \hline \hline \multicolumn{1}{c}{**Image Description**} & \multicolumn{2}{c}{**Number of**} & \multicolumn{1}{c}{**Avg. CR \%**} \\  & \multicolumn{1}{c}{**Images/Frames**} & \multicolumn{1}{c}{**Avg. CR \%**} \\ \hline Images from Larynx to Anus of GI tract & 100 & 74.7 \\ \hline  & Video -1 & 99 & 80.6 \\  & Video -2 & 97 & 80.5 \\ Capsule endoscopy & Video -3 & 97 & 80.1 \\ video frames & Video -4 & 97 & 80.6 \\  & Video -5 & 97 & 79.9 \\ \hline  & Ulcer & 10 & 76.7 \\ Images containing & Polyp & 10 & 76.0 \\ disease condition & [PERSON] disease & 10 & 73.5 \\  & Cancer & 10 & 73.8 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Compression ratio of the proposed algorithm for WLI images. Figure 7: _Cont._  
In Table 7, the proposed compressor is compared with other related compression algorithms. Here, we see that the proposed compressor outperforms in CR and in image quality when compared with [14, 24]. The works in [8, 9, 10, 12, 13, 15] are lossy compressors; these algorithms produces distortions in the reconstructed images which may lead to inaccurate diagnostics. Moreover, the algorithms presented in these works are based on DCT which has computational complexity of O( \(n\) log \(n\) ) and need buffer memory (as described earlier). The work in [20] produces lossless reconstructed images, however, the proposed compressor has better compression ratio. We have also implemented the JPEG-LS [21] algorithm and applied it to our dataset. When comparing with JPEG-LS, the proposed algorithm has higher compression ratio, lower computational complexity (such as static prediction and static \(k\) parameter) and lower memory requirement. The proposed compressor works on a low complexity YEF color space and it has a computational complexity of O( \(n\) ) with no buffer memory requirements for image storage. Besides, the works of [20, 21] do not support NBI imaging mode. In order to compare the proposed YEF color space for endoscopic images with the conventional YCoCg color space, we have conducted additional simulations by replacing the YEF color space by YCoCg in the proposed compression algorithm. Our experiments show that YCoCg color space produces a CR of 71.2% where YEF produces a higher CR (74.7%) for the same data set.