Image Representation C 3 Image representation How bitmapraster
Image Representation
C 3 Image representation • How bitmap/raster image data is stored and represented in a computer system. • The impact of image resolution on the way images are stored and represented. • The impact of sample/bit depth on the way that image data is stored and images are displayed. • The effects of compression on image data.
Type of Digital Image Two main types: BITMAP - The page is divided into an invisible grid and each pixel is assigned a colour VECTOR Drawn by following a set of mathematical instructions • Draw a circle • radius: 6 pixels • centre: 10, 10 • line thickness: 1 pixel
Meta Data • Meta Data is at the beginning of a file to tell the computer how to process the data. • What sort of information would need to be included in the meta data? • • • Size of the image grid (width and height) Colour depth (number of bits per pixel) Resolution to display the image in (pixels per inch) 4
Example of an image in binary. 01101010010100110001010100010101001011101010010101010100001011000101011010101010001010100 0101010100010111010101100101010001001100010100101010001101010011101001100010101000101010010111010100101010100010101000010110001010110101010100010101000101010001011101010110010101001101010010100110001010100010101 00101110101001010101010101000101010000101100010101101 010101000101010101010001010101110101011001010100110101011 0101001110100110001010100010101001011101010010101010101 0100010101000010110001010110101010100010101000101010001011101010110010101001101010010100110001010100010101001 011101011101010010101010100010101000010110001010110101000101010101010001010101000101110101011001010100110101011010 10010100110001010100010101001011101010010101010101010 0010101000010110001010110101010100010101000101010 10001011101010110010101001101010010100110001010100010101001011 101011101010010101010100010101000010110001010110101 00010101010101000101010100010111010101100101010011010100110001010100010101001011101010010101010101010001 0101000010110001010110101010100010101000101010100 01011101010110010101001101010010100110001010100010101001011101 0101011101010010101010100010101000010110001010110101000 1010101010001010101000101110101011001010101010000 10101011000101010001010110110101 5
Example of an image in binary. 011010100101001100010101000101010010111010100101010 01101010 10010101010100001011000101011010101010001010100 0101010100010111010101100101010001001100010100101010001101010011101001100010101000101010010111010100101010100010101000010110001010110101010100010101000101010001011101010110010101001101010010100110001010100010101 00101110101001010101010101000101010000101100010101101 010101000101010101010001010101110101011001010100110101011 0101001110100110001010100010101001011101010010101010101 0100010101000010110001010110101010100010101000101010001011101010110010101001101010010100110001010100010101001 011101011101010010101010100010101000010110001010110101000101010101010001010101000101110101011001010100110101011010 10010100110001010100010101001011101010010101010101010 0010101000010110001010110101010100010101000101010 10001011101010110010101001101010010100110001010100010101001011 101011101010010101010100010101000010110001010110101 00010101010101000101010100010111010101100101010011010100110001010100010101001011101010010101010101010001 0101000010110001010110101010100010101000101010100 01011101010110010101001101010010100110001010100010101001011101 0101011101010010101010100010101000010110001010110101000 1010101010001010101000101110101011001010101010000 10101011000101010001010110110101 This shows that the data that follows is to be treated as an image. 6
Example of an image in binary. 01101010010100110001010100010101001011101010010101001 10010101010100001011000101011010101010001010100 0101010100010111010101100101010001001100010100101010001101010011101001100010101000101010010111010100101010100010101000010110001010110101010100010101000101010001011101010110010101001101010010100110001010100010101 00101110101001010101010101000101010000101100010101101 010101000101010101010001010101110101011001010100110101011 0101001110100110001010100010101001011101010010101010101 0100010101000010110001010110101010100010101000101010001011101010110010101001101010010100110001010100010101001 011101011101010010101010100010101000010110001010110101000101010101010001010101000101110101011001010100110101011010 10010100110001010100010101001011101010010101010101010 0010101000010110001010110101010100010101000101010 10001011101010110010101001101010010100110001010100010101001011 101011101010010101010100010101000010110001010110101 00010101010101000101010100010111010101100101010011010100110001010100010101001011101010010101010101010001 0101000010110001010110101010100010101000101010100 01011101010110010101001101010010100110001010100010101001011101 0101011101010010101010100010101000010110001010110101000 1010101010001010101000101110101011001010101010000 10101011000101010001010110110101 Image width size. 7
Example of an image in binary. 011010100101001100010101000101010010111010100101010 01001110 10010101010100001011000101011010101010001010100 0101010100010111010101100101010001001100010100101010001101010011101001100010101000101010010111010100101010100010101000010110001010110101010100010101000101010001011101010110010101001101010010100110001010100010101 00101110101001010101010101000101010000101100010101101 010101000101010101010001010101110101011001010100110101011 0101001110100110001010100010101001011101010010101010101 0100010101000010110001010110101010100010101000101010001011101010110010101001101010010100110001010100010101001 011101011101010010101010100010101000010110001010110101000101010101010001010101000101110101011001010100110101011010 10010100110001010100010101001011101010010101010101010 0010101000010110001010110101010100010101000101010 10001011101010110010101001101010010100110001010100010101001011 101011101010010101010100010101000010110001010110101 00010101010101000101010100010111010101100101010011010100110001010100010101001011101010010101010101010001 0101000010110001010110101010100010101000101010100 01011101010110010101001101010010100110001010100010101001011101 0101011101010010101010100010101000010110001010110101000 1010101010001010101000101110101011001010101010000 10101011000101010001010110110101 Image height size. 8
Example of an image in binary. 011010100101001100010101000101010010111010100101010 10011000 10010101010100001011000101011010101010001010100 0101010100010111010101100101010001001100010100101010001101010011101001100010101000101010010111010100101010100010101000010110001010110101010100010101000101010001011101010110010101001101010010100110001010100010101 00101110101001010101010101000101010000101100010101101 010101000101010101010001010101110101011001010100110101011 0101001110100110001010100010101001011101010010101010101 0100010101000010110001010110101010100010101000101010001011101010110010101001101010010100110001010100010101001 011101011101010010101010100010101000010110001010110101000101010101010001010101000101110101011001010100110101011010 10010100110001010100010101001011101010010101010101010 0010101000010110001010110101010100010101000101010 10001011101010110010101001101010010100110001010100010101001011 101011101010010101010100010101000010110001010110101 00010101010101000101010100010111010101100101010011010100110001010100010101001011101010010101010101010001 0101000010110001010110101010100010101000101010100 01011101010110010101001101010010100110001010100010101001011101 0101011101010010101010100010101000010110001010110101000 1010101010001010101000101110101011001010101010000 10101011000101010001010110110101 Colour depth. 9
Example of an image in binary. 0110101001010011000101010001010100101110101001010101101 10010101010100001011000101011010101010001010100 0101010100010111010101100101010001001100010100101010001101010011101001100010101000101010010111010100101010100010101000010110001010110101010100010101000101010001011101010110010101001101010010100110001010100010101 00101110101001010101010101000101010000101100010101101 010101000101010101010001010101110101011001010100110101011 0101001110100110001010100010101001011101010010101010101 0100010101000010110001010110101010100010101000101010001011101010110010101001101010010100110001010100010101001 011101011101010010101010100010101000010110001010110101000101010101010001010101000101110101011001010100110101011010 10010100110001010100010101001011101010010101010101010 0010101000010110001010110101010100010101000101010 10001011101010110010101001101010010100110001010100010101001011 101011101010010101010100010101000010110001010110101 00010101010101000101010100010111010101100101010011010100110001010100010101001011101010010101010101010001 0101000010110001010110101010100010101000101010100 01011101010110010101001101010010100110001010100010101001011101 0101011101010010101010100010101000010110001010110101000 1010101010001010101000101110101011001010101010000 10101011000101010001010110110101 Resolution. 10
Example of an image in binary. 0110101001010011000101010001010100101110101001010101010000101100010101101010101000101010100010111010101100101010001001100010100101010001 1010101001010011000101010001010100101110101001010101010000101100010101101010101000101010100010111010101100101010011010100101001100010101101 0100010101001011101010010101010101010001010100001011000 1010101010001010101010100010101010001011101010110010 1010011010100101001100010101000101010010111010100101001 0101010101000101010000101100010101101010101000101010100010111010101100101010011010100101001100010 10110101000101010010111010100101010101010100010101000010101 011000101011010101010001010101010100010101011101010 1100101010011010100101001100010101000101010010111010100101010101000101010000101100010101101010101000 101010101010001010101110101011001010100110101001010011 000101010001010100101110101001010101010101000101010000 101010110001010110101010100010101010101000101010111 0101011001010100110101001010011000101010001010100101110101110 101001010010101010100001011000101011010100010101010101010001011101010110010101001101010010100111 010011000101010001010100101110101001010101010101000101 01000010110001010110101010100010101010101000101110101011001010101010000101100010101000101011011010111010101100101010101000010110001010100010101 Image data. 11
Example of an image in binary. 01101010010100110001010100010101001011101010010101010100001011000101011010101010001010100 0101010100010111010101100101010001001100010100101010001101010011101001100010101000101010010111010100101010100010101000010110001010110101010100010101000101010001011101010110010101001101010010100110001010100010101 00101110101001010101010101000101010000101100010101101 010101000101010101010001010101110101011001010100110101011 0101001110100110001010100010101001011101010010101010101 0100010101000010110001010110101010100010101000101010001011101010110010101001101010010100110001010100010101001 011101011101010010101010100010101000010110001010110101000101010101010001010101000101110101011001010100110101011010 10010100110001010100010101001011101010010101010101010 0010101000010110001010110101010100010101000101010 10001011101010110010101001101010010100110001010100010101001011 101011101010010101010100010101000010110001010110101 00010101010101000101010100010111010101100101010011010100110001010100010101001011101010010101010101010001 0101000010110001010110101010100010101000101010100 01011101010110010101001101010010100110001010100010101001011101 0101011101010010101010100010101000010110001010110101000 1010101010001010101000101110101011001010101010000 10101011000101010001010110110101 End of image file message. 12
Using Pixels to create Binary Images We call this pixelated This image is represented in Binary in 1 s and 0 s, as they are the binary digits. The black squares are represented as 1’s and the white squares are represented as 0 s. Would the image change if we used a 16 x 16 grid? Why?
Number of bits The number of pixels we use is known as the resolution So, what affect does increasing the resolution have? On average, computer screens are 1, 366 x 768 pixels which means we can display images from the computer using 1, 049, 088 pixels!
Image sizes Every image has a SIZE and that is known as RESOLUTION. The RESOLUTION is the amount of PIXELS a picture has on the screen. To work out how many pixels you times the Width by the Height. WIDTH (Pixels) X HEIGHT (Pixels) These screen sizes are 1280 by 800 pixels. 1280 x 800 = 1, 024, 000 pixels to cover the whole screen. 1280 800 15
Bitmap Images Colour depth How many bits will be used to store the colour for each pixel in the grid 1 bit allows 2 different values 2 different colours (b&w) 2 bit allows 4 different values 4 different colours 3 bit allows 8 different values 8 different colours . . . 8 bit allows 256 different values 256 different colours 24 bit allows 16, 777, 216 different values 6, 777, 216 different colours The greater the colour depth: • • The more realistic colours The more data needs to be stored and the larger the file size on disk
Colour Depth A black and white image (1 -bit colour depth) A grey scale image (2 -bit colour depth) An image with multiple colours (4 -bit+ colour depth)
Colour Depth The greater the colour depth (bits per A 2 -bit colour depth would allow four different pixel), the more colours are available. values: 00, 01, 10, 11. This would allow for a range of colours such as: Colour depth Available colours Binary code Colour 1 -bit 21 = 2 00 White 2 -bit 22 = 4 01 Light grey 3 -bit 23 = 8 10 Dark grey 4 -bit 24 = 16 11 Black 5 -bit 25 = 32 6 -bit 26 = 64 Colour Depth is 2 times the amount of BITS. 6 Bit = 2 x 2 x 2 x 2 (64)
• • 00 white 01 black 10 Green 11 Red
Direct Colour By mixing the appropriate amount from each of the three colour channels you can get a variety of colours R FF 00 00 80 96 00 FF 80 FF G FF 00 00 FF FF 80 00 B FF 00 FF 96 80 00 00 α 00 00 00 There is a 4 th channel, called the alpha channel which handles transparency What gets stored for each pixel is just a combination of each channel Eg FFFFFF 00 means the pixel is white 96008000 means the pixel is lilac 8 bit gives 256 colours Real life colour needs 15 or 16 bits 24 -bit or “truecolor “gives over 16. 7 million colours
Activity 1 – Test your Knowledge 1. In your own words, explain how a bitmap image can be Understand what pixels are represented in Binary and how the resolution of an and how images are image can change. represented in binary 2. What does pixelated mean? 3. What is Metadata and why does it need to be included in the file? 4. Discuss the effect of colour depth and resolution on the size of an image 5. Which three colours are used to make all three colours on a computer 6. Discuss direct colour and explain how colour is stored this way Understand be able to explain what resolution is and what causes it to change Understand be able to explain why it is important to include metadata in bitmap images and explain what colour depth is.
Plenary Complete the binary representation for the following:
Data Representation Characters
C 2 Text representation • • The purpose and implications of using codes to represent character sets. The features and uses of common character sets: ASCII UNICODE.
Starter Question If you type your name into the keyboard, how does the computer know how to show the correct characters? Watch this video which may help! https: //www. youtube. com/watch? v=Jw. Wo. VQXQ 24 k
Learning Objectives • • • Explain the use of binary codes to represent characters Know the term character set Describe with examples (for example ASCII and Unicode) the relationship between the number of bits
Starter Using these decimal codes, what would the word Computing look like?
What is it? ASCII code represents alphanumeric data in most computers. “American Standard Code for Information Interchange” It works like any other code. One thing represents another. In ASCII, binary is used to represent our numbers, letters and symbols. ASCII includes definitions for 128 characters: 33 are non-printing control characters (many now obsolete) that affect how text and space is processed and 95 printable characters, including space.
Why do we use it? At a very basic level we use ASCII because computers store all information in binary. Therefore we need some way to encode numbers, letters and symbols in binary. At first many different character sets were used, so on one system the code 0100001 would represent A, but on another it could be P, or Y!!!
ASCII This code is called ASCII(American Standard Code for Information Interchange) and is used to allow the computer to understand the characters that have been typed in by a human. The word ‘Computing’ uses the denary codes: 67 111 109 112 117 116 105 110 103 Obviously the computer would recognise these in Binary as: 01000011 01101101 01110000 01110101 01110100 01101001 01101110 01100111 Each character is given a unique binary code and that is how the computer can represent the correct character. You will notice that each character is stored in 8 bits but only uses 7 bits. The 8 th bit can be used as an addition e. g. languages where they need more characters. This is known as ‘Extended ASCII’.
Activity 1 Using the character codes in the table, write a message in binary for the person sat next to you. Swap messages and ask them to decode it! Stretch & Challenge Write your message in Hexadecimal for the other person to work out
Number of bits • ASCII uses 1 byte to store all of the characters needed for the English language. • This gives 256 possible characters which is enough for the English language. However what would other languages use such as Arabic where they have thousands of characters?
Unicode was developed to account for every language in the world. It uses 2 bytes that give us 216 possibilities (65, 536). An example use of this would allow a user from any country to select their language when setting up an operating system. The Unicode character set would account for every language.
Character Set ASCII and Unicode are the most widely used character sets. The term Character set is used to describe the possible characters that can be represented in a computer system.
- Slides: 34