5.6. Representing Images, Sound and Other Data
5.6. Representing Images, Sound and Other Data
www.pmt.education
Specification:
www.pmt.education
4.5.6.6 Vector graphics versus bitmapped graphics:
Compare the vector graphics approach with the bitmapped graphics
approach and understand the advantages and disadvantages of each.
Be aware of appropriate uses of each approach.
4.5.6.10 Encryption:
Understand what is meant by encryption and be able to define it.
Be familiar with Caesar cipher and be able to apply it to encrypt a
plaintext message and decrypt a ciphertext. Be able to explain why it is easily
cracked.
Be familiar with Vernam cipher or one-time pad and be able to apply it
to encrypt a plaintext message and decrypt a ciphertext. Explain why Vernam
cipher is considered as a cypher with perfect security.
Compare Vernam cipher with ciphers that depend on computational
security.
www.pmt.education
Bit patterns, images, sound and other data
● Digital signal traces are characterised by sharp edges and vertical drops
● Analogue signals tend to be smooth curves
Analogue/digital conversion
www.pmt.education
Analogue to digital conversion
● Sensors like temperature sensors and microphones output an analogue signal
● Computers use analogue to digital converters to convert the analogue signal to a
digital bit pattern.
● The device takes a reading of an analogue signal at regular intervals and records
the value in a process called sampling
● Samples are taken at a specific frequency, given in Hertz
● This determines the number of samples taken per second
● Greater sampling frequencies result in a better reproduction of an analogue signal
Bitmapped graphics
● Images are broken into pixels
● Each pixel is assigned a binary value
● The value assigned to a pixel determines the colour of the pixel
● An image’s resolution can be expressed as a number of dots per square inch,
where a dot is a pixel
● Resolution can also refer to the number of pixels in an image
● The number of bits assigned to a pixel is called the image’s colour depth
● The number of different colours that can be represented by n pixels is 2n
● To calculate the storage required for a bitmap image, multiply the number of pixels
by the bit depth
● This produces a minimum value as files may also contain metadata such as the
image’s width, height, date created or colour depth
Vector graphics
● Geometric objects and shapes are used to create images
● Properties f or each geometric object or shape in the image are stored in a list
Can be scaled without losing quality Become blurry or even pixelated when
enlarged
Well suited to simple images which use Used for storing photographs
shapes but no good for photographs
Frequently use less storage space than Often use more storage space than vector
bitmapped graphics graphics
www.pmt.education
Digital representation of sound
Benefits of MIDI
● MIDI allows easy manipulation of music without loss of quality
● The instruments on which notes sound can be changed
● Notes can be transposed
● The duration of notes can be altered
● MIDI files are often smaller than sampled audio files
Drawbacks of MIDI
● MIDI can't be used for storing speech
● MIDI sometimes results in a less realistic sound than sampled recordings
www.pmt.education
Data compression
Lossy compression
● Files are reduced in size
● Some information is lost in the process
● The quality of a file is reduced
● There is no limit to the amount of compression that can be applied
Lossless compression
● Files are reduced in size
● No information is lost
● The quality of a file remains the same
● There is a limit to the amount of compression that can be applied
● Two methods are run length encoding and dictionary-based methods
● Both methods are most effective on files that contain lots of repeated data
Dictionary-based methods
● A dictionary containing repeated data is appended to the file
● Results is a significant reduction in size
● The dictionary used to compress the data must be present in the file
● This will increase the size of the compressed file
www.pmt.education
Encryption
Caesar ciphers
● Encrypt information by replacing characters
● One character is always replaced by the same character
● There are two types of Caesar cipher - shift ciphers and substitution ciphers
● Can be easily cracked
Shift ciphers
● All letters in the alphabet are shifted by the same amount
● This amount forms the key
● Can be cracked as soon as one letter’s replacement is discovered
Substitution ciphers
● Letters are randomly replaced
● A little better than shift ciphers but still relatively easy to crack
Vernam ciphers
● An example of a one-time pad cipher
● Each key should only ever be used once
● The key must be random
● The key must also be at least as long as the plaintext
● Works by:
1. Aligning the characters of the plaintext and the key
2. Converting each character to binary
3. Applying the XOR operation to the bit patterns
4. Converting the result back to a character
● The only cipher mathematically proven to be completely secure
Computational security
● All ciphers other than the Vernam cipher are crackable
● But not within a reasonable timeframe given current computing power
www.pmt.education