Government Polytechnic Lohaghat (Champawat) Branch-Information Technology Semester-6 Subject- Multimedia Technology Unit-4 Images

Course Description: Image, Image Formats, Image Compression and Multimedia .

Course Duration: 10 hours

Course Goals and Objectives: After Completing This Course, Trainee will be able to Understand Basic Concepts of Image Compression and Multimedia Database.

Prerequisite: Trainee should have a basic knowledge of Multi-Dimensional array, Matrix Multiplication, and Database Management System.

Bitmap A bitmap is an array of bits that specify the color of each pixel in a rectangular array of pixels. The number of bits devoted to an individual pixel determines the number of colors that can be assigned to that pixel. For example, if each pixel is represented by 4 bits, then a given pixel can be assigned one of 16 different colors (2^4 = 16).

In , a bitmap is a mapping from some domain (for example, a range of integers) to bits. It is also called a bit array or bitmap index. A bitmap is a type of memory organization or image used to store digital images. The term bitmap comes from the computer programming terminology, meaning just a map of bits, a spatially mapped array of bits.

Raster images in general may be referred to as bitmaps or pixmaps, whether synthetic or photographic, in files or memory. Many graphical user interfaces use bitmaps in their built-in subsystems Bitmaps are used to create realistic graphics and images. Like when you take a photograph using a digital camera or scan an image from a magazine, you are creating a bitmap graphic. A bitmap graphic is composed of many tiny parts, called pixels, which are often many different colors.

Size of the BMP file correlates directly with its quality. The higher the quality, the bigger the file. Bitmaps are perfect for creating detailed images (like photographs) because of the amount of data each pixel can store. The greater the amount of data, the broader the range of colors it can display.

There are many standard formats for saving bitmaps in disk files.

Multimedia Image Formats JPEG - Joint Photographic Experts Group. PNG - Portable Network Graphics. GIF - Graphics Interchange Format. TIFF - Tagged Image File. PSD - Photoshop Document. PDF - Portable Document Format. AI - Adobe Illustrator Document. BMP - Bit Map.

Govind Ballabh Head of Information Technology

Government Polytechnic Lohaghat (Champawat) Branch-Information Technology Semester-6 Subject- Multimedia Technology Unit-4 Images

BMP BMP is a standard format used by Windows to store device-independent and application independent images. The number of bits per pixel (1, 4, 8, 15, 24, 32, or 64) for a given BMP file is specified in a file header. BMP files with 24 bits per pixel are common. BMP files are usually not compressed and, therefore, are not well suited for transfer across the Internet. BMP is an image file format that contains bitmap graphics data. BMP images are device independent and require no graphics adapter to display them. Image data in BMP files are usually uncompressed or compressed with a lossless compression. This format supports Various Color Depths, alpha channels, color profiles, and optional data compression. BMP files are widely used on Windows operating systems and other platforms. It is compatible with all major image editing applications like Corel DRAW.

TIFF (file types ending in .tif) TIFF (also known as TIF) stands for Tagged Image File Format. TIFF images are uncompressed and thus contain a lot of detailed image data. are also extremely flexible in terms of color (they can be grayscale, or CMYK for print, or RGB for web).

TIFF is a flexible and extendable format that is supported by a wide variety of platforms and image-processing applications. TIFF files can store images with an arbitrary number of bits per pixel and can employ a variety of compression algorithms. Several images can be stored in a single, multiple-page TIFF file.

TIFF is the most common file type used in photo software (such as Photoshop), as well as page layout software (such as Quark and InDesign), because a TIFF contains a lot of image data.

JPEG (file types ending in .JPEG) Also known as JPG, file types ending in .jpg. JPEG stands for Joint Photographic Experts Group, which created this standard for this type of image formatting. JPEG files are images that have been compressed to store a lot of information in a small-size file.

JPEG is a compression scheme that works well for natural scenes such as scanned photographs. Some information is lost in the compression process, but often the loss is imperceptible to the human eye. store 24 bits per pixel, so they are capable of displaying more than 16 million colors. JPEGs do not support transparency or animation.

Most digital cameras store photos in JPEG format. A JPEG is compressed using “Lossy” compression. JPEG files are usually used for photographs on the web, because they create a small file that is easily loaded on a web page. JPEG files are bad for line drawings or logos or graphics due to compression.

Govind Ballabh Head of Information Technology

Government Polytechnic Lohaghat (Champawat) Branch-Information Technology Semester-6 Subject- Multimedia Technology Unit-4 Images

GIF (file types ending in .) GIF stands for Graphic Interchange Format. This format compresses images but, as different from JPEG, the compression is lossless. No detail is lost in the compression, but the file size is larger than JPEG.

GIF is a common format for images that appear on Web pages. work well for line drawings, pictures with blocks of solid color, and pictures with sharp boundaries between colors. GIFs are compressed, but no information is lost in the compression process; a decompressed image is exactly the same as the original.

1. Due to limited color range GIF is suitable for the web but not for printing. 2. This format is never used for photography, because of the limited number of colors. 3. GIFs can also be used for animations.

PNG (file types ending in .png) The PNG (Portable Network Graphics) file format was created as a free, open-source alternative to GIF. The PNG file format supports 24-bit truecolor (16 million colors). PNG was created as an open format to replace GIF, because the patent for GIF was owned by one company and nobody else wanted to pay licensing fees. It also allows for a full range of color and better compression.

The PNG format retains many of the advantages of the GIF format but also provides capabilities beyond those of GIF. Like GIF files, PNG files are compressed with no loss of information. PNG files can store colors with 8, 24, or 48 bits per pixel and grayscales with 1, 2, 4, 8, or 16 bits per pixel.

It’s used almost exclusively for web images, never for print images. For photographs, PNG is not as good as JPEG, because it creates a larger file. PNG is better for images with some text, or line art, because the images look less “bitmappy.”

Raw image files Raw image files usually contain data from a digital camera. The files are called raw because they haven’t been processed and therefore can’t be edited or printed yet. There are a lot of different raw formats–each camera company often has its own proprietary format. Raw files usually contain a vast amount of data that is uncompressed. Because of this, the size of a raw file is extremely large. Usually they are converted to TIFF before editing and color-correcting.

Raster Graphics Raster images use bit maps to store information. This means a large file needs a large bitmap. The larger the image, the more disk space the image file will take up. As an example, a 640 x 480 image requires

Govind Ballabh Head of Information Technology

Government Polytechnic Lohaghat (Champawat) Branch-Information Technology Semester-6 Subject- Multimedia Technology Unit-4 Images information to be stored for 307,200 pixels, while a 3072 x 2048 image requires information to be stored for 6,291,456 pixels. We use algorithms which compress images to help reduce these file sizes. Image formats like and gif are common compressed image formats. Scaling down these images is easy but enlarging a bitmap makes it pixelated or simply blurred. Hence for images which need to scaled to different sizes, we use vector graphics. File extensions: .BMP, .TIF, .GIF, .JPG

Vector Graphics Making use of sequential commands or mathematical statements or programs which place lines or shapes in a 2-D or 3-D environment is referred to as Vector Graphics. Vector graphics are best for printing since it is composed of a series of mathematical curves. As a result vector graphics print crisply even when they are enlarged. In vector graphics, the file is created and saved as a sequence of vector statements. Rather than having a bit in the file for each bit of line drawing we use commands which describe series of points to be connected. Example AutoCad Drawing file. Extensions : .DWG, .SVG, .EPS, .PDF, .AI, .DXF

Printers and display devices are raster devices. As a result we need to convert vector images to raster format before they can be used i.e displayed or printed.

Raster vs Verctor 1. The main difference between vector and raster graphics is that raster graphics are composed of pixels, while vector graphics are composed of paths. 2. Raster graphics are cheaper than vector graphics. 3. Raster graphics occupy more space depends on image quality. 4. Vector graphics file extensions are DWG, SVG, EPS, PDF, AI, DXF while Raster File extensions are BMP, TIF, GIF, JPG, PNG. 5. Vector graphics is Infinitely scalable while raster graphics constrained by resolution and dimensions. 6. Raster software includes Photoshop, GIMP while Vector software includes LibreCAD, CorelDraw. 7. Raster graphics is perfect for drawing so raster images are best for photos while vector graphics is perfect for painting so vector images are best for logos, illustrations, engravings, product artwork.

Lossy Compression Lossy compression refers to compression in which some of the data from the original file (JPEG) is lost. The process is irreversible, once you convert to lossy, you can't go back. And the more you compress it, the more degradation occurs. JPEGs and GIFs are both lossy image formats.

Govind Ballabh Head of Information Technology

Government Polytechnic Lohaghat (Champawat) Branch-Information Technology Semester-6 Subject- Multimedia Technology Unit-4 Images

One of the biggest obvious benefits to using lossy compression is that it results in a significantly reduced file size (smaller than lossless compression method), but it also means there is quality loss.

Advantages: Very small file sizes and lots of tools, plugins, and software support it.

Disadvantages: Quality degrades with higher ratio of compression. Can't get original back after compressing.

JPEG Image Compression JPEG stands for Joint Photographic Expert Group an international standard in 1992. Works with colour and greyscale images, Many applications e.g., satellite, medical. JPEG uses a lossy form of compression based on the discrete cosine transform (DCT). This mathematical operation converts each frame/field of the video source from the spatial (2D) domain into the frequency domain.

JPEG Compression Algorithm 1. JPEG Compression algorithm has five main basic steps. 2. RGB color space to YCbCr color space Conversion. 3. Preprocessing for DCT (Discrete Cosine Transformation). 4. Perform DCT - Discrete Cosine Transformation. 5. DCT Coefficient Quantization. 6. Lossless Encoding which includes Zigzag Scan, DPCM on DC component, RLE on AC Components and Entropy Coding

Color Transform Sampling Row Image RGB to YCbCr 8x8 Matrix

Zig-Zag Scan Quantization Forward DCT

Encoding Entropy Encoding Compressed

RLE/DPCM (Huffman Coding) Image

RGB color space to YCbCr color space conversion

Govind Ballabh Head of Information Technology

Government Polytechnic Lohaghat (Champawat) Branch-Information Technology Semester-6 Subject- Multimedia Technology Unit-4 Images

An digital image in RGB format that is a combination of Red, Green, Blue color channel is converted to YCbCr color channels. Y is the brightness of the image and Cb is the blue difference relative to the green color and Cr is the red difference relative to the red color.

Preprocessing for DCT transformation DCT transformation stands for Discrete Cosine Transformation. Before doing this transformation, some preprocessing should be done. First an image need to be separated for 8*8 pixel blocks. That means each block has 8*8 pixels and it is 64 pixels in one block.

Following is the pixel matrix of this chosen block.

005 176 193 168 168 170 167 165

006 176 158 172 162 177 168 151

005 167 172 232 158 061 145 214

033 179 169 174 005 005 135 178

008 104 180 178 172 197 188 169

063 005 102 101 160 142 133 139

051 047 063 005 180 191 165 005

049 053 043 005 184 170 168 074

Then these values should be centralized about 0 between (-127 to 127) as it helps the next steps as cosine values centralized about 0 between(-1 to +1). For this substitute 127 from each. Then the new matrix is the following.

–122 0049 0066 0041 0041 0043 0040 0038

–121 0049 0031 0045 0035 0050 0041 0024

–122 0040 0045 0105 0031 –066 0018 0087

–094 0052 0042 0047 –122 –122 0008 0051

–119 –023 0053 0051 0045 0070 0061 0042

–064 –122 –025 –026 0033 0015 0006 0012

–076 –080 –064 –122 0053 0064 0038 –122

–078 –074 –084 –122 0057 0043 0041 –053

Govind Ballabh Head of Information Technology

Government Polytechnic Lohaghat (Champawat) Branch-Information Technology Semester-6 Subject- Multimedia Technology Unit-4 Images

Discrete Cosine Transformation The discrete cosine transform (DCT) helps separate the image into parts (or spectral sub-bands) of differing importance (with respect to the image's visual quality). It transforms a image from the spatial domain to the frequency domain. Cosine signal lies in between the 1 and -1.

F(u,v) = C * f(i,j) * CT

Where  f(i,j) is the intensity of the pixel in row i and column j;  F(u,v) is the DCT coefficient in row u and column v of the DCT matrix.

Quantization Quantisation is the process of converting a continuous range of values into a finite range of discrete values. As number of bits to represent pixel intensity is limited, quantisation is needed. The goal of quantisation usually is to produce a more compact representation of the data while maintaining its usefulness for a certain purpose.

The quantization table used has a great influence on the quality of JPEG compression and the degree of compression achieved. These tables are often developed experimentally (by trial and error) to give the greatest number of bits to the DCT values, which are most noticeable and have the most impact to the human vision system.

The quantization table is applied to the output of the DCT, which is an 8 × 8 array. The upper left coefficient is the DC coefficient, and the remaining are the 63 AC coefficients, of increasing horizontal and vertical frequencies as one moves rightward and downward.

Quantization Table / Matrix

016 011 010 016 024 040 051 061

012 012 014 019 026 058 060 055

014 013 016 024 040 057 069 056

014 017 022 029 051 087 080 062

018 022 037 056 068 109 103 077

024 035 055 064 081 104 113 092

049 064 078 087 103 121 120 101

072 092 095 098 112 100 103 099

Govind Ballabh Head of Information Technology

Government Polytechnic Lohaghat (Champawat) Branch-Information Technology Semester-6 Subject- Multimedia Technology Unit-4 Images

The quantized output array B is formed as follows:

B[j, k] = Round (A [j, k] / Q[j, k]) for all { j, k = 0 to 7 }

Where A[j, k] is the DCT output array value, Q[j, k] is the quantization table value.

After Quantization the resultant matrix is like this

99 60 0 6 0 0 0 0

0 0 0 0 0 0 0 0

0 -5 0 0 1 0 0 0

0 0 0 0 0 0 0 0

13 0 0 0 0 0 0 0

0 1 0 0 0 0 0 0

0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0

Zig-Zag Scan The zigzag scan is used to map the 8x8 matrix to a 1x64 vector. Zigzag scanning is used to group low-frequency coefficients to the top level of the vector and the high coefficient to the bottom. To remove the large number of zero in the quantized matrix, the zigzag matrix is used.

Purpose of Zig-Zag scan is grouping of low frequency coefficients in top of the vector. It Maps 8 x 8 matrix to a 1 x 64 vector. Zig Zag scanning is a transform based coding. It is employed for nonuniform quantization of NxN DCT (Discrete Cosine Transformation) coefficients. Lower coefficients have most of the energy and it is distributed circularly symmetric about the origin. The net result is that, it results in 1D sequence, after certain number of non-zero coefficients most of the remaining become 0.

Output Vector of Zig-Zag scan [99 60 00006 0 -5 013 0000000000001 001 00 All Zeros]

Each nonzero value is encoded as the triple [(r, s), c)] where  r is run length, the number of zeros before the current value.  s is size, the number of bits needed to encode the value.  c is the actual value.

Govind Ballabh Head of Information Technology

Government Polytechnic Lohaghat (Champawat) Branch-Information Technology Semester-6 Subject- Multimedia Technology Unit-4 Images

 (0, 0) indicates that from now on its only zeros up to end of block.

RLE (Run Length Encoding) Output [(0,7),99], [(0,6),60], [(4,3),6], [(1,1),5], [(1,4),13], [(12,1), 1], [(0,0)]

Lossless Encoding This is the final step and this method uses huffman coding and it reduces a large amount of memory without loosing any detail of the image. Most of the times it saves 70% of the memory. This encoding method gets the frequency of different pixels and store that pixels and the frequency instead of storing each pixel.

Multimedia Database Multimedia database is the collection of interrelated multimedia data that includes text, graphics (sketches, drawings), images, animations, video, audio etc and have vast amounts of multisource multimedia data. The framework that manages different types of multimedia data which can be stored, delivered and utilized in different ways is known as multimedia database management system.

There are three classes of the multimedia database which includes static media, dynamic media and dimensional media.

Static Media : Time independent data Images.

Dynamic Data : Time Dependent Data audio, vedio.

Content of Multimedia Database management system :

1. Media data: The actual data representing an object.

2. Media format data: Information such as sampling rate, resolution, encoding scheme etc.

3. Media keyword data: Keywords description relating to the generation of data. It is also known as content descriptive data.

4. Media feature data: Content dependent data such as the distribution of colors, kinds of texture and different shapes present in data.

Types of multimedia applications

1. Repository applications – A Large amount of multimedia data as well as meta-data (Media format date, Media keyword data, Media feature data) that is stored for retrieval purpose, e.g., Repository of satellite images, engineering drawings, radiology scanned pictures.

Govind Ballabh Head of Information Technology

Government Polytechnic Lohaghat (Champawat) Branch-Information Technology Semester-6 Subject- Multimedia Technology Unit-4 Images

2. Presentation applications – They involve delivery of multimedia data subject to temporal constraint. Optimal viewing or listening requires DBMS to deliver data at certain rate offering the quality of service above a certain threshold. Here data is processed as it is delivered. Example: Annotating of video and audio data, real-time editing analysis.

3. Collaborative work using multimedia information – It involves executing a complex task by merging drawings, changing notifications. Example: Intelligent healthcare network.

Challenges to Multimedia

1. Modelling – Working in this area can improve database versus information retrieval techniques thus, documents constitute a specialized area and deserve special consideration.

2. Design – The conceptual, logical and physical design of multimedia databases has not yet been addressed fully as performance and tuning issues at each level are far more complex as they consist of a variety of formats like JPEG, GIF, PNG, MPEG which is not easy to convert from one form to another.

3. Storage – Storage of multimedia database on any standard disk presents the problem of representation, compression, mapping to device hierarchies, archiving and buffering during input-output operation. In DBMS, a ”BLOB”(Binary Large Object) facility allows untyped bitmaps to be stored and retrieved.

4. Performance – For an application involving video playback or audio- video synchronization, physical limitations dominate. The use of parallel processing may alleviate some problems but such techniques are not yet fully developed. Apart from this multimedia database consume a lot of processing time as well as bandwidth.

5. Queries and retrieval –For multimedia data like images, video, audio accessing data through query opens up many issues like efficient query formulation, query execution and optimization which need to be worked upon.

Applications of Multimedia Database

1. Documents and record management: Industries and businesses that keep detailed records and variety of documents. Example: Insurance claim record.

Govind Ballabh Head of Information Technology

Government Polytechnic Lohaghat (Champawat) Branch-Information Technology Semester-6 Subject- Multimedia Technology Unit-4 Images

2. Knowledge dissemination: Multimedia database id a very effective tool for knowledge dissemination in terms of providing several resources. Example: Electronic books.

3. Education and training: Computer-aided learning materials can be designed using multimedia sources which are nowadays very popular sources of learning. Example: Digital libraries.

4. Business: Marketing, advertising, retailing, entertainment and travel. Example: a virtual tour of cities.

5. Real-time control and monitoring: Coupled with active database technology, multimedia presentation of information can be very effective means for monitoring and controlling complex tasks Example: Manufacturing operation control.

Govind Ballabh Head of Information Technology