• Tidak ada hasil yang ditemukan

JPEG

Dalam dokumen Digital Image Processing (Halaman 38-42)

Digital Images

Step 3: Quantization of pixel values

1.5 Image File Formats

1.5.5 JPEG

The JPEG standard defines a compression method for continuous grayscale and color images, such as those that would arise from nature photography. The format was developed by the Joint Photographic Experts Group (JPEG)11 with the goal of achieving an average data reduction of a factor of 1:16 and was established in 1990 as ISO Stan- dard IS-10918. Today it is the most widely used image file format. In practice, JPEG achieves, depending on the application, compression in the order of 1 bit per pixel (i.e., a compression factor of around

9 Portable network graphics

10Unisys’s U.S. LZW Patent No. 4,558,302 expired on June 20, 2003.

11www.jpeg.org. 14

1.5Image File Formats 1:25) when compressing 24-bit color images to an acceptable quality

for viewing. The JPEG standard supports images with up to 256 color components, and what has become increasingly important is its support for CMYK images (see Sec. 12.2.5).

The modular design of the JPEG compression algorithm [163]

allows for variations of the “baseline” algorithm; for example, there exists an uncompressed version, though it is not often used. In the case of RGB images, the core of the algorithm consists of three main steps:

1. Color conversion and down sampling: A color transforma- tion from RGB into theY CbCr space (see Ch. 12, Sec. 12.2.4) is used to separate the actual color components from the brightness Y component. Since the human visual system is less sensitive to rapid changes in color, it is possible to compress the color com- ponents more, resulting in a significant data reduction, without a subjective loss in image quality.

2. Cosine transform and quantization in frequency space:

The image is divided up into a regular grid of 8 blocks, and for each independent block, the frequency spectrum is computed us- ing the discrete cosine transformation (see Ch. 20). Next, the 64 spectral coefficients of each block are quantized into a quantiza- tion table. The size of this table largely determines the eventual compression ratio, and therefore the visual quality, of the image.

In general, the high frequency coefficients, which are essential for the “sharpness” of the image, are reduced most during this step. During decompression these high frequency values will be approximated by computed values.

3. Lossless compression: Finally, the quantized spectral compo- nents data stream is again compressed using a lossless method, such as arithmetic or Huffman encoding, in order to remove the last remaining redundancy in the data stream.

The JPEG compression method combines a number of different com- pression methods and its should not be underestimated. Implement- ing even the baseline version is nontrivial, so application support for JPEG increased sharply once the Independent JPEG Group (IJG)12 made available a reference implementation of the JPEG algorithm in 1991. Drawbacks of the JPEG compression algorithm include its limitation to 8-bit images, its poor performance on non-photographic images such as line art (for which it was not designed), its handling of abrupt transitions within an image, and the striking artifacts caused by the 8×8 pixel blocks at high compression rates. Figure 1.9shows the results of compressing a section of a grayscale image using differ- ent quality factors (PhotoshopQJPG= 10,5,1).

JPEG File Interchange Format (JFIF)

Despite common usage, JPEG is not a file format; it is “only” a method of compressing image data. The actual JPEG standard only specifies the JPEG codec (compressor and decompressor) and by de-

12 www.ijg.org.

15

1Digital Images

Fig. 1.8 JPEG compression of an RGB image. Using a color space transformation, the color com- ponentsCb,Crare separated from theY luminance com- ponent and subjected to a higher rate of compression.

Each of the three components are then run independently through the JPEG compression pipeline and are merged into a single JPEG data stream.

Decompression follows the same stages in reverse order.

Color Trans- formation RGB

Y JPEG Compressor

JPEG Compressor JPEG Compressor Cb

Cr

JPEG Stream

JPEG Decompressor JPEG Decompressor JPEG Decompressor

Inverse Color Trans- formation

RGBƍ YƎ

CbƎ CrƎ

Crƍ Cbƍ Yƍ Yƍ

Cbƍ Crƍ

Yƍ Cbƍ Crƍ

sign leaves the wrapping, or file format, undefined.13 What is nor- mally referred to as a JPEG file is almost always an instance of a

“JPEG File Interchange Format” (JFIF) file, originally developed by Eric Hamilton and the IJG. JFIF specifies a file format based on the JPEG standard by defining the remaining necessary elements of a file format. The JPEG standard leaves some parts of the codec unde- fined for generality, and in these cases JFIF makes a specific choice.

As an example, in step 1 of the JPEG codec, the specific color space used in the color transformation is not part of the JPEG standard, so it is specified by the JFIF standard. As such, the use of different compression ratios for color and luminance is a practical implementa- tion decision specified by JFIF and is not a part of the actual JPEG encoder.

Exchangeable Image File Format (EXIF)

The Exchangeable Image File Format (EXIF) is a variant of the JPEG (JFIF) format designed for storing image data originating on digital cameras, and to that end it supports storing metadata such as the type of camera, date and time, photographic parameters such as aperture and exposure time, as well as geographical (GPS) data. EXIF was developed by the Japan Electronics and Information Technology Industries Association (JEITA) as a part of the DCF14 guidelines and is used today by practically all manufacturers as the standard format for storing digital images on memory cards. Inter- nally, EXIF uses TIFF to store the metadata information and JPEG to encode a thumbnail preview image. The file structure is designed so that it can be processed by existing JPEG/JFIF readers without a problem.

JPEG-2000

JPEG-2000, which is specified by an ISO-ITU standard (“Coding of Still Pictures”),15 was designed to overcome some of the better- known weaknesses of the traditional JPEG codec. Among the im-

13To be exact, the JPEG standard only defines how to compress the in- dividual components and the structure of the JPEG stream.

14Design Rule for Camera File System.

15www.jpeg.org/JPEG2000.htm. 16

1.5Image File Formats

(a) Original (75.08 kB)

(b)QJPG= 10 (11.40 kB)

(c)QJPG= 5 (7.24 kB)

(d)QJPG= 1 (5.52 kB)

Fig. 1.9

Artifacts arising from JPEG compression. A section of the original image (a) and the re- sults of JPEG compression at different quality factors:

QJPG = 10 (b),QJPG = 5 (c), andQJPG = 1 (d). In parentheses are the resulting file sizes for the complete (di- mensions 274×274) image.

provements made in JPEG-2000 are the use of larger, 64×64 pixel blocks and replacement of the discrete cosine transform by thewavelet transform. These and other improvements enable it to achieve sig- nificantly higher compression ratios than JPEG—up to 0.25 bits per pixel on RGB color images. Despite these advantages, JPEG-2000 is supported by only a few image-processing applications and Web browsers.16

16 At this time, ImageJ does not offer JPEG-2000 support.

17

1Digital Images 1.5.6 Windows Bitmap (BMP)

The Windows Bitmap (BMP) format is a simple, and under Win- dows widely used, file format supporting grayscale, indexed, and true color images. It also supports binary images, but not in an efficient manner, since each pixel is stored using an entire byte. Optionally, the format supports simple lossless, run-length-based compression.

While BMP offers storage for a similar range of image types as TIFF, it is a much less flexible format.

Dalam dokumen Digital Image Processing (Halaman 38-42)