CHAPTER 3 Graphics and Image Data Representations Multimedia Network Lab. Prof. Sang-Jo Yoo 3.1 Graphics/Image Data Types The number of file formats used in multimedia continues to proliferate. File Import File Export Native Image Palette Sound Video Animat Image Video BMP, DIB PAL AIFF AVI FIR BMP AVI FIR GIF, JPG ACT AU MOV FLA MOV DXR PICT, PNG MP3 FLC EXE PNT, PSD WAV FLI TGA, TIFF GIF WMF PPT 2
1-bit Images Each pixel is stored as s single bit (0 or 1), so also refered to as binary image. Such an image is also called a 1-bit monochrome image since it contains no color. 3 8-bit Gray-level Images Each pixel has a gray-value between 0 and 255. Each pixel is represented by a single byte: A dark pixel might have a value of 10, and a bright one might be 230. Bitmap: The two-dimensional array of pixel values that represents the graphics/image data. Image resolution refers to the number of pixels in a digital image. Fairly high resolution for such an image might be 1,600 x 1,200, whereas lower resolution might be 640 x 480. Frame buffer: hardware used to store bitmap Video card (graphics card) is used for this purpose. 4
Multimedia Presentation Each pixel is usually stored as a byte (a value between 0 to 255), so a 640 x 480 grayscale image requires 300kB of storage. When an image is printed, the basic strategy of dithering is used, which trades intensity resolution for spatial resolution to provide ability to print multi-level images on 2-level (1-bit) printers. 5 Spatial Resolution 256x256 128x128 64x64 32x32 16x16 8x8 6
256 Gray Resolution 32 16 8 4 2 7 Dithering Dithering is used to calculate patterns of dots such that values from 0 to 255 correspond to patterns that are more and more filled at darker pixel values, for printing on a 1-bit printer. The main strategy is to replace a pixel value by a larger pattern, say 2x2 or 4x4, such that the number of printed dots approximates the varying-sized disks of ink used in analog, in halftone printing (e.g., for news paper photos) For example, if we use a 2x2 dither matrix We can first re-map image values in 0 255 into the new range 0,1,2,4 by dividing by 256/5. Then, e.g., if the pixel value is 0 we print nothing, in a 2x2 area of printer output. But if the pixel value is 4, we print all four dots. 디더링 된 영상은 흑색과 백색으로만 표현이 된다. 그러나 인간이 디더링 영상 을 보면 시각과 뇌의 작용 에 의해 공간적으로 적분이 일어나게 되어 마치 저역 통과 필터를 거친 것과 같 은 효과가 나서 연속 밝기 의 영상으로 인식하게 된다. 4 0 3 2 1 8
Half Tone Printing 9 Note that the image size may be much larger, for a dithered image, since replacing each pixel by a 4x4 array of dots, makes an image 16 times as large. 10
Ordered dither An ordered dither consists of turning on the printer out-put bit for a pixel if the intensity level is greater than the particular matrix element just at that pixel position. 4x4 dither matrix 0 12 3 15 8 4 11 7 2 14 1 13 10 6 9 5 원 gray level 이미지의 각 pixel 휘도 값을 16등급으 로 나누고, 각 4x4 영역 블 록의 픽셀 값이 dither matrix의해당위치값보다 크면 dot를 칠한다. 컬러 이미지의 경우 16개 정도의 순색으로 디더링 기술을 이용하 여 256 칼라를 표현할 수 있다. (칼러 프린터등에 이용) 예) 빨강과 흰색의 dot 조합으로 여러가지 핑크계열 색 표현 11 1972년 11월 PlayBoy 지의, Lena 이미지는 Southern California 대학에서 최초로 스캔되어, 현재까지도 계속 사용되 고 있다. 그런데 왜 하필 '레나' 인가에 대해서는 "A Note on Lena, IEEE TRANSACTIONS ON IMAGE PROCESSING. VOL. 5. NO. 1. JANUARY 1996" 에서 설명되고 있다. First, the image contains a nice mixture of detail, flat regions, shading, and texture that do a good job of testing various image processing algorithms. It is a good test image! Second, the Lena image is a picture of an attractive woman. 지금은 할머니가 된 스웨덴인 '레나'의 사 진이 지금까지 사용되고 있다는 건 개인 의 프라이버시 문제가 될 수도 있다. 1988 년 스웨덴의 학자들이 직접 레나를 찾아 가서 양해를 구했고, 레나는 흔쾌히 그녀 의 이미지가 사용되어도 좋다는 허락을 하였다. 사실 이때 레나는 자신의 사진이 전세계 수많은 학생과 학자에 의해 실험 되어 졌고 수천 아니 수만의 논문에 실렸 다는 사실을 처음 알았다고 한다, 1997년 IS&T 국제 학술대회에 특별 게스트로 초 청되어 열렬한 환대를 받았다 12
Image Data Type The most common data types for graphics and image file formats 24-bit color and 8-bit color In a color 24-bit image, each pixel is represented by three bytes, usually representing RGB. This format supports 256x256x256 possible combined colors (total of 16,777,216 possible colors). Results in a storage penalty: 640x480 24bit color image requires 921.6 kb of storage without any compression. Additionally an alpha value representing special effect information requires extra bytes (1 byte for each color) Many system make use of 8-bit color information (256 colors) in producing a screen image. 13 Example of 24-bit color image 14
(a) shows a 24-bit color image of Lena, and (b) shows the same image reduced to only 5 bits via dithering. (c) shows a detail of the left eye. 15 8-bit Color Images 8-bit color images use the concept of a lookup table to store color information. Basically, the image stores not color, but instead just a set of bytes, each of which is actually an index into a table with 3-byte values that specify the color for a pixel. If a pixel stores the value 25, the meaning is to go to row 25 in a color lookup table (LUT). 16
A color-picker (color palette) Consists of an array of fairly large blocks of color such tat a mouse-click will select the color indicated. In reality, a color-picker displays the palette colors associated with index values from 0 to 255. Index value 2 means CYAN, with RGB values (0,255,255) 17 3.2 Popular File Formats 8-bit GIF One of the most important format because of its historical connection to the WWW and HTML markup language as the first image type recognized by net browsers. Limited to 8-bit (256) color images only, while producing acceptable color images Supports interlacing successive display of pixels in widely-spaced rows. GIF87a: original specification GIF89a: the later version, support simple animation. JPEG Currently the most important common file format. 18