Topic 3 Data Encoding Characters and Images Computer

  • Slides: 20
Download presentation
Topic 3: Data Encoding (Characters and Images) Computer Science

Topic 3: Data Encoding (Characters and Images) Computer Science

Encoding • Computers can only store binary 1’s and 0’s • They can’t store

Encoding • Computers can only store binary 1’s and 0’s • They can’t store anything else • So how can pictures, sounds, video, and more be stored? Encoding: Converting information into a particular form • We use encoding 2 Data: Encoding (Characters & Images)

Encoding • To turn binary into other things, we use encoding schemes • For

Encoding • To turn binary into other things, we use encoding schemes • For example, a certain pattern of bits could represent a character • Scientists come up with these encoding schemes And then program them into computers • We’re looking at two encoding schemes for characters (text) ASCII Unicode 3 Data: Encoding (Characters & Images)

Encoding Characters: ASCII • ASCII stands for the American Standard Code for Information Interchange

Encoding Characters: ASCII • ASCII stands for the American Standard Code for Information Interchange • It’s a table that shows what binary numbers represent what characters • This system turns a single byte into a character 4 Data: Encoding (Characters & Images)

Encoding Characters: ASCII • As it uses a single byte Values can range from

Encoding Characters: ASCII • As it uses a single byte Values can range from 0 to 255 • In standard ASCII Values stop at 127 Most-significant bit is used for error checking • In extended ASCII Values stop at 255 Most-significant bit used for more characters 5 Data: Encoding (Characters & Images)

Encoding Characters: ASCII • These characters are stored as binary numbers • That means

Encoding Characters: ASCII • These characters are stored as binary numbers • That means we can perform the usual arithmetic on them E. g. add ‘a’ and ‘b’ • A good example 6 Subtracting two Data: Encoding (Characters & Images) characters to find the

Encoding Characters: Unicode • Unicode has lots of different implementations: • UTF-8 • UCS-2

Encoding Characters: Unicode • Unicode has lots of different implementations: • UTF-8 • UCS-2 • UTF-16 Most documents use UTF-8 by default (which is similar to ASCII, but allows for non-Latin characters too) 7 Data: Encoding (Characters & Images)

 • State what encoding scheme (ASCII or Unicode) a computer would use for

• State what encoding scheme (ASCII or Unicode) a computer would use for the following characters 8 T 1 - ∑ “New Line” Ã � # Data: Encoding (Characters & Images)

Encoding Images: Bitmaps • Binary needs to be able to represent images • Different

Encoding Images: Bitmaps • Binary needs to be able to represent images • Different ways of doing this • Simplest is using bitmaps Bitmap Created when pixels of an image are mapped to positions in memory that store binary codes representing colour of each pixel 9 Map of bits A spatially mapped array of bits Data: Encoding (Characters & Images) Pixel Smallest addressable area or smallest solid block of colour in an image

Encoding Images: Bitmaps • Each individual pixel represents a single colour • Created from

Encoding Images: Bitmaps • Each individual pixel represents a single colour • Created from binary code • Different images can have different amounts of pixels More pixels usually leads to a better image 10 Data: Encoding (Characters & Images)

Encoding Images: Bitmaps • Changing this resolution can lead to drastic effects in the

Encoding Images: Bitmaps • Changing this resolution can lead to drastic effects in the image Typically shown as Pixel Width x Pixel Height Bitmap Images JPEG, TIFF, PNG, and GIF Not referred to as bitmaps, because of internal compression 11 Data: Encoding (Characters & Images)

Encoding Images: Bitmaps These binary codes set pixel colour Binary codes mapped to a

Encoding Images: Bitmaps These binary codes set pixel colour Binary codes mapped to a bitmapped image 12 Data: Encoding (Characters & Images)

Encoding Images: Bitmap Colour Depth • A bitmap is made up of pixels •

Encoding Images: Bitmap Colour Depth • A bitmap is made up of pixels • Pixels are made up of binary • We can change how large the binary numbers are per pixel • This changes the amount of available colours Called colour depth 13 Data: Encoding (Characters & Images)

Encoding Images: Bitmap Colour Depth • Here are some examples of the same image

Encoding Images: Bitmap Colour Depth • Here are some examples of the same image Just using different colour depths 14 Data: Encoding (Characters & Images)

Encoding Images: Bitmap Colour Depth • They use: 1 -bit 15 12 -bits 24

Encoding Images: Bitmap Colour Depth • They use: 1 -bit 15 12 -bits 24 -bits Data: Encoding (Characters & Images) 32 -bits

Encoding Images: Bitmap Colour Depth • They represent the number of bits per pixel

Encoding Images: Bitmap Colour Depth • They represent the number of bits per pixel Called colour depth 1 -bit 16 12 -bits 24 -bits Data: Encoding (Characters & Images) 32 -bits

Encoding Images: Bitmap Colour Depth • Binary values are encoded to create a single

Encoding Images: Bitmap Colour Depth • Binary values are encoded to create a single colour • They typically follow the same format • Take this example: 0110 17 1101 0110 That’s this colour! Data: Encoding (Characters & Images)

Encoding Images: Bitmap Memory Size • As pixels are made up of binary, images

Encoding Images: Bitmap Memory Size • As pixels are made up of binary, images have a total size Called memory size • Calculated from the following The result is in bytes 18 Data: Encoding (Characters & Images)

 • Calculate the memory size of the following bitmap images Each row uses

• Calculate the memory size of the following bitmap images Each row uses a different colour depth Use an ‘appropriate’ unit for each answer 19 1 -bit 800 x 600 1280 x 720 12 -bit 800 x 600 1280 x 720 24 -bit 800 x 600 1280 x 720 Data: Encoding (Characters & Images)