Improving the JPEG-LS compression of images with locally sparse histograms Ant´ onio J. R. Neves Armando J. Pinho Dept. of Electronics and Telecommunications / IEETA University of Aveiro, 3810–193 Aveiro, Portugal Abstract – In this paper, we propose a preprocessing tech- nique that is capable of improving the compression of images that have locally sparse intensity histograms. In this case, (global) off-line histogram packing may be unsuitable. How- ever, by reducing the size of the symbol-set used by the packing procedure, we are able to attain globally better results, being some of them quite dramatic. I. I NTRODUCTION Off-line histogram packing is a known method capable of producing improvements if applied prior to the lossless compression of images having sparse histograms. Basi- cally, off-line histogram packing relies on the construction of an one-to-one order-preserving mapping from the image intensity values into a contiguous subset of the integers. For constructing this mapping we need to know, a priori, which intensity values are present in the image. If that is unknown, which is the most often case, then we need to perform a pass through the image in order to find out those intensity values. In the latter case, the complete encoding process, i.e., histogram packing and lossless image coding, cannot be performed on-line. On-line strategies have been recently proposed, some of them designed specifically for a particular encoding algorithm [1, 2], some others designed to act as a preprocessing stage detached from the particular encoding algorithm that is used [3]. Generally, the off-line histogram packing method is very effective in images characterized by having sparse his- tograms. This can be verified in the examples given in Table I, where compression ratios obtained before and af- ter off-line histogram packing are presented. As can be observed, the compression improvement after off-line his- togram packing is very significant for images having sparse histograms, i.e., the images in the first group and some of the images in the third group. However, generally, image data are not stationary. There- fore, a global histogram may not express correctly how in- tensities are used in different parts of the image. In the remainder of this paper we present an approach that aims at exploring non-stationary characteristics of the intensity histogram. II. THE PACKING ALGORITHM Let us denote by the set of all different intensity values used by a given image, and by some predefined This work was supported in part by the Fundac ¸˜ ao para a Ciˆ encia e a Tecnologia (FCT). Corresponding author: Armando J. Pinho, E-mail: ap@det.ua.pt, URL: www.ieeta.pt/˜ap. value. During the processing of sample , 1 which gener- ates a transformed sample at time instant , we assume that a previously constructed subset of , , is available: Moreover, we assume without loss of generality that , and that the following one-to-one, order- preserving mapping in is also available: Sample is processed as follows. If , then . However, if , then , which is the first element of that does not belong to . In this case, the intensity value is stored into a file, which is used for later recovery of the original image intensity values. We call this file the “recovery file”. The occurrence of an intensity not belonging to also implies the rearrangement of the mapping, which depends on whether or not. If , and assuming that , then the new mapping is: As can be seen, is inserted in the mapping in such a way that the one-to-one, order-preserving property is main- tained. On the other hand, if , in addition to the inclusion of in the mapping, as described above, it is also required the deletion of one of the members of (i.e., the cardinality of the set is kept equal to ). Also in this case, the mapping has to be rearranged in order to obey to the one-to-one, order-preserving property. Decoding is performed using a similar strategy as encod- ing. When decoding sample , if , then . 2 Otherwise, an intensity value, , is fetched from the recovery file and . The mapping is al- ways reorganized following the same procedures as those performed by the encoder. III. EXPERIMENTAL RESULTS AND CONCLUSIONS Table I presents compression results using the most re- cent ISO/IEC standard and ITU recommendation for the lossless compression of continuous-tone images: JPEG- LS [4, 5] (we used the implementation provided by the Sig- nal Processing & Multimedia Group at the University of 1 We assume that the image samples have been transformed into a sample sequence, , using some image scanning strategy. In this work we used a raster-scanning approach. 2 Notation indicates a mapping that is the inverse of . Proceedings of 12th Portuguese Conference on Pattern Recognition, RecPad 2002, Aveiro