A camera detector has an array of 2048 by 2048 pixels and uses a colour depth of 16.
Find the
size of an image taken by this camera in MiB.
1) Multiply number of pixels in vertical and horizontal directions to find total number of pixels =
(2048 × 2048) = 4194304pixels
2) Now multiply number of pixels by colour depth = 4194304 × 16 = 67108864bits
3) Now divide number of bits by 8 to find the number of bytes in the file = (67108864)/8 =
8388608bytes
4) Now divide by 1024 × 1024 to convert to MiB = (8388608)/(1048576) = 8MiB
Lossy Compression.
Lossy file compression results in some loss of detail when compared to the original file. The
algorithms used in the lossy technique have to decide which parts of the file need to be retained
and which parts can be discarded.
For example, when applying a lossy file compression algorithm to: » an image, it may reduce
the resolution and/or the bit/colour depth » a sound file, it may reduce the sampling rate and/or
the resolution.
Common lossy file compression algorithms are:
MPEG-3 (MP3) and MPEG-4 (MP4)
JPEG.
Question:Nancy has captured images of her holiday with her camera. The captured
images are stored as digital photo files on her camera. Explain how the captured images
are converted to digital photo files. [4}
JPEG
When a camera takes a photograph, it produces a raw bitmap file which can be very large in
size. These files are temporary in nature. JPEG is a lossy file compression algorithm used for
bitmap images. As with MP3, once the image is subjected to the JPEG compression algorithm,
a new file is formed and the original file can no longer be constructed.
The JPEG file reduction process is based on two key concepts:
» human eyes don’t detect differences in colour shades quite as well as they detect differences
in image brightness (the eye is less sensitive to colour variations than it is to variations in
brightness)
» by separating pixel colour from brightness, images can be split into 8 × 8 pixel blocks, for
example, which then allows certain ‘information’ to be discarded from the image without causing
any real noticeable deterioration in quality.
Lossless file compression
With this technique, all the data from the original uncompressed file can be reconstructed.
Lossless file compression is designed so that none of the original detail from the file is lost.
Run-length encoding (RLE) can be used for lossless compression of a number of different file
formats:
» it is a form of lossless/reversible file compression
» it reduces the size of a string of adjacent, identical data (e.g. repeated colours in an image)
» a repeating string is encoded into two values:
– the first value represents the number of identical data items (e.g. characters) in the
run
– the second value represents the code of the data item (such as ASCII code if it is a
keyboard character)
» RLE is only effective where there is a long run of repeated units/bits.