Download TextandImages

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Text and Images
Key Revision Points
Text - ASCII
 The problem:
 Representing text strings, such as “Hello world”, in a computer
 Character set maps letters (or symbols) to numeric values which can be stored as
binary numbers
 One common coding system/character set is ASCII
 7-bit code - 8th bit is unused (or used for a parity bit) – still requires one byte of storage
per character
 2^7 = 128 codes = 128 unique characters can be represented in the basic ASCII
character set
Text – Extended ASCII and Unicode
 Extended ASCII uses all 8 bits – 2^8 -128 codes = 128 unique characters can be
represented in the extended ASCII character set
 Still not enough e.g. no £ sign or “foreign” characters
 The Unicode character set uses 16 bits per character.
 Therefore, the Unicode character set can represent 216, or over 65 thousand characters
Text - Next In Sequence…
 “What is the binary value of the next ASCII letter in the sequence. A=1000001, B=1000010,
E=????”
 To get the answer:
 Convert to denary first
 E.g. 1000001=65, 1000010=66…
 Work out next denary number(s) in sequence e.g. C=67, D=68, E=69
 Convert to binary E.g. E= 69 = 1000101
Images
 Bitmap images are made up of individual pixels (picture elements).
 In memory or storage the colour of each pixel is represented as a binary number.
 The image is therefore stored as a series of binary numbers
 Colour depth or bit depth describes how many memory bits are used to store the colour of
each pixel
Images – Bit Depth
 The more bits you use for storing data about each pixel the more unique colours an image
can have:
 A 1 bit image can only have 2 colours
 An 8 bit image can have 256 colours
 A 24 bit image can have 16 million + colours!
Images – Bit Depth
1 bit – 2 unique colours
0
0
1
1
0
1
0
0
1
1
0
0
1
0
1
1
0
2 bit – 4 unique colours
0
00
01
01
00
01
10
11
01
01
11
10
01
00
01
01
00
4 bit – 16 unique colours
0000
0100
1000
1100
0001
0101
1001
1101
0010
0110
1010
1110
0011
0111
1011
1111
Formula
 Max. number of unique colours = 2 to the power of bits
 E.g. 4 bit image = 2 ^ 4 = 16 colours
 E.g. 8 bit image = 2 ^ 8 = 256 colours
Resolution
 Resolution is the number of pixels in an image.
 Higher resolution  better quality images
 Lower resolution  pixilation
 Measured in PPI (pixels per inch)
 40PPI means 1600 pixels in a one inch square
 80PPI means 6400 pixels in a one inch square
File Size
 The higher the bit (colour) depth and resolution the bigger the file
 Theoretically we can calculate the size of an image file e.g. 1 inch 40PPI image using a bit
depth of 4
 40 x 40 pixels = 1600 pixels in total. Each pixel requires 4 bits so 4 x 1600 = 6400bits
 To convert to bytes divide by 8 (8 bits in a byte). 6400 bits = 800 bytes
 In reality the file will be bigger as it also needs to contain metadata – data about the image
 File format
 Height
 Width
 Colour depth
 Resolution
Without this info the image wont be displayed correctly
Textbook
 Textbook pages 72-73