Beating The Quality of JPEG 2000 With Anisotropic Diffusion: Abstract
Beating The Quality of JPEG 2000 With Anisotropic Diffusion: Abstract
Anisotropic Diffusion
1 Introduction
Image compression is becoming more and more important due to the increasing
amount and resolution of images. Lossless image compression algorithms can only
achieve mediocre compression rates compared to lossy compression algorithms,
though. Popular lossy image compression algorithms are JPEG [1], which uses
a discrete cosine transform, and its successor JPEG 2000 [2], which is based on
wavelets.
In the last decade the interpolation qualities of nonlinear partial differen-
tial equations (PDEs) have become evident by an axiomatic analysis [3] and by
applying them to inpainting problems [4, 5]. Extending inpainting to image com-
pression drives these ideas to the extreme: Only a small subset of pixels is stored,
and the remaining image regions are reconstructed by PDE-based interpolation.
This idea has been introduced by Galić et al. in 2005 [6] and extended later on in
[7]. These authors used edge-enhancing anisotropic diffusion (EED) [8] because
of it favourable performance as an interpolation operator. By encoding pixel
locations in a B-tree that results from an adaptive triangulation [9] and intro-
ducing a number of amendments, they ended up with a codec that outperforms
JPEG quality for medium to high compression ratios. However, they could not
reach the substantially higher quality of JPEG 2000.
The goal of our paper is to address this problem. We show that it is possible
to beat the quality of JPEG 2000 with edge-enhancing anisotropic diffusion,
2
provided that a number of carefully optimised concepts are combined that have
not been considered in [7]: First of all, we replace the adaptive triangulation by a
subdivision into rectangles. Afterwards we use an improved entropy encoding of
the interpolation data, a rescaling of the brightness map to the interval [0,255], an
optimisation of the contrast parameter within the diffusion processes of encoding
and decoding, and a swapping of the role of interpolation points and interpolation
domain in the decoding step. The resulting novel codec that uses EED within a
rectangular subdivision is called R-EED.
Our paper is organised as follows: In Section 2 we review the main ideas
behind diffusion-based image interpolation. Our R-EED codec is introduced in
detail in Section 3, and its performance is evaluated in Section 4. The paper is
concluded with a summary in Section 5.
Related Work. While there are numerous papers that apply nonlinear
PDEs and related variational techniques as pre- or postprocessing tools for im-
age and video coding, their embedding within the encoding or decoding step has
hardly been studied so far. Notable exceptions include work by Chan and Zhou
[10] where total variation regularisation is incorporated into wavelet shrinkage,
research on specific surface interpolation applications such as digital elevation
maps [11], and some recent embedding of inpainting ideas into standard codecs
such as JPEG [12].
As explained in the introduction, the basic idea behind the image compression
approach used in this article is to save the brightness values only at a subset
K ⊂ Ω of the whole image domain Ω ⊂ R2 . These values will be denoted by
the function G : K → R+ 0 . In order to reconstruct the image, we introduce an
artificial time parameter t. The reconstructed version R of the original image I
is given by the steady state R = inf u(x, t) of the evolution equation
t→∞
∂t u = Lu (1)
Lu = div(g(∇uσ ∇u⊤
σ )∇u), (2)
where λ is a contrast parameter. Note that EED is designed in such a way that
it smoothes along edges, but not across them. Thus, this diffusion process can
produce sharp edges.
To compare the performance of different compression algorithms, one con-
siders the compression ratio, i.e. the ratio between the file size before and after
compression, and some error measure that quantifies the reconstruction error be-
tween the initial image I and the reconstruction R. We choose the mean square
error (MSE)
1 X
MSE(I, R) := (R(x) − I(x))2 , (4)
|Ω|
Ω
since it shows the quality differences between the methods very well. Moreover,
there is a monotone mapping from the MSE to the popular peak signal to noise
ratio (PSNR).
Depth 0
Depth 1
Depth 2
Fig. 1. Left: Illustration of the adaptive grid used for the proposed recursive compres-
sion routine. The white area is the area being reconstructed in the corresponding step.
Right: Example point mask used for compressing the image “trui” with the proposed
compression algorithm and a compression ratio close to 60 : 1.
Table 1. The effect of entropy coding for the image “walter”, shown in Figure 3,
using different splitting thresholds in the subdivision process. Shown are the size of the
compressed pixel data in bytes without entropy coding (none), with Huffman coding
(HC), with Huffman coding using canonical codes (HCc), with arithmetic coding with
static (ACs) or adaptive (ACa) model, Lempel-Ziv-Welch coding (LZW), range coding
(RC), gzip (version 1.3.5), bzip2 (version 1.0.3), and PAQ. The best result for each
ratio is highlighted.
adaptive grid structure indicated in the left image in Figure 1. This is done by
storing the maximal and minimal recursion depth reached in the compression
algorithm, as well as one additional bit for each subimage between these two
depths. These bits indicate whether the corresponding subimages has been split
in the compression step.
To further decrease the file size, the pixel values saved are quantised and coded
using a general purpose entropy coder. For the proposed codec, we tested several
compression algorithms ranging from Huffman coding [14] over arithmetic coding
[15] (with static or adaptive model), Lempel-Ziv-Welch coding [16] to standard
tools like gzip (version 1.3.5) and bzip2 (version 1.0.3). Most of the time, PAQ
[17] yielded the best results. In our implementation, we used a slightly modified
version of paq8o8z-feb28. If very few pixels have to be compressed, a simple
arithmetic coding with an adaptive model works best, though. Except for gzip
5
and bzip2, which are standard tools, and PAQ, the source code of which is
available at [18], we used the implementations from [19] in this paper.
The performances of different entropy coders are compared in Table 1 and
in Section 4.
Some images do not use the whole range of possible grey values. For example,
the pixels in the image “trui”, which is shown in Figure 2, have a brightness
between 56 and 241. Thus, it can make sense to map the brightness of the
image such that the complete range is used. This can improve the reconstruction
because quantisation has less effects in this way. Note that quantisation does not
only occur when quantising the grey values in the encoding step, but also when
mapping the real numbers obtained by diffusion to integer values in the decoding.
To illustrate the improvement of this step, we compressed the image “walter”
(see Figure 3) once with the method explained in the last section and once with
the same method using brightness adjustment. With brightness adjustment, the
MSE for a compression rate of approximately 45 : 1 dropped from 50.64 to 46.33.
In the explanation of EED in the last section, we did not state how to choose
λ for the diffusivity in Equation (3). While the same λ was used for all images
in [7], we found out that the best parameter is dependent on the image and the
compression ratio. Thus, we save the λ parameter that should be used in the
reconstruction. We assume this parameter is between 0 and 1, quantise it to 256
different values and use a single byte to store it.
Furthermore, we noticed that a different λ parameter should be used in the
compression and decompression steps. This is advantageous due to two reasons:
Firstly, the subimages reconstructed in the compression step necessary to gen-
erate the grid structure are not equal to the corresponding subimages in the
reconstructed image since the influence of surrounding parts of the image are
neglected. Secondly, the compression algorithm raises or lowers the saved bright-
ness of each saved point if that improves the reconstruction error, similar to the
approach proposed in [7]. During these point optimisations, the optimal λ for
the reconstruction may change. Thus, searching an optimal λ and performing
the point optimisations is interleaved. That is, after the optimal λ is found, each
saved point is optimised once, and these two steps are repeated until convergence.
When using an optimised λ in the compression step, the MSE of our test im-
age “walter” improves from 46.33 to 38.91. After using the optimised parameter
for the decompression, we get an error of 38.38. Using one point optimisation
step, the error drops to 24.67, and finally to 21.38 after multiple optimisations.
6
4 Experiments
In this section, we show compression results of the proposed algorithm for differ-
ent compression rates and compare the results against JPEG, JPEG 2000, and
the approach from Galić et al. [7]. For all experiments, we set σ to 0.8.
The first image for which results are presented is the image “trui”. This image
is a standard test image often used in image processing. In order to compare
our algorithm against the one proposed in [7], we scaled the image to 257 × 257,
since that resolution was used there. Figure 2 shows the result using the different
compression methods. The images for JPEG and JPEG 2000 have been created
with “convert” (version ImageMagick 6.2.4 02/10/07). Note that convert uses
optimised entropy coding parameters when saving JPEG files. Since this was
not the case for the JPEG images shown in [7], those images are worse than the
JPEG images shown here.
7
300
MSE
JPEG
200
100 JPEG 2000
0
R−EED
20 : 1 40 : 1 60 : 1 80 : 1 Ratio
42.2:1, MSE: 71.16 44.3:1, MSE: 50.89 43.4:1, MSE: 45.99 44.1:1, MSE: 31.00
54.5:1, MSE: 111.01 57.5:1, MSE: 75.81 57.2:1, MSE: 70.79 57.6:1, MSE: 42.77
Fig. 2. Comparison of the image quality when saving the image “trui”, scaled to 257 ×
257 with different compression algorithms. Top row: Input image, and plots showing
the MSEs for different compression ratios. Middle row: Images obtained with JPEG,
the method by Galić et al. [7], JPEG 2000 and with the proposed method (R-EED)
with a compression rate close to 43 : 1. Bottom row: Results with compression rate
close to 57 : 1. The images showing the compression result of [7] are courtesy of Irena
Galić.
Table 2. Compression results for JPEG, JPEG 2000, and for the proposed algorithm
(R-EED) for the images “trui”, “walter”, and a subimage of “peppers”. The best results
are highlighted.
image “peppers”. For both images, the proposed compression algorithm beats
JPEG 2000 for high compression rates, and achieves a similar performance for
medium compression rates, as is demonstrated in Figure 3 and Table 2.
The graphs in Figure 3 also show results of the proposed algorithm when only
Huffman coding is used. As can be seen, even with this simple entropy coder,
we still achieve a better quality than JPEG 2000 for high compression ratios.
Note that the graphs in the figures show the complete compression range for
JPEG and JPEG 2000, i.e. with quality settings from 100 to 1. However, only a
small subinterval of the results obtainable with the proposed algorithm is shown.
Results in which the image “trui” was compressed with compression ratios up
to 186.77 : 1 are shown in Figure 4. Higher compression ratios are also possible.
5 Conclusions
We have presented an image compression method that performs edge-enhancing
anisotropic diffusion inpainting on an adaptive rectangular grid. By using an im-
proved entropy coding step, brightness rescaling, an optimised diffusion param-
eter in the compression as well as in the decompression step, and interpolation
swapping, the proposed algorithm can yield results that clearly surpass those of
related previous work [7] as well as of JPEG and even the sophisticated JPEG
2000 standard.
Our ongoing work includes research on parallelisation strategies for multicore
architectures, optimal handling of highly textured regions, as well as extensions
to colour images and videos.
Acknowledgement. We thank Irena Galić for fruitful discussions and for pro-
viding two images in Figure 2.
References
1. Pennebaker, W.B., Mitchell, J.L.: JPEG: Still Image Data Compression Standard.
Springer, New York (1992)
2. Taubman, D., Marcellin, M.: JPEG2000: Image Compression Fundamentals, Prac-
tice and Standards. Kluwer Academic Publishers (2002)
3. Caselles, V., Morel, J.M., Sbert, C.: An axiomatic approach to image interpolation.
IEEE Transactions on Image Processing 7(3) (March 1998) 376–386
9
Walter Peppers
250
250 250
250
MSE
MSE
200
200 JPEG 200
200 JPEG
150
150 150
150 JPEG 2000
JPEG 2000
100
100 100
100 R−EED−HC
R−EED−HC
50
50 50
50 R−EED
R−EED
00 00
0 20:1
20 40:1
40 60:1
60 80:1
80 100 0 20:1
20 40:1
40 60:1
60 80:1
80 100
Fig. 3. Compression results with the images “walter” (with resolution 256 × 256) and
a 257 × 257 subimage of the image “peppers”. Shown are, from left to right, the initial
image, and results obtained with our approach for compression rates of approximately
44 : 1, 66 : 1, and 89 : 1. The graphs show the performance of the proposed algorithm
with the best entropy coder (R-EED) or with Huffman coding (R-EED-HC), and of
JPEG and JPEG 2000 for various compression rates of these images.
Fig. 4. Experiments with different compression ratios for the image “trui”, scaled to
257×257. From left to right: Compression ratio of 86.43 : 1, 135.76 : 1, and 186.77 : 1.
10
4. Masnou, S., Morel, J.M.: Level lines based disocclusion. In: Proc. 1998 IEEE
International Conference on Image Processing. Volume 3., Chicago, IL (October
1998) 259–263
5. Bertalmı́o, M., Sapiro, G., Caselles, V., Ballester, C.: Image inpainting. In: Proc.
SIGGRAPH 2000, New Orleans, LI (July 2000) 417–424
6. Galić, I., Weickert, J., Welk, M., Bruhn, A., Belyaev, A., Seidel, H.P.: Towards
PDE-based image compression. In Paragios, N., Faugeras, O., Chan, T., Schnörr,
C., eds.: Variational, Geometric and Level-Set Methods in Computer Vision. Vol-
ume 3752 of Lecture Notes in Computer Science. Springer, Berlin (2005) 37–48
7. Galić, I., Weickert, J., Welk, M., Bruhn, A., Belyaev, A., Seidel, H.P.: Image
compression with anisotropic diffusion. Journal of Mathematical Imaging and
Vision 31(2–3) (July 2008) 255–269
8. Weickert, J.: Theoretical foundations of anisotropic diffusion in image processing.
Computing Supplement 11 (1996) 221–236
9. Distasi, R., Nappi, M., Vitulano, S.: Image compression by B-tree triangular cod-
ing. IEEE Transactions on Communications 45(9) (September 1997) 1095–1100
10. Chan, T.F., Zhou, H.M.: Total variation improved wavelet thresholding in image
compression. In: Proc. Seventh International Conference on Image Processing.
Volume II., Vancouver, Canada (September 2000) 391–394
11. Solé, A., Caselles, V., Sapiro, G., Arandiga, F.: Morse description and geometric
encoding of digital elevation maps. IEEE Transactions on Image Processing 13(9)
(September 2004) 1245–1262
12. Liu, D., Sun, X., Wu, F., Li, S., Zhang, Y.Q.: Image compression with edge-based
inpainting. IEEE Transactions on Circuits, Systems and Video Technology 17(10)
(October 2007) 1273–1286
13. Charbonnier, P., Blanc-Féraud, L., Aubert, G., Barlaud, M.: Deterministic edge-
preserving regularization in computed imaging. IEEE Transactions on Image Pro-
cessing 6(2) (1997) 298–311
14. Huffman, D.A.: A method for the construction of minimum redundancy codes.
Proceedings of the IRE 40 (1952) 1098–1101
15. Rissanen, J.J.: Generalized Kraft inequality and arithmetic coding. IBM Journal
of Research and Development 20(3) (1976) 198–203
16. Welch, T.A.: A technique for high-performance data compression. Computer 17(6)
(1984) 8–19
17. Mahoney, M.: Adaptive weighing of context models for lossless data compression.
Technical Report CS-2005-16, Florida Institute of Technology, Melbourne, Florida
(December 2005)
18. Mahoney, M.: Data compression programs. http://www.cs.fit.edu/
∼mmahoney/compression/ . Last visited March 01, 2009.
19. Dipperstein, M.: Michael dipperstein’s page o’stuff, homepage. Available from
http://michael.dipperstein.com/index.html . Last visited January 22, 2009.
20. Bae, E., Weickert, J.: Partial differential equations for interpolation and com-
pression of surfaces. In: Proc. Seventh International Conference on Mathematical
Methods for Curves and Surfaces. Lecture Notes in Computer Science, Berlin,
Springer (2008) To appear.
21. Signal and Image Processing Institute of the University of Southern California: The
USC-SIPI image database. http://sipi.usc.edu/database/index.html. Last visited
March 01, 2009.