key: cord-0595571-jyhtbqiv authors: Peter, Pascal title: Quantisation Scale-Spaces date: 2021-03-18 journal: nan DOI: nan sha: 849f8c0c2ac23dfd7787c5ec8f098cd564f4c9c9 doc_id: 595571 cord_uid: jyhtbqiv Recently, sparsification scale-spaces have been obtained as a sequence of inpainted images by gradually removing known image data. Thus, these scale-spaces rely on spatial sparsity. In the present paper, we show that sparsification of the co-domain, the set of admissible grey values, also constitutes scale-spaces with induced hierarchical quantisation techniques. These quantisation scale-spaces are closely tied to information theoretical measures for coding cost, and therefore particularly interesting for inpainting-based compression. Based on this observation, we propose a sparsification algorithm for the grey-value domain that outperforms uniform quantisation as well as classical clustering approaches. Image inpainting [11] reconstructs an image from a mask that specifies known pixel data at a subset of all image coordinates. Cárdenas et al. [3] have shown that a wide variety of inpainting operators can create scale-spaces: Sequentially removing points from the mask yields inpainting results that form a scale-space with the mask density as a discrete scale dimension. The order in which the data is removed, the sparsification path, can impact the reconstruction quality significantly. Implicitly, many inpainting-based compression approaches (e.g. [6, 13, 16] ) and associated mask optimisation strategies (e.g. [1, 4, 10] ) rely on these sparsification scale-spaces: They choose sparse masks as a compact representation of the image and aim for an accurate reconstruction from this known data. However, there is another aspect of compression, that has hitherto not been explored from a scale-space perspective: The known data has to be stored, which means the information content of the grey or colour values plays an important role. In particular, all contemporary compression codecs use some form of quantisation combined with variants of entropy coding, no matter if they rely on transforms [12, 19] , inpainting [6, 13, 16] , or neural networks [14] . Quantisation reduces the amount of different admissible values in the co-domain to lower the Shannon entropy [18] , the measure for information content. Sparsification scale-spaces have demonstrated that there are viable scalespace concepts beyond the classical ideas that rely on partial differential equations (PDEs) [2, 8, 15, 21] or evolutions according to pseudodifferential operators [5, 17] . In the present paper, we show that quantisation methods can also imply scale-spaces and that this leads to practical consequences for inpainting-based compression. In this application context, quantisation has so far only been the main focus in the work of Hoeltgen et al. [7] who compared multiple different strategies. However, they did not consider scale-space ideas and concluded that non-uniform quantisation does not offer advantages over uniform ones in inpainting-based compression. Our contributions. Our first results are of theoretical nature: We propose quantisation scale-spaces based on the broad class of hierarchical quantisation methods inspired by Ward clustering [20] : The image is gradually simplified by merging level sets. Not only do these sequences of quantised images satisfy all essential scale space-properties, we also show that our Lyapunov criterion guarantees a decrease of the coding cost. This observation motivates our practical contributions: We demonstrate that committed (i.e. structure-adaptive) quantisation scale-spaces are particularly useful. They allow the design of flexible, task-specific quantisation approaches. As a concrete application we use the natural ties of quantisation scale-spaces to information theory for improved inpainting-based compression. Organisation. In Section 2, we propose quantisation scale-spaces and their properties, compare them to sparsification scale-spaces in Section 3, and discuss practical applications in Section 4. Section 5 concludes with a final discussion. While there is a plethora of quantisation approaches designed for specific purposes, not all of them correspond to scale-spaces. Thus, we first define a suitable class of quantisation methods without imposing too many restrictions on their design. To this end, we use a very general hierarchical clustering idea inspired by the classical algorithm of Ward [20] . Intuitively, these approaches reduce the quantisation levels by mapping exactly two of the fine grey values to the same coarse quantisation value. In the following we consider only 1-D vectors, but these represent images of arbitrary dimension with N pixels (e.g. a row by row representation in 2-D). Consider a quantised image f ∈ {v 1 , ..., v Q } N with N pixels and Q quantisation levels v 1 < v 2 < · · · < v Q . A function q : V := {v 1 , ..., v Q } →V := {v 1 , ...,v Q−1 } mapping to coarse quantisation levelsV with v 1 ≤v 1 0, p j > 0, and log 2 is monotonically increasing, hence Thus, we have shown that each step in a quantisation scale-space does not increase information content and, if no level sets are empty, it even strictly decreases the entropy. A quantisation according to Definition 1 is a point operation, i.e. it acts independently of the spatial configuration of image pixels. Thus, it is invariant under any permutation of the image pixels. Moreover, it is invariant under any brightness rescaling operations that keep the histogram, and thus the level sets, intact. Property 6 (Convergence to a Flat Steady-State) According to Definition 2, the final image f Q−1 contains Q − (Q − 1) = 1 grey value and is thus flat. Now that the important properties of quantisation scale-spaces have been verified, we briefly compare them to their spatial relatives, the sparsification scale-spaces [3] . Then, in Section 4, we also consider practical applications for this novel type of scale-space. Sparsification scale-spaces [3] rely on a series of nested inpainting masks that specify known data for an image with domain Ω with |Ω| = N . They start with a full mask K 0 = Ω and successively reduce K to K +1 by removing exactly one pixel coordinate from this set. From each of these sets, an image u can be inpainted by solving Here, C ∈ R N ×N is a diagonal matrix that corresponds to the known data set K , and A ∈ R N ×N implements an inpainting operator including boundary conditions. While there are many viable choices for A, we only consider homogeneous diffusion inpainting [8] here, where A corresponds to a finite difference discretisation of the Laplacian with reflecting boundary conditions. For more details on sparsification scale-spaces we refer to Cárdenas et al. [3] . Both sparsification and quantisation scale-spaces have a discrete scale parameter. The corresponding amount of steps is determined by the image resolution in the spatial setting and by the grey value range in the quantisation setting. Additionally, sparsification scale-spaces do not have an ill-posed direction: For a known order of pixel removals, one can easily go from coarse scales to fine scales. Due to the many-to-one mapping by merging level sets, this is not the case for quantisation scale-spaces. In compression applications, this is no issue, since the original image is available. However, one cannot go to finer quantisations, i.e. from an 8-bit to a high dynamic range image. Interestingly, we can combine sparsification and quantisation scale-spaces. For an image f ∈ V N with |V | = Q, consider the sparsification path given by Here, we used probabilistic sparsification [3, 10] for the spatial domain and our quantisation by sparsification for the grey level domain. Interestingly, for very low quantisation levels q, results might be visually more pleasant for lower mask densities, compare e.g. 8 % to 64 % at 4 grey levels. This impression results from the smooth interpolation by diffusion, that avoids unpleasant discontinuities and simultaneously expands the number of grey levels in the reconstructed image beyond those of the mask. quantisation values. The reconstruction u ,m now depends on the respective scale parameters of the sparsification and m of the quantisation scale-space. This does not affect our theoretical results, since none of the properties relies on the spatial configuration of the image pixels. If an inpainting operator fulfils the maximum-minimum principle, this carries over to the inpainted image, and thereby also the total contrast of the known data. We can thus even extend Properties 3 and 4 to the reconstructions u ,m . An investigation of both scale dimensions in Fig. 1 yields surprising results: A lower amount of known data at the same quantisation scale can yield visually more pleasing results (e.g. q = 4 and 64 % vs. 8 % mask density). This results from the fact that smooth inpainting can fill in additional grey levels, hence the inpainted areas are less coarsely quantised than the known data. Finally, both types of scale-spaces can be committed to the image, i.e. adapted to the image structure. In the following section, we show that this allows the design of highly task-specific quantisation approaches. The results of practical experiments depend significantly on the order in which known data are removed and level sets are merged. For the spatial scale-space, we use an adaptive sparsification path obtained with the algorithm from [3] . First, we propose several committed and uncommitted quantisations. We show some exemplary results on the test image trui that has been also used in [3] . Uncommitted Uniform Quantisation: Hierarchical uniform quantisation can be seen as a pyramidal approach. On a level with a := 2 k level sets, we have b := 2 k−1 pairs of neighbouring level sets. We progress to b grey values by merging L 2i−1 and L 2i for i = 1, ..., b in b steps. A bin containing the minimum grey value v min and maximum value v max is associated to the new value v min + 1 2 (v max − v min ). We round the intermediate results to the next integer. Committed Ward Clustering: While the method of Ward [20] describes a general clustering approach, not a quantisation technique, it can be used easily as such by choosing the mean squared error (MSE) on the quantised data as an optimality criterion. It simply merges two level sets that minimise this criterion. Committed Quantisation by Sparsification: Inspired by the spatial sparsification for adaptive scale-spaces [1, 3] , we successively remove the one grey level that has the lowest impact on the global inpainting error. This merging strategy can equivalently be interpreted as an inpainting-based merging criterion for Ward clustering that is designed for cases where parts of the image are unknown. If all pixels are known this corresponds to regular Ward clustering. For both committed quantisations, we assign the value of the corresponding coarse level set with the largest histogram occurrence to the newly merged set. Experiments on the test image trui with 8% known data in Fig. 3 (a) verify that the entropy monotonically decreases with increasing scale for all three approaches. However, this is quite irregular for uniform quantisation, since it does not respect the actual distribution of grey levels in the image. The non-uniform methods do not yield any changes until they reach 186 grey levels, since this is the number actually occurring in the image. Sparsification leads to a slightly quicker descent in entropy, but for coarse scales, all methods yield similar results. The quantisation error in Fig. 3(b) shows Ward clustering as a clear winner: Unsurprisingly, it yields much better results than uniform quantisation due to its adaptivity. Interestingly, sparsification exhibits the worst results for medium quantisation levels. The next section reveals that this is the intended result of its merging criterion and not a design flaw. The combination of sparsification and quantisation scale-spaces from Section 3 describes the natural rate-distortion optimisation problem in image compression: We want to find the optimal scale parameters˜ andm such that for a given storage budget t, the MSE is minimised. If B(K , g l,m ) denotes the coding cost of the known data, image compression can now be seen as a minimisation problem with Euclidean norm · and cost threshold t. Here, we consider the entropy H(g l,m ) of the known grey values for the budget B. We can neglect the coding cost of the known data positions since they are identical for all our quantisation methods. However, we still need to consider overhead. For uniform quantisation, this is only the number of grey levels (8 bit). Non-uniform methods also need to store the values in V m , which comes down to −q log 2 (q) for q = 256 − m grey levels. Fig. 4(a) shows that the overhead of non-uniform quantisation can easily exceed uniform overhead by a factor 190. Consequentially, this is a game changer: In Fig. 4 (b) Ward clustering is consistently worse for actual compression than a uniform quantisation. These findings are consistent with those of Hoeltgen et al. [7] who also tested non-scale-space quantisations such as k-means clustering [9] . We did not consider those here since they do not offer better results. However, our quantisation by sparsification does not only beat Ward clustering by more than 20%, but also uniform quantisation by more than 10%. This is a direct result of the correct error measure for compression during the choice of the quantisation path. Minimising the MSE on the inpainted image is the true goal of this application, while Ward clustering only ensures accurate known values. Thus, committed quantisation scale-spaces can be useful to adapt to different applications. We have established quantisation scale-spaces as the co-domain counterpart of spatial sparsification scale-spaces: They act on the grey value domain instead of the pixel domain. Both of these approaches successively sparsify their corresponding discrete domains and we can even combine them in a meaningful way for concrete applications in compression. However, there are also notable differences: In contrast to spatial sparsification, the Lyapunov criterion for quantisation scale-spaces simplifies the known data set in terms of its Shannon entropy, thus yielding a guaranteed reduction of the coding cost. From the viewpoint of inpainting-based image compression, we can now interpret rate-distortion optimisation as the selection of suitable scale parameters in both scale-spaces. In future research, we are going to consider quantisation scale-spaces on colour spaces and further investigate their impact on compression in a more practical setting, including a larger scale evaluation. Scale Space and Variational Methods in Computer Vision Axioms and fundamental equations in image processing Scale Space and Variational Methods in Computer Vision A bi-level view of inpainting-based image compression On the axioms of scale space theory Image compression with anisotropic diffusion Clustering-based quantisation for PDE-based image compression. Signal Basic theory on normalization of pattern (in case of typical onedimensional pattern) Least squares quantization in PCM Optimising spatial and tonal data for homogeneous diffusion inpainting Level lines based disocclusion JPEG: Still Image Data Compression Standard Fast inpainting-based compression: Combining Shepard interpolation with joint inpainting and prediction Real-time adaptive image compression Relations between regularization and diffusion filtering Understanding, optimising, and extending data compression with anisotropic diffusion Morphological counterparts of linear shift-invariant scale-spaces A mathematical theory of communication -Part 1 JPEG 2000: Image Compression Fundamentals, Standards and Practice Hierarchical grouping to optimize an objective function Anisotropic Diffusion in Image Processing