APPLICATIONS OF ANTIALIASING IN AN IMAGE PROCESSING FRAMEWORK SETTING Øyvind Ryan

advertisement

APPLICATIONS OF ANTIALIASING IN AN IMAGE PROCESSING FRAMEWORK

SETTING

Øyvind Ryan

Department of Informatics, Group for Digital Signal Processing and Image Analysis,

University of Oslo, P.O Box 1080 Blindern, NO-0316 Oslo, Norway

Email: oyvindry@ifi.uio.no

ABSTRACT

Compression of certain low bit-depth images are studied for the most common image formats. The images studied consist of both vector and raster content, and are processed with an image processing framework supporting antialiasing. It is studied how antialiasing can be applied with the most common image formats, in particular JPEG2000, and how image format specific parameters can affect compression rates for our images.

1. INTRODUCTION

Display devices have limited resolution. Drawing primitives applied in limited resolution settings may produce aliasing artifacts . Techniques for reducing aliasing are often applied in computer graphics. Application of such techniques is referred to as antialiasing .

Jagged edges may appear for lines drawn on computer displays unless some care is taken in the rendering process.

A common approach is to divide the pixel grid into a finer grid of subpixels , and count the number of subpixels inside the line. Colour intensities are then adjusted according to the amount of area covered by the subpixels. Intensities are typically quantized to a number of levels, and colours are assigned to each level [5]. Images presented in this paper use 4 levels. It is recommended to increase the number of levels if smoother edge transitions are desired. This is costly in terms of execution speed, as it implies realizing a finer granularity subpixel grid.

Many implementations of antialiasing exist, both in software and hardware. Hardware implementations are motivated by needs for execution speed. Windows-based applications can use GDI+ (Graphics Device Interface [1]) to aid user interface development. GDI+ interacts with device drivers on behalf of applications and supports antialiasing, either through device driver support or through it’s own implementation.

This project has been sponsored by the Norwegian Research Council, project nr. 160130/V30

[5] divides schemes for antialiasing into pre- and postfiltering methods. Antialiasing in this paper is based on prefiltering, meaning that colour intensities are calculated at an object level (objects being for instance lines, text or circles) prior to setting pixel values in the pixel grid. Pre-filtering opens up for flexibility, as objects can be treated differently.

Also, pre-filtering can limit computation to certain objects in the image.

An image processing framework with built-in support for antialiasing is described in the next section. The framework is called the Raster Imaging Framework, or RIM, and will be used to study antialiasing on a particular type of images. The interface to the RIM framework is inspired by

COM and implemented in C++. The need for a framework with built-in support for antialiasing in addition to the already existing implementations in software and hardware, comes from the need for an efficient, configurable and independent way of antialiasing selected contents. Antialiasing may not be a final operation, it may for instance be performed prior to compressing output to client applications.

RIM was motivated by the need for rendering compressed output to clients, where processing such as antialiasing is hidden from the end user.

2. RIM AND SUPPORT FOR ANTIALIASING

The RIM header file [3] addresses antialiasing support through a global method for rendering compressed output. One of the method parameters specifies options related to the output. One supported option is antialiasing. When this is used, vector objects are drawn with antialiasing to improve readability. Antialiasing is only applied to vectors.

Figure 1 shows how RIM has improved the readability of text using antialiasing. The effect of antialiasing is also visible for rotated content. Even when text is large enough to read, the text may appear quite ugly when no antialiasing is used. Since more contents can be included in a readable manner in a small area with antialiasing, it has high significance on devices with small displays.

1-4244-0413-4/06/$20.00 ©2006 IEEE 106 NORSIG 2006

(a) No antialiasing (b) Antialiasing

Fig. 1 . Text with and without antialiasing and rotation

35

30

25

20

15

10

5

0

0

GIF

PNG

JPEG2000

20 40 60 80 100

Tile index

120 140 160 180

Fig. 3 . Compression of antialiased GIF, PNG, JPEG2000

Fig. 2 . Layered image of Gjøvik with vector overlay

3. EXPERIMENTS WITH THE RIM FRAMEWORK

AND ANTIALIASING

Raster data with vector overlay is a very common combination. Such an image is shown in figure 2. This is a map of a

Norwegian city (Gjøvik) with vector overlay, and it is used as the test image of this paper. The city map (grey colour) is in TIFF G4 [4] format, has size

8000 × 6000 pixels, and tiles of size

512 × 512 pixels. The vector format is a format called DSI, a multicolor vector format not widely used. In this case, the vector file uses 8 different colours. Both TIFF

G4 and DSI are supported by RIM.

RIM has been integrated with an XML interpreter which converts XML to RIM interface methods. Details for this

XML vocabulary is not discussed in this paper, but the example below is listed to show how our TIFF image is included with DSI overlay:

1

<?xml version="1.0" encoding="UTF-8" ?>

<visalg>

<coloredsection color="bbbbbb">

6

<file x0="0" y0="0" laysf="1" name="Gjoevik.tif" format="3"/>

</coloredsection>

<vectorfile x0="0" y0="0" laysf="10" name="Gjoevik.dsi" format="8" symdir="sym"/>

</visalg>

Tests have been run by losslessly compressing antialiased contents to GIF, PNG and JPEG2000 using RIM. Each tile in the image is tested separately. Results for compressed file sizes are shown in figure 3. It is seen that JPEG2000 comes best out. This is so since RIM’s JPEG2000 encoder has been optimised to compress this kind of images well, as is discussed further in the next section. GIF offers little flexibility to improve compression further than what is shown. PNG is more flexible, and it is possible to improve compression further than what is shown. For instance, the deflate compression algorithm , used by PNG, supports using dynamic Huffman codes . This has not been applied in measurements here.

4. ADAPTATIONS TO JPEG2000

RIM supports JPEG2000, in particular palette-based JPEG-

2000. At low bit-depths, palette-based JPEG2000 is desirable since it reduces the number of JPEG2000 code-stream components to

1

. Also, bit-depth of palette samples is decreased according to the number of colours present, concentrating information in fewer bit-planes . A JPEG2000 encoder processes bit-planes in order, and thus performs better with less bit-plane complexity. If in addition palette indices are rearranged, compression can be improved further. The idea of rearranging palette indices is not new, and can be exploited for other image formats than JPEG2000

107

80

70

60

50

40

JPEG2000 palette

JPEG2000 palette with reorganized palette indices

30

20

10

0

0 20 40 60 80 100

Tile index

120 140 160 180 200

Fig. 4 . Improving palette-based JPEG2000 compression by rearranging palette indices for an antialiased image also (for instance JPEG-LS). In [7], a mechanism for finding good reorganizations of palette indices was introduced.

This mechanism will not be used directly here, but the same ideas will be tested on our test images. A main idea in [7] is that the most adjacent colours should have palette indices

”close in value”. For JPEG2000, ”close in value” should mean many bits in common to reduce bit-plane complexity.

This motivates using a Gray code on the palette indices. A

Gray code assigns binary codes which differ in only one bit to numerically adjacent values.

Our focus will be on establishing simple palette rearrangement guidelines, based on visual inspection of the image. Different palette rearrangement guidelines will be used depending on whether image contents are antialiased or not.

If no antialiasing is used, colours in increasing Z-order will be assigned palette indices

{ 0 , − 1 , 1 , − 2 , 2 , − 3 ...

}

. This concentrates indices in the lower bit-planes. Antialiased images will be given a more thorough palette rearrangement below, since such images is of primary interest in this paper. The plot in figure 4 shows the effect this has on compression. Due to this, all other JPEG2000-related figures in this paper use palette rearrangement.

The JPEG2000 standard [6] offers much flexibility. For instance, one can enable or disable the discrete wavelet transform , which is used by JPEG2000 to support resolution scalability . Lossless JPEG2000 uses a reversible wavelet transform . [6] notes that this is primarily designed for continoustone imagery, so that it would make compression suffer for our type of images. RIM supports assigning any number of levels to wavelet transforms. In figure 5, one level is used to confirm the stated degradation in compression. No wavelet transform has been performed for other figures.

To see the overall vector contribution, filesizes when no vector overlay is included are also shown in figure 5. It is noted that the Gjøvik layer (grey colour) has the same bit representation regardless of whether vector content is included. It is seen that little extra file size is associated with our antialiased vectors.

4.1. Palette rearrangement guidelines

Some explanation is needed on how palette indices have been rearranged for antialiased contents in this paper. It is assumed that p bits are needed to represent all palette indices. For our image, a total of 37 colours are used when counting the background and all colours and colour levels, so that p = 6 . Recall that JPEG2000 applies a level offset of

2 p − 1 to any unsigned image sample values. In the rearrangement guidelines below, it is assumed that level offset has already been performed, so that palette indices are in the range

[ − 2 p − 1 , 2 p − 1 )

.

1. Assign palette index

0 to the background. The background is dominating in our image, so this reduces bit-plane complexity.

2. For the nonzero palette indices, create groups of

4 indices each, so that as many bits as possible are common for all indices in the same group. This can be achieved with a Gray code. Since JPEG2000 deals with magnitude bit-planes , 4 values can be placed together so that only one magnitude bit differs.

3. Order the groups so that groups having few nonzero magnitude bits come first.

4. Locate the most common colours after the background.

In our case, this is the grey TIFF layer, and the red, green, blue and orange vector layers. The most common colour and it’s corresponding colour levels are placed in the first group, and so on for the next groups.

The idea of assigning palette indices for a colour and it’s corresponding colour levels in a group where many bits are common, comes from the fact that these palette indices will have spatial adjacency, so they should have many bit-planes in common in order to simplify bit-plane coding.

Letting the most common colours have palette indices with few magnitude bits reduces bit-plane complexity. A

JPEG2000 encoder can skip the higher bit-planes if they give no contribution. A slight improvement in step 3 could therefore be to let the most common colours use only lower bit-planes, in addition to letting them have few magnitude bits.

The points above are not concerned with assigning palette indices for different vector colours relative to each other.

This has little impact on compression if vectors with different colours have little spatial adjacency.

108

180

160

140

120

100

80

60

40

20

RGB JPEG2000

RGB JPEG2000 with DWT

16

14

12

10

20

18

4

2

8

6

JPEG2000 without vector overlay antialiased JPEG2000

0

0 20 40 60 80 100

Tile index

120 140 160 180

(a) JPEG2000 filesizes with and without DWT for antialiased images

0

0 20 40 60 80 100

Tile index

120 140 160 180

(b) JPEG2000 filesizes with antialiasing, with and without vector content

Fig. 5 . Variations of JPEG2000

The exact palette rearrangement is not listed, since the point is not to establish a fixed algorithm. The point is to show that JPEG2000 bit-plane coding details can motivate certain rearrangements. This paper does not attempt to quantify the effects of each point in the list above. Due to the dominance of the background colour, it is a fair assumption that the first point has high effect.

5. CONCLUSION

Antialiasing in the context of an image processing framework was exploited. It was shown that JPEG2000 can obtain superior compression with our type of image, when compared with formats like GIF and PNG. Issues relating to how a JPEG2000 encoder should be configured for such images were discussed. In particular, skipping the discrete wavelet transform, choosing palette-based JPEG2000, and carefully choosing palette indices were the major impact factors leading to efficient compression.

Results in this paper were obtained with an Intel Pentium M processor with 1600MHz clock speed, L2 cache size of 1MB and 512 MB RAM. All tests were run under Windows XP, and all programs were compiled with Microsoft

Visual C++.NET 7.1.

RIM’s support for the GIF, PNG and JPEG2000 has not been conformance-tested. JPEG2000 images generated by

RIM have only been tested with Kakadu [2].

vides high performance imaging technologies using technology developed by Dr. Sandor Seres. The post. doc project carried out by Dr. Øyvind Ryan at the University of Oslo has enhanced this implementation, and added algorithms for improved performance and scalability with regards to server applications and memory consumption.

6. REFERENCES

[1] GDI+. Microsoft. msdn.microsoft.com/library/ .

[2] The Kakadu project. www.kakadusoftware.com/ .

[3] rim.h. C++ header file for the RIM framework.

http://www.ifi.uio.no/ ˜ oyvindry/rim/rim.h

.

[4] CCITT, Recommendation T.6.

Facsimile Coding

Schemes and Coding Control Functions for Group 4

Facsimile Apparatus , 1985.

[5] S. Feiner J. Foley, A. van Dam and J. Hughes.

Computer Graphics: Principles and Practice, Second Edition in C . Addison-Wesley, 1996.

[6] David S. Taubman and Michael W. Marcellin.

JPEG2000. Image compression. Fundamentals, standards and practice.

Kluwer Academic Publishers,

2002.

[7] J. Li W. Seng and S. Lei. An efficient color re-indexing scheme for palette-based compression.

Proc. IEEE Int.

Conf. Image Proc.

, 3:476–479, 2000.

Acknowledgement

The work in this paper is based on the RIM library from

Raster Imaging AS ( www.rasterimaging.com

) which pro-

109

Download