Presentation on theme: "Slide 1 Bitmapped Graphic Data. Slide 2 Hardware – CCD Charge-Coupled Device (CCD) A CCD is a device containing grids of pixels that are used in scanners,"— Presentation transcript:
Slide 2 Hardware – CCD Charge-Coupled Device (CCD) A CCD is a device containing grids of pixels that are used in scanners, digital cameras and digital video cameras as light-sensing devices. Bitmapped Graphic Data
Slide 3 Hardware – CCD An image is projected by a lens onto a 2D rectangular array of CCD image sensors causing each sensor to store light that representing the image. Each sensor stores the light for a single pixel so the more CCDs the higher the resolution of the image. An ADC is used to convert the signal to digital and a binary value for each CCD sensor is stored. Bitmapped Graphic Data
Slide 4 Hardware – Digital Camera Digital cameras Have a 2D rectangular array of CCD sensors to capture the image Each CCD sensor captures the light for roughly one pixel Therefore the more CCDs the higher the resolution of the image The CCD converts the light into an electrical signal i.e. a voltage An ADC is used to convert the signal to a digital signal Now the image can be stored on the computer in digital form Bitmapped Graphic Data
Slide 5 Capturing photo-images/video Sequence of events Bitmapped Graphic Data DSP Storage Image Lens CCD ADC 1Select IMAGE 2Image is directed through LENS 3Light attracted to CCD sensors 4Pass analogue signal through ADC chip 5Apply signal processing via DSP 6Store on backing storage
Slide 6 Hardware – Scanner Scanner Hard copy of image is scanned Light is reflected onto light- sensitive diodes that translate the light into a voltage An ADC converter translates each voltage into a digital pixel Pixel data is transferred to a software application the data can be read from Bitmapped Graphic Data
Slide 7 Role of ADC Bitmapped Graphic Data When an electrical signal is received from the CCD it needs to be converted to a digital signal by an Analogue to Digital Converter chip.
Slide 8 Storage of graphic data Bitmapped Graphic Data Bitmaps The entire image is stored as an ordered map of binary codes that represent the individual colour of each pixel. The size of each binary value is known as the colour (bit) depth. We can easily work out how many colours can be represented: Examples Bit depth is 1 bit:2 1 => 2x1 = 2 colours Bit depth is 2 bits:2 2 => 2x2 = 4 colours Bit depth is 3 bits: 2 3 => 2x2x2 = 8 colours … Bit depth is 8 bits:2 8 = 2x2x2x2x2x2x2x2 = 256 colours Number of colours = 2 bit depth So, a bitmap that has 16 colours means a bit depth of 4 bits!
Slide 9 Storage of graphic data Bitmapped Graphic Data Indexed Colour Colours available are indexed in an array that acts as a ‘palette’ of available colours - known as a Colour Lookup Table (CLUT). Each pixel stores the index to the array (palette) for the colour shade required rather than the actual binary colour code. These tables typically store 4, 16, or 256 distinct colours. Advantage: Indexed Colour reduces file/memory size and transfer times. Disadvantage: Limited number of distinct colours.
Slide 10 Storage of graphic data Bitmapped Graphic Data Indexed Colour Examples 4 colours 256 colours 16 colours 24 bits
Slide 11 Bitmapped Graphic Data Each pixel actually consists of three smaller dots – one for each of the primary colours, which in electronics are Red, Green and Blue. Green 0-255 Red 0-255 Blue 0-255 In 24-bit colour each of the primary colours has a byte (8 bits) allocated to store the colour shade so there are 16, 777, 216 possible shades. Note: A colour lookup table is not needed as the bitmap stores the actual 24- bit colour code. 24-bit Bitmap A set of 3 bytes (24 bits) represents the colour of each pixel, known as the RGB Colour Code. Storage of graphic data
Slide 12 Bitmapped Graphic Data Storage of graphic data
Slide 13 Bitmapped Graphic Data Hexadecimal and colour codes Hex is a base 16 numbering system commonly used to represent RGB colour codes to reduce the number of digits to be worked with. Hex uses the digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F Where A = 10, B =11, C = 12, D = 13, E = 14 and F = 15. This example hex colour code #9900CC means the RGB mix for this shade is: Red – 99 Green – 00 Blue - CC And this converts nicely into binary and into decimal….. Colour:RedGreenBlue Hex:9900CC Binary:1 0 0 1 0 0 1 1 0 0 Decimal:1530204 Extension
Slide 14 Bitmapped Graphic Data Hexadecimal and colour codes In a Windows application you can enter the decimal values for Red, Green and Blue to customise and mix the colour shade you require. Always remember though that the colour code will always be stored by the computer system as a 24-bit binary code! Extension
Slide 15 Storage of graphic data Bitmapped Graphic Data Run Length Encoding (RLE) RLE is a simple lossless data compression algorithm. Sequences of repeating data (runs) are stored as a count and a single data value. Example: Before RLE:aaaaaaaaaabbaaaaaabbaaaaaaaaaabbaaaaaabb After RLE:10a2b6a2b10a2b6a2b So original 40 characters reduced to 18 characters! RLE and bitmaps RLE can be applied to bitmaps to reduce file size. It works best where there are solid blocks of colour and a count is made of the number of pixels in the run with the same colour code. The length of each run is held in 1 byte so the maximum size of a run of colour is 255 repetitions.
Slide 16 Storage of graphic data Bitmapped Graphic Data Example – RLE and Bitmaps A run of 10 x 10 pixels all shaded black with bit depth of 8 bits (1 byte). RLE algorithm ImageBitmapCompressed Bitmap Original file:100 bytes Compressed file:40 bytes
Slide 17 Storage of graphic data Bitmapped Graphic Data Graphics Interchange Format (GIF) Compressed using LZW lossless compression with a colour depth of 8-bits and a palette of 256 RGB colours. Colour limitation means not suited to photographs but ideal for continuous colour blocks e.g. logos, clip-art etc. GIF files can be stored as: Non-interlaced - each line of the image is drawn one after the other Interlaced - every alternate line or bit (fuzzy to sharp) is drawn and then the rest after. GIF supports transparency and animation, usually 25 frames per second and with a separate 256 colour palette per frame. Advantage: with interlaced the user can see the graphic build up and decide whether they want to view it before the full image is complete.
Slide 18 Interlacing in Action Allows you to view an image before it is fully downloaded Image is gradually revealed
Slide 19 Storage of graphic data Bitmapped Graphic Data Lempel-Ziv-Welch (LZW) A lossless data compression algorithm that is part of the GIF format. It stores repeated patterns of data in a dictionary/table and uses pointers to point to the dictionary to obtain the colour code for the pixels in the pattern. Colour PatternDictionary Code 1 2.. 256 257 258 259 Converted to 258,259, 258 Original Image
Slide 20 Storage of graphic data Bitmapped Graphic Data Portable Network Graphics (PNG) Designed to replace GIF; uses lossless compression and up to 256 colours from an RGB palette-indexed colour table (CLUT) or can be 24-bit RGB. Parts of the image can be made transparent i.e. a single pixel value or an alpha channel. Can be interlaced allowing a clearer low- resolution image to be visible earlier in the transfer. PNGs are better than JPGs for storing photographs that require further editing. Once finally edited, the PNG can be converted to JPEG to reduce file size. However they are single-image so do not support animation.
Slide 21 Storage of graphic data Bitmapped Graphic Data Joint Photographic Expert Group (JPEG) A graphics format that uses lossy compression to cut out parts of the image that the human eye will not notice. It supports 24-bit colour and is suited to graduated colours and textures so works well for photographs. Advantage Far superior to GIF, and preferable to PNG as files sizes are smaller (due to lossy compression) with very little loss of overall quality. Disadvantage Suffers from generation loss i.e. the loss of quality when editing after compression. Does not support transparency
Slide 22 Bitmapped Graphic Data How to calculate the number of pixels Example An image is 400 pixels by 400 pixels at 72 dpi. How many pixels in this image? Solution No. of pixels: 400 x 400 = 160,000 pixels Example An image is 2 x 3 inches at 2048 dpi. How many pixels in this image? Solution No. of pixels: 2048 x 2048 x 2 x 3 = 25,165,824 pixels
Slide 23 Bitmapped Graphic Data How to calculate file size Example An image is 2 x 3 inches at 2048 dpi and has a colour depth of 24 bits. What is the file size of this image? Formula File size (bits) = resolution (pixels) x colour depth (bits) 8 Or File size (bytes) = resolution (pixels) x colour depth (bytes) Solution No. of pixels: 2 x 3 x 2048 x 2048 = 25,165,824 pixels Colour depth: 3 bytes = 25,165,824 pixels x 3 bytes = 75,497,472 bytes = 75,497,472 bytes / 1024 / 1024 = 72 Mbytes. = 72 Mbytes File Size
Slide 24 Bitmapped Graphic Data How to calculate colour depth Example An image is 2 x 3 inches at 2048 dpi and has a file size of exactly 72 Mb. What is the colour depth of this image? Formula Colour depth (bits) = No. of bits resolution (pixels) Solution No. of pixels: 2 x 3 x 2048 x 2048 = 25,165,824 pixels No. of bits: 72 x 1024 x 1024 = 603,979,776 bits = 603, 979, 776 bits / 25, 165, 625 pixels = 24 bits per pixel = 24 bit colour depth
Slide 25 Bitmapped Graphic Data Dithering Dithering is a technique that creates an illusion of extra colours and shades by varying the pattern of dots. It has the effect of mixing colours together to improve the appearance or ‘gradation’ of colour. The image below has bands of colour instead of a gradual transition between colours. Dithering is the most common method of reducing the colour range of an image such as a JPEG down to 256 colours (or less) such as an 8-bit GIF. Applying dithering reduces the banding effect. Colours reduced Dithered
Slide 26 Dithering In Action 256 Colour4 Colour Non- Dithered 4 Colour with Dithering
Slide 27 Bitmapped Graphic Data Anti-aliasing Anti-aliasing simulates extra resolution in an image to reduce its ‘blocky’ appearance. Anti-aliasing shades pixels around an image using intermediate colours between the foreground and the background. Before anti-aliasing After anti-aliasingResult It has the effect of fooling the human eye into seeing straight lines and curves where there are none! No anti-aliasingWith anti-aliasing Lets take a closer look:
Slide 28 Bitmapped Graphic Data Anti-aliasing Both pieces of text have exactly the same resolution
Slide 29 Bitmapped Graphic Data Increase resolution - Resampling It is possible to increase the resolution of a graphic by ‘resampling’ it and reducing the effect of pixellation. Resampling is the process of adding colour to the new pixels created when an image is enlarged. Example A graphic, 100 x 100 pixels is rescaled by 400%, so now 400 x 400 pixels. Each pixel is replaced by 4 x 4 pixels so 16 times more of the same colour! 100 x 100 pixels400 x 400 pixelsAfter resampling Scale by 400%Resample Each additional pixel is given an individual and distinct colour which was found by calculating the average colour value of the four neighbouring pixels (a mathematical technique known as bicubic interpolation.). However, resampling is only a kind of ‘guesstimate’ and image will quality will be lost. Better to capture the image at a higher resolution in the first place!!
Slide 30 Graphics cards Bitmapped Graphic Data Digital Signal Processing (DSP) Processes the signal to remove noise/distortion/allows the addition of effects to be applied by the hardware. Graphics Processing Unit (GPU) A graphics card has its own GPU which can generate images faster and of better quality than the main processor and frees the main CPU from the load e.g. 3-D graphics require millions of calculations to be performed each time they are drawn! The graphics card has chips that convert analogue signals to digital signals, known as ADC / DAC.