Sunday, 4 December 2016

representing images, sound and other data

5a) a bitmap image has resolution 1000 x 400. Calculate the resolution in megapixels.
1000 x 400 = 400,000
B) Each pixel in the image is stored using 16 bits. Calculate the file size in bytes in bytes.
400,000 x 16 = 6,400,000
6,400,000 / 8= 800,000

6a) a bitmap image resolution 2000 x 5000 uses 400 distinct colours. Calculate the size of the file in megabytes /mebibytes
2000x x 5000 = 10,000,000
log(400) / log(2) = 9
10,000,000 x 9 = 90,000,000
90,000,000 / 8 / 1024 / 1024 = 10.7 MiB
B) the image's resolution is increased to 5000 x 5000. Calculate the increase in file size from part a in megabytes to one decimal place / mebibytes
16.1 Mib increase
C) calculate the change in file size from part b if the number if colours is increased to:
i 500
2.2 MiB

glossary

Glossary

Absolute Error - difference between true resultant value and nearest representable value

ADC (Analogue-to-digital converter) - to sample electrical equivalent of sound and convert sample into digital signal using two voltage levels

Algorithm - a process or set of rules to be followed in calculations or other problem-solving operations, especially by a computer.
Analogue Data - data that varies in a continuous manner
Assignment - storing data into a variable, giving that data a memory location

Bitmap - defines a display space and the colour for each pixel or "bit" in the display space

Bits - the smallest unit of data in a computer, has a single binary value: 0 or 1

Bytes - 2nd smallest unit of data, 8 bits or 2 nibbles

Compression - process of reducing the number of bits required to represent data
DAC (Digital-to-analogue converter) - to playback recorded sound

Even Parity - a parity checking mode in which an extra bit, called a parity bit, is set to 1 if there is an even number of 'one' bits in a one-byte data item.

Hz (Hertz) - unit of frequency (used to measure wave frequencies, such as sound waves)
Iteration - also known as looping; process where a set of instructions are repeated until a condition is met
Nyquists Theorem - "sound must be sampled twice its highest analogue frequency in order to extract all of the information from the bandwidth and accurately represent original acoustic energy"

Odd Parity - a parity checking mode in which an extra bit, called a parity bit, is set to 1 if there is an odd number of 'one' bits in a one-byte data item.

Overflow - where the value is too large to be represented using the available number of bits

Pixel - the smallest representable element of an image that can be individually processed

Precision - maximum number of significant digits that can be represented

Pseudocode - a notation resembling a simplified programming language, used in program design

PCM (Pulse-code modulation) - a method used to digitally represent sampled analog signals

Relative Error - absolute error divided by the true resultant value

Resolution - the number of pixels within an image, expressed in terms of horizontal x vertical axis

Selection - also called decision; program takes course of action depending on the answer e.g. if statement.

Sequence - where an action or event leads to the next ordered action in a predetermined order

Underflow - where the value is too small to be represented using the available number of bits

Vector - co-ordinate based image that does not have a reduction in clarity when zoom is increased or decreased


Bubble Sort- a simple algorithm  that compares based off each pair.

Sunday, 20 November 2016

Arrays

when storing a single number you would have declare one integer (Short) variable

to store 3 numbers you would need three variables

an array is a data structure that stores many items using a single variable

a single variable stores one single data item

an array is like lots of boxes held together

Dim numbers(4) as integer
Dim sNames(5) as string

the number in the brakets indicated the size of the array. We always start from zero

Exam marks(0) = console.readline
Exam marks(1) = console.readline
Exam marks(2) = console.readline
Exam marks(3) = console.readline
Exam marks(4) = console.readline

for Index = 0 to 4
    console.writeline(ExamMarks(Index))
    Next Index

the above section of code will print out every time in the array

array processings makes use of for loops

how to enter into an array

for Index = 0 to 4
    console.writeline("Enter exam mark numbers" & Index)
ExamMarks(Index) = console.readline

   Next Index



Representing sound in a computer

analogue data that varies in a continuous matter

analogue-to-digital converter (ADC): to sample electrical equivalent of sound and convert sample into digital signal using two voltage level

to playback recorded sound, use of digital to analogue can vector (DAC)

PCM: form of an analogue signal is produced by an ADC

PAM: pulse aptitude modulation

formula to calculate file size:
file size = sample rate(Hz) x length of recording (seconds) x sampling resolution (Bits)

example

44,000 Hz x 60 seconds x 16 bits = 42,240,000 bits = 5,280,000 bytes
or 5.28 MB or 5.03 MiB

Nyquist's theorem

sound must be sampled at least twice its highest analogue frequency in order to extract all of information from the bandwidth and accurately represent original acoustic energy.

Data Compression

some data files are quite large high resolution or music sampled data high frequency result in several megabytes of data.

compression- process pf reducing the number of bits required to represent data

lossless: often used where the graphic might be changed by another person or where the image contains layers of graphics that need to be kept separate from each other.
no data loss
it is high quality

lossy: offers a higher compression on rotation

run length encoding: a method of compressing data by eliminating repeated data

dictionary based: compression technique is used whem compressing text files

For loops


For Loops

for loops are used when you know exactly how many times the code must be repeated


















this is an example of for loops working, it shows all the values from one number to another.

Sunday, 6 November 2016

Bit Mapped Graphics

pixel: the smallest addressable area of an image

resolution: the number of pixels per unit of measurement

the resolution of an image or VDU screen is expressed as the number of pixels per column
E.g 1024 x 768 = 817,152

Bit mapped graphics

the colour of each pixel is stored as a binary pattern in video memory in a monochrome screen (two colours) Just 1 bit will be needed for each pixel.
0 for white and 1 for black

if 2 bits are used for each pixel then four colours can be stored, for example :
00 - white
01 - blue
10 - red
11 - black

Colour Depth

the colour depth is the number of bits used to re-pressure a single pixel.

if 8 colours was waned then 3 bits would be needed
2 to the power of 3 = 8
2 to the power of 4 = 16
2 to the power of 8 = 256

Bytes required per pixel?

if 16 colours are wanted then we would use 4 bits per pixel
in bytes this would be 1/2 a byte

if 256 colours are wanted then we would use 8 bits per pixel
there would be 1 byte allocated to each pixel

formula for bits in a pixel, if you have N bits, you can store 2^N different colour codes.

Vector

co-ordinates of images are stored as mathematical data.
points are described by relative distance from the origin
objects can be scaled and grouped together by its features