0% found this document useful (0 votes)
8 views

Lect - 05 C Binary System

Uploaded by

jasonmrode
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Lect - 05 C Binary System

Uploaded by

jasonmrode
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 106

Machine Learning for Signal Processing

EHB 328E

Ibraheem Shayea
Electronics and Communication Engineering Department,
Faculty of Electrical and Electronics Engineering
İstanbul Teknik Üniversitesi - İTÜ
Syllabus 5

Binary System
Part C
Outline

❑ Important of Binary System

❑ Binary System

❑ Numbers in Binary System

❑ Text in Binary System

❑ Image in Binary System

❑ Audio in Binary System


Important of Binary System
Important of Binary System
Why Data Representation in Binary Form?
❑ Computers represent and process data in binary form, which means
using only two digits: 0 and 1.

❑ There are several reasons why binary representation is used:


❑ Simplicity
❑ Data Store in Digital Formats
❑ Compatibility
❑ Standardization
❑ Efficiency
❑ Error Resistance
❑ Compatibility with Digital Devices
Important of Binary System
Why Data Representation in Binary Form?

❑ Simplicity
Binary representation is simple and easy to implement in hardware
and software. Using only two digits makes it easier to design circuits
and algorithms that can process and manipulate data.
Important of Binary System
Why Data Representation in Binary Form?

❑ Compatibility

Binary representation is compatible with the basic hardware


components of computers, such as transistors, which can represent
two states (on and off) that correspond to the two binary digits.
Important of Binary System
Why Data Representation in Binary Form?
❑ Compatibility with digital devices
o Digital devices such as computers, smartphones, and digital cameras all operate using
binary representation.
o By using binary representation, data can be easily exchanged between these devices, and
the devices can all be programmed to read and process data in the same way.
o This makes it easier to create digital ecosystems where devices can communicate and
interact with each other seamlessly, leading to new and innovative applications and
services.
Important of Binary System
Why Data Representation in Binary Form?
❑ Data Store in Digital Formats

Electronic and Computer Devices such as smartphones, and


computers store data in digital formats that can be handled by
electronic circuitry.
Important of Binary System
Why Data Representation in Binary Form?
❑ Standardization

Binary representation is a standardized format that is widely used in


computing systems, making it easier to exchange and process data
between different systems and applications.
Important of Binary System
Why Data Representation in Binary Form?
❑ Error Resistance

Binary representation is less prone to errors than other number


systems, as it is easier to detect and correct errors in binary data.
Important of Binary System
Data Representation in Binary Form

❑ Capability To Represent Various Form of Data


Binary system system can represent various types of Data, such:

❑ Numbers Data Representation


❑ Text Data Representation
❑ Graphics Data Representation
❑ Sound/Audio Data Representation
❑ Video Data Representation
❑ …
Important of Binary System
Why Data Representation in Binary Form?

❑ Capability To Represent Various Form of Data

For Example:
o Numbers is converted from decimal to binary numbers, 0s and 1s.

o Text is often represented using ASCII or Unicode encoding schemes.

o Images are typically stored as a series of pixels, each represented by a


series of bits indicating its colour and intensity.

o ..etc
Important of Binary System
Why Data Representation in Binary Form?

Binary representation is the most efficient and reliable way to


represent and process data in computing systems, and it is the basis for all
modern digital technologies.

Thus

At the lowest level, data is represented as binary code consisting of 0s and


1s, with each bit representing a single piece of information. This binary
code is then used to represent numbers, text, images, and other types of
data, with different encoding schemes used to represent different types of
information.
Binary System
Binary System
What is Binary System ?

❑ Binary System is a “Binary Arithmetic”

❑ Binary System is used in Computers, Electronic and Communication


devices for internal data representation.

❑ Binary System has only two digits (0 and 1), thus computer circuits
only have to handle two binary digits

❑ Data is handled in the computer by electronic/electrical components.


Electronic components operate in binary mode can indicate two states:
o On → 1
o Off → 0
Binary System
What is Binary System ?

❑ Bit (Binary Digit): The smallest unit of data in computing,


representing a binary 0 or 1.

❑ Byte: A group of 8 bits. It is a standard unit for measuring


storage capacity and data size.
Binary System
What is Binary System ?

❑ In all digital devices data stored and/or transmitted by Binary System ?

What kind of unit (s) are / is used ?

Describe the use of Bits and Bytes??


Binary System
What is Binary System ?
❖ Communication Speed
➢Bits and Bytes are broadly used to describe ….??

➢Network Communication Speed (i.e. bps, 100 bps, ..etc


Binary System
What is Binary System ?
❑ Storage Unit
➢ A Byte is the amount of storage required to store one
character from the character set.

➢ Storage Capacity (i.e. kilobyte (KB) is 1,024 bytes, 100 GB,


..etc)
Binary System
Bit ??
❑ Bit is an abbreviation for Binary Digit, which also can be further
abbreviated as a lowercase b.

❑ Bits is used as a measure unit for Data Rates (Throughput) evaluation,


such as Internet connection speeds, and movie download speeds.

o Kilo bits per second ➔ kbps,

o Miga bits per second ➔ Mbps

o Giga bits per second ➔ Gbps

i.e. 1.44 Mbps, 2.8Gbps


Binary System
Bit ??
Name Abbr. Size
Bit bit One binary digit
Byte B 8 bits
Kilo bits K 𝟐𝟏𝟎 = 1,024 bits
Mega bits M 𝟐𝟐𝟎 = 1,048,576 bits
Giga bits G 𝟐𝟑𝟎 = 1,073,741,824 bits
Tera bits T 𝟐𝟒𝟎 = 1,099,511,627,776 bits
Peta bits P 𝟐𝟓𝟎 = 1,125,899,906,842,624 bits
Exa bits E 𝟐𝟔𝟎 = 1,152,921,504,606,846,976 bits
Zetta bits Z 𝟐𝟕𝟎 = 1,180,591,620,717,411,303,424 bits
Yotta bits Y 𝟐𝟖𝟎 = 1,208,925,819,614,629,174,706,176 bits
Binary System
Byte
❑ Byte is a group of bits used to represent a symbol.

❑ Byte consist of 8- bits together.

❑ Byte is usually abbreviated as an uppercase B.

❑ Bytes is used as a measure unit for file sizes and storage capacities.
o Kilo Bytes ➔ kB,

o Miga Bytes ➔ MB,

o Giga Bytes ➔ GB
i.e. file size is 200 kB, Driver Size 80GB, 500GB, 1TB,.. etc
Binary System
Byte
Name Abbr. Size
Bit bit One binary digit
Byte B 8 bits
Kilo Byte K 𝟐𝟏𝟎 = 1,024 Byte
Mega Byte M 𝟐𝟐𝟎 = 1,048,576 Byte
Giga Byte G 𝟐𝟑𝟎 = 1,073,741,824 Byte
Tera Byte T 𝟐𝟒𝟎 = 1,099,511,627,776 Byte
Peta Byte P 𝟐𝟓𝟎 = 1,125,899,906,842,624 Byte
Exa Byte E 𝟐𝟔𝟎 = 1,152,921,504,606,846,976 Byte
Zetta Byte Z 𝟐𝟕𝟎 = 1,180,591,620,717,411,303,424 Byte
Yotta Byte Y 𝟐𝟖𝟎 = 1,208,925,819,614,629,174,706,176 Byte
Binary System
Byte
Name Abbr. Size
Bit bit One binary digit
Byte B 8 bits
Kilo Byte K 𝟐𝟏𝟎 = 1,024 Byte x 8 bits
Mega
M 𝟐𝟐𝟎 = 1,048,576 Byte x 8 bits
Byte
Giga Byte G 𝟐𝟑𝟎 = 1,073,741,824 Byte x 8 bits
Tera Byte T 𝟐𝟒𝟎 = 1,099,511,627,776 Byte x 8 bits
Peta Byte P 𝟐𝟓𝟎 = 1,125,899,906,842,624 Byte x 8 bits
Exa Byte E 𝟐𝟔𝟎 = 1,152,921,504,606,846,976 Byte x 8 bits
Zetta Byte Z 𝟐𝟕𝟎 = 1,180,591,620,717,411,303,424 Byte x 8 bits
Yotta Byte Y 𝟐𝟖𝟎 = 1,208,925,819,614,629,174,706,176 Byte x 8 bits
Numbers in Binary System
Numbers in Binary System
Numbers in Binary form
❑ Numeric Data consists of numbers DECIMAL (BASE 10) BINARY (BASE 2)

that can be used in arithmetic 0 0

operations. 1 1

2 10

3 11
❑ Digital Devices represent numeric 4 100
data using the binary number system. 5 101

6 110

7 111
❑ Number of Digits: In binary
8 1000
representation, numbers are
9 1001
represented using only two digits: 0
and 1. 10 1010
Numbers in Binary System
Value of Each Binary Digit

❑ Value of Each Binary Digit: The position of each digit in a


binary number represents a power of 2, starting from the rightmost
position with a value of 1, then doubling in value for each subsequent
position.
Numbers in Binary System
Value of Each Binary Digit

Example

The position of each digit in a binary the binary number 1010


represents:

1 0 1 0
• 1 × 23 + 0 × 22 + 1 × 21 + 0 × 20

• = 8 + 0 + 2 + 0

• = 10 (in decimal)
Numbers in Binary System
Numbering Systems
There are various Numbering Systems Used in Computer and
Electronic Devices
A. Binary Number System

B. Decimal Number System

C. Octal Number System

D. Hexadecimal Number System


Numbers in Binary System
Numbering Systems
Numbers in Binary System
Numbering Systems

Convert Decimal to Binary Number


Convert Binary to Decimal Number

Convert Octal to Binary Number


Convert Binary to Octal Number

Convert Hexadecimal to Binary Number


Convert Binary to Hexadecimal Number
Numbers in Binary System
Convert Decimal to Binary Number
Method 1
Steps to convert a decimal number into a binary number:
1. Divide the decimal number by 2.
2. Write down the quotient and remainder.
3. Divide the quotient by 2.
4. Write down the new quotient and remainder.
5. Continue dividing the quotient by 2 until the quotient becomes 0.
6. Write the remainders in reverse order to get the binary
representation of the decimal number.
Numbers in Binary System
Convert Decimal to Binary Number
Method 1
Example
Convert the decimal number 13 into binary?

1101
o 13 / 2 = 6, remainder 1
o 6 / 2 = 3, remainder 0
o 3 / 2 = 1, remainder 1
o 1 / 2 = 0, remainder 1

The remainders in reverse order are 1101, so the binary representation of


13 is 1101.
Numbers in Binary System
Convert Decimal to Binary Number
Method 2

Converting Decimal to Binary :

1. Using 8 bits, find largest power of 2 that will “fit” into 35

2. Place a 1 into that slot

3. If it is doesn’t fit, place a 0 into that slot


Numbers in Binary System
Convert Decimal to Binary Number
Method 2
Example
Convert decimal number, 35, to a binary bit stream?

Base 2 representation 27 26 25 24 23 22 21 20
128 64 32 16 8 4 2 1
Decimal representation
0 0 1 0 0 0 1 1
Base 2 representation

𝟎 × 𝟏𝟐𝟖 +
𝟎 × 𝟔𝟒 +
𝟏 × 𝟑𝟐 +
0 0 1 0 0 0 1 1 𝟎 × 𝟏𝟔 + Decimal 35 = 00100011
𝟎×𝟖 +
𝟎×𝟒 +
𝟏×𝟐 +
𝟏×𝟏
= 𝟑𝟓
Numbers in Binary System
Convert Decimal to Binary Number
Example:
Convert the 145 Decimal Number into Binary bit stream?
Answer:

?
Numbers in Binary System
Convert Binary to Decimal Number
Example:
Convert the 145 Decimal Number into Binary bit stream?
Answer:

Base 2 representation 27 26 25 24 23 22 21 20
128 64 32 16 8 4 2 1
Decimal representation

1 0 0 1 0 0 0 1
Base 2 representation

𝑭𝒐𝒓 𝒆𝒙𝒂𝒎𝒑𝒍𝒆: 𝟏𝟎𝟎𝟏𝟎𝟎𝟎𝟏 =

𝟏 × 𝟏𝟐𝟖 + 𝟎 × 𝟔𝟒 + 𝟎 × 𝟑𝟐 + 𝟏 × 𝟏𝟔 + 𝟎 × 𝟖 + 𝟎 × 𝟒 + 𝟎 × 𝟐 + 𝟏 × 𝟏

= 𝟏𝟒𝟓𝟏𝟎
Numbers in Binary System
Convert Binary to Decimal Number

❑ The binary system is a base-2 system.

❑ The Decimal system is a base-10 system.

❑ To express any number in a Binary bas-2 system, powers much like


decimal system.
Numbers in Binary System
Convert Binary to Decimal Number

Multiply each bit by the equivalent base value

𝑩𝒊𝒕 𝑿 𝟐𝒌
Numbers in Binary System
Convert Binary to Decimal Number
Example:
Convert the bit stream of 11010010 to a Decimal Number?
Answer:

?
Numbers in Binary System
Convert Binary to Decimal Number
Example:

Convert the bit stream of 11010010 to a Decimal Number?


Answer:
Binary 1 1 0 1 0 0 1 0
Position 8TH 7TH 6TH 5TH 4TH 3RD 2ND 1ST
Base 2 Representation 𝟐𝟕 𝟐𝟔 𝟐𝟓 𝟐𝟒 𝟐𝟑 𝟐𝟐 𝟐𝟏 𝟐𝟎

Decimal Representation 128 64 32 16 8 4 2 1

For example: 110100102 = 1*128 + 1*64 + 0*32 + 1*16 + 0*8 + 0*4 + 1*2 +0*1 = 21010
Numbers in Binary System
Convert Binary to Decimal Number
Example:
Convert the bit stream of 10101110 to a Decimal Number?
Answer:

?
Numbers in Binary System
Convert Binary to Decimal Number
Example:
Convert the bit stream of 10101110 to a Decimal Number?
Answer:

Binary 1 0 1 0 1 1 1 0
Position 8TH 7TH 6TH 5TH 4TH 3RD 2ND 1ST
Base 2 Representation 27 26 25 24 23 22 21 20
Decimal Representation 128 64 32 16 8 4 2 1

10101110 = 128 + 32 + 8 + 4 + 2 = 174


Numbers in Binary System
Convert Octal to Binary Number
❑ Because each octal digit can be represented by a 3-bit binary
number, it is very easy to convert from octal to binary.

❑ An octal number can be converted into its binary equivalent by


replacing each octal digit with its three-bit binary equivalent

❑ Octal to Binary Conversion

Octal Digit 0 1 2 3 4 5 6 7
Binary 000 001 010 011 100 101 110 111
Let’s convert the octal numbers 25 and 140.
2 5 1 4 0
010 101 001 100 000
Numbers in Binary System
Convert Binary to Octal Number
Conversion of a binary number to an octal number is the reverse of the octal-to-binary
conversion.

A binary number can be converted into an equivalent octal number by splitting the
integer and fractional parts into groups of three bits, starting from the binary point on
both sides. The 0s can be added to complete the outside groups if needed.

Example:
Let’s convert the following binary numbers to octal:
Example 1 :
110 101
6 5 = 65
Example 2 :
101111001
Numbers in Binary System
Convert Hexadecimal to Binary Number
❑ A hexadecimal number can be converted into its binary equivalent by
replacing each hex digit with its four-bit binary equivalent.

Find the binary equivalent of (17E.F6)16 and the hex equivalent of


(1011001110.011011101)2.

The given hex number = (17E.F6)16

The binary equivalent = (0001 0111 1110.1111 0110)2=


(000101111110.11110110)2= (101111110.1111011)2
Numbers in Binary System
Convert Binary to Hexadecimal Number
❑ A given binary number can be converted into an equivalent hexadecimal
number by splitting the integer and fractional parts into groups of four
bits, starting from the binary point on both sides. The 0s can be added to
complete the outside groups if needed.

Find the hex equivalent of (1011001110.011011101).

The given binary number = 1011001110.011011101


= 10 1100 1110.0110 1110 1

The hex equivalent = 0010 1100 1110.0110 1110 1000


= 2 C E . 6 E 8
= 2CE.6E8
Numbers in Binary System
Addition in Binary System

❑ There are only four rules for addition in binary:

o 0+0=0;

o 0+1=1;

o 1 + 0 = 1;

o 1 + 1 = 10
Numbers in Binary System
Subtraction in Binary System

❑ There are only four rules for subtraction in binary:

o 0-0=0

o 0-1=?

o 1-0=1

o 1-1=0
Text in Binary System
Text in Binary System
Representing Text in Binary Systems

❑ Character data is composed of letters, symbols, and numbers that


are not used in calculations.

❑ Character data is commonly referred to as “text.”

❑ Examples of character data include name, address, hair color, and so


many other things.
Text in Binary System
Representing Text in Binary Systems

Character data refers to any type of data that consists of


characters, which can include letters, numbers, symbols, and
punctuation marks.

Character data is commonly used to represent text, such as words,


sentences, paragraphs, and entire documents.
Text in Binary System
Representing Text in Binary Systems

❑ Character Unique Code


o Each character has a unique code or sequence of bits to represent it.
o As each character is entered from a keyboard it must be converted into its binary
code.

❑ Representation of Digital Data


The 0s and 1s used to represent digital data are referred to as binary digits from this
term we get the word bit that stands for binary digit.

❑ Digital File
A digital file, usually referred to simply as a file, is a named collection of data that
exits on a storage medium, such as a hard disk, CD, DVD, or flash drive.
Text in Binary System
Digital Files
❑ DOCX format : Microsoft Word produces
formatted text and creates documents in
DOCX format.

❑ PDF format : Adobe Acrobat produces


documents in PDF format.

❑ HTML : HTML markup language used for


Web pages produces documents in HTML
format.
Text in Binary System
Type of Characters

❑ The keyboard holds the character set which includes:

o Alphabet in upper and lower case

o Numbers from 0 to 9

o Characters - space, &, %, £, €, ½, ? Etc.


Text in Binary System
Procedure
How Letter is converted into a binary form and back to a Letter?

Step 1. Step 2.
Presses the capital An electronic signal for the
letter D on the capital letter D is sent to the
keyboard. system unit.

Step 3.
Step 4.
The signal for the capital letter D is
After processing, the binary code for the
converted to its ASCII binary code
capital letter D is converted to an image,
(01000100) and is stored in memory
and displayed on the output device.
for processing.
Text in Binary System
Methods of Representing Character
Digital Devices employ several types of codes to represent character
data. The most three popular coding Methods to represent data are:

The most three popular coding Methods to represent data are:

❑ ASCII : American Standard Code for Information Interchange

❑ EBCDIC: Extended Binary Coded Decimal Interchange Code

❑ Unicode : Coding scheme capable of representing all world’s


languages
Text in Binary System
Methods of Representing Character

❑ ASCII : American Standard Code for Information Interchange


o ASCII−7
o ASCII−8

❑ EBCDIC: Extended Binary Coded Decimal Interchange Code

❑ Unicode
o Coding scheme capable of representing all world’s languages

o Unicode (pronounced “YOU ni code”) uses sixteen bits and


provides codes or 65,000 characters.
Text in Binary System
Methods of Representing Character

Each character has a unique code or sequence of bits to represent it.

As each character is entered from a keyboard it must be converted into its


binary code.
Text in Binary System
Methods of Representing Character
Example for representing samples by

❑ ASCII

❑ EBCDIC

ASCII Symbol EBCDIC

00110000 0 11110000
00110001 1 11110001
00110010 2 11110010
00110011 3 11110011
Text in Binary System
ASCII
❑ ASCII: American Standard Code for Information
Interexchange

o ASCII is extensively used in computers.

o There are two types of ASCII codes:

▪ ASCII−7

▪ ASCII−8
Text in Binary System
ASCII
ASCII-7
ASCII-7 is a 7-bit standard ASCII code.

❖ In ASCII-7, the first 3 bits are the zone


bits and the next 4 bits are for the
digits.

❖ ASCII-7 allows 2^7 = 128


combinations.

❖ 128 unique symbols are represented


using ASCII-
Text in Binary System
ASCII
ASCII-8 is an extended version of ASCII-7.
❖ ASCII-7 has been modified by IBM to ASCII-8

❖ ASCII-8 is an 8-bit code having 4 bits for zone and 4 bits for the digit.

❖ ASCII-8 allows 2^8 = 256 combinations.


❖ ASCII-8 represents 256 unique symbols.
❖ The ASCII-8 code represents 256 symbols.
» Codes 48 to 57 stand for numeric 0−9.
» Codes 65 to 90 stand for uppercase letters A−Z.
» Codes 97 to 122 stand for lowercase letters a−z.
» Codes 128 to 255 are the extended ASCII codes.
Text in Binary System
ASCII
Methods of Representing Character Representing Codes in Binary Systems
ASCII-7 ASCII-8
Text in Binary System
ASCII
Character in Binary System

How to Convert Text Character to Binary in steps:

1. Get Character.

2. Get Decimal Code of character from ASCII table.

3. Convert Decimal to Binary Byte.

4. Continue with next character.


Text in Binary System
Size of Character

❖ Based on ASCII, one character will occupy 1 Byte of storage


space.

❖ Thus, A sequence of 8-Bits (0’s and 1’s) is allocated to each


character.
Text in Binary System
Size of Character
Example:
Assume we use ASCII-8 method:
o What is the size of B41 in Bytes and bits?

o What is the size of Communication in Bytes and bits?

o What is the size of Design and Communications Graphics in


Bytes and bits?
Answer:
?
Text in Binary System
Size of Character
Example:
o What is the size of B41 in Bytes and bits?

o What is the size of Communication in Bytes and bits?

o What is the size of Design and Communications Graphics in Bytes and bits?

Answer:
o B41 is 3 Bytes long

o Communication is 13 Bytes long

o Design and Communications Graphics is 34 Bytes long (the 3 spaces count)


Text in Binary System
Binary Coding Schemes (Methods)
Character in Binary System

?
Text in Binary System
Binary Coding Schemes (Methods)
Character in Binary System

ASCII-8

Data Steam
Text in Binary System
Exercise
Utilizing ASCII/UTF-8 :
A.What is the size of “Hello, How are you? ” in Bytes and bits?

B. Covert the following sentence “Hello, How are you? ” to a Binary Code?

???
Text in Binary System
Exercise
Utilizing ASCII/UTF-8 :
A.What is the size of “Hello, How are you? ” in Bytes and bits?

Answer:

“Hello, How are you? ” needs 19 Bytes long to be saved at storage


Text in Binary System
Exercise
Answer:
H: ASCII 72 -> Binary: 01001000
e: ASCII 101 -> Binary: 01100101
l: ASCII 108 -> Binary: 01101100
l: ASCII 108 -> Binary: 01101100
o: ASCII 111 -> Binary: 01101111
, (comma): ASCII 44 -> Binary: 00101100
(space): ASCII 32 -> Binary: 00100000
H: ASCII 72 -> Binary: 01001000
o: ASCII 111 -> Binary: 01101111
w: ASCII 119 -> Binary: 01110111
(space): ASCII 32 -> Binary: 00100000
a: ASCII 97 -> Binary: 01100001
r: ASCII 114 -> Binary: 01110010
e: ASCII 101 -> Binary: 01100101
(space): ASCII 32 -> Binary: 00100000
y: ASCII 121 -> Binary: 01111001
o: ASCII 111 -> Binary: 01101111
u: ASCII 117 -> Binary: 01110101
?: ASCII 63 -> Binary: 00111111
Now, concatenate all these binary representations together to form the binary code for the entire
sentence:

01001000 01100101 01101100 01101100 01101111 00101100 00100000 01001000 01101111


01110111 00100000 01100001 01110010 01100101 00100000 01111001 01101111 01110101
00111111

This is the binary representation of the sentence "Hello, How are you?" using ASCII/UTF-8
encoding.
Text in Binary System
Exercise
Answer:

Text Character encoding

hello, How are you? ASCII/UTF-8

01001000 01100101 01101100


01101100 01101111 00101100
00100000 01001000 01101111
01110111 00100000 01100001
Binary Code 01110010 01100101 00100000
01111001 01101111 01110101
00111111
Graphics in Binary System
Graphics in Binary System
Representing Graphics in Binary System

To process images in a computer and


electronic devices, it must be represented
as binary codes.
Graphics in Binary System
Methods of Representing Graphics
There are many methods that can be used for representing graphics
graphics in a binary system. Here are a few:

• Bitmap or Raster Graphics Will be explained as an example

• Vector Graphics

• Run-Length Encoding (RLE)

• Binary-Coded Decimal (BCD)

• Gray Code
Graphics in Binary System
Bit Mapped Graphics
Concept
❑ An image can be represented as a map of binary codes

❑ Image is divided into a grid of pixels (Smal Picture Elements).

❑ Each pixel is an individual point on the screen

❑ In a black and white image, only 1 Bit is needed to represent each pixel as the
pixel can only be black or white.
Graphics in Binary System
Bit Mapped Graphics
Example
In this example: Black and White Pixels Image 8x8 grid
❑ It is assumed that only black and white pixels in the image
❑ Black pixel represented by (1) in the BIT MAP of the image
❑ White pixel represented by (0) in the BIT MAP of the image
Pixel Pattern with 8x8 grid BIT MAP
Graphics in Binary System
Bit Mapped Graphics
Example
In this example: Black and White Pixels Image 10X10 Grid

Pixel Pattern with 10x10 Grid BIT MAP


Graphics in Binary System
Bit Mapped Graphics
Resolution Impact
❑ The quality of the image depends on the number of pixels.

❑ More pixels means higher resolution and clearer image

Pixel Pattern using 8x8 Grid Pixel Pattern using 16x16 Grid
There is a one to one correspondence between pixels and bits
Graphics in Binary System
Bit Mapped Graphics
Colour Image
❑ The main difference between black-white and a colour image is the
number of Bits needed to represent each pixel

❑ In 24-bit colour, 24 Bits are needed for each pixel etc.


Graphics in Binary System
Bit Mapped Graphics
Colour Image
❑ Pixel Grid

❑ Color Channels
o Red Channel (8 bits): Represents the intensity of red color.
o Green Channel (8 bits): Represents the intensity of green color.
o Blue Channel (8 bits): Represents the intensity of blue color.
RGB stands for Red, Green, and Blue
❑ BinaryValues

❑ Combining Channels

❑ Repeating for Each Pixel


Graphics in Binary System
Bit Mapped Graphics
Colour Image
❑ Pixel Grid

o Pixel: The image is divided into a


grid of small squares, each of
which is a pixel.

o Grid Dimensions determine


the resolution of the image.

o Number of Pixels in the grid


depends on the image's width and
height.
Graphics in Binary System
Bit Mapped Graphics
Colour Image
❑ Color Channels
o In most cases, color images are represented
using the RGB color model.
o Each pixel is composed of three color channels: Red,
Green, and Blue.

o Each of these channels typically uses 8 bits (1 byte) to


represent the intensity of the respective color
component.

o For each channel, the binary value indicates the


intensity of that color at a specific pixel.
1. Red Channel (8 bits): Represents the intensity
of red color.
2. Green Channel (8 bits): Represents the
intensity of green color.
3. Blue Channel (8 bits): Represents the intensity
of blue color.
Graphics in Binary System
Bit Mapped Graphics
Colour Image
❑ BinaryValues
o The binary values for each channel
typically range from 0 to 255 (2^8 -
1) to represent the possible
intensities.

o For example:
• A binary value of 00000000 (0
in decimal) in the red channel
represents no red

• A binary value of 11111111


(255 in decimal) represents the
maximum intensity of red.
Graphics in Binary System
Bit Mapped Graphics
Colour Image
❑ Combining Channels
o To determine the color of a pixel,
the binary values of the red,
green, and blue channels are
combined.

o The combination of these color


intensities results in a specific
color.

o The specific binary values of the


RGB channels are concatenated
to form a pixel's binary
representation.
Graphics in Binary System
Bit Mapped Graphics
Colour Image
❑ Repeating for Each Pixel
o This process is repeated
for each pixel in the grid
to represent the entire
image in binary.

o The order of channels


(RGB or BGR, for
example) depends on the
specific image file format.
Graphics in Binary System
Bit Mapped Graphics
Colour Image

❑ Bitmapped image: in Bitmapped image the bits used to represent the


image are arranged into a grid of Bits

❑ A more complex image is shown below and the grid and map of Bits is
clearly visible:
Graphics in Binary System
Bit Mapped Graphics
Resolution and Memory Storage
Assume that you have an image with 4 inches x 6 inches. The resolution is 300 d.p.i.
(dots per linear inch) and the image is black and white. Calculate the memory
requirements

Calculate the size of this image ?


Graphics in Binary System
Bit Mapped Graphics
Resolution and Memory Storage
Assume that you have an image with 4 inches x 6 inches. The resolution is 300 d.p.i.
(dots per linear inch) and the image is black and white. Calculate the memory
requirements

Length: 6 x 300 = 1800 pixels


Breadth: 4 x 300 = 1200 pixels
Total no pixels = 1800 x 1200 = 2 160 000 pixels
(1 or 0) means 1 bit per pixel

𝟐 𝟏𝟔𝟎 𝟎𝟎𝟎
𝑺𝒕𝒐𝒓𝒂𝒈𝒆 = 𝟐 𝟏𝟔𝟎 𝟎𝟎𝟎 𝒃𝒊𝒕𝒔 = 𝒃𝒚𝒕𝒆𝒔 = 𝟐𝟕𝟎 𝟎𝟎𝟎 𝒃𝒚𝒕𝒆𝒔 = 𝟐𝟔𝟑. 𝟒 𝑲𝑩𝒚𝒕𝒆𝒔
𝟖
Audio in Binary System
Audio in Binary System
Representing Sound in Binary Systems
❑ Analogue sound is represented as a wave.
Audio in Binary System
Representing Sound in Binary Systems
To process sound in a computer and digital electronic devices, it must be
represented as binary codes. So, Sound is converted and stored in a binary
form.
Audio in Binary System
Representing Sound in Binary Systems
❑ To represent the varying values of a sound wave by a binary code, the
amplitude of wave must be Sampled

❑ Sampling Intervals
o Sampling is taken at regular time intervals, for example, one
sample is taken in every 30 milliseconds.
o This step reduces the continuous time domain into a series of
discrete intervals.

❑ The number of samples taken in a second is called the sampling rate

❑ Each Sample represented by a binary codes.


Audio in Binary System
Sampling Concept

❑ Sampling is the process of changing the analogue signal to a samples

❑ Sampling: is the process of measuring the amplitude of a continuous-


time signal at discrete instants. It converts a continuous-time signal to a
discrete-time signal, as illustrated in Figures.

Signal waveform Sampled waveform

0
1 201
0
1 201

Impulse sampler

0
1 201

Figure: General Sampling Method


Audio in Binary System
Sampling Concept

Signal(mt) Spectrum of
Unsampled
Signal M(f)
Freq
Sampling pulses
fs 2fs 3fs

Spacing = 1/fs Spectrum of Sampling Pulses

Samples
fs 2fs 3fs

Time
Spectrum of Sampled Signal
Figure: General Sampling Method
Audio in Binary System
Sampling Process
Audio in Binary System
Sampling Rate
The sampling rate is chosen properly in relation to the bandwidth
of the message signal, so that the sequence of samples uniquely
defines the original analog signal.
Audio in Binary System
Sampling Rate
Audio in Binary System
Sampling Rate
Audio in Binary System
Sampling Rate
Audio in Binary System
Sampling Rate
Sampling Rate
Audio in Binary System
Representing Sound in Binary Systems
❑ Pulse Code Modulation (PCM)
o PCM is a widely used method for encoding analog audio into digital form.
o It samples the analog audio waveform at regular intervals and quantizes each
sample into a binary value.
o The bit depth (e.g., 8-bit, 16-bit, 24-bit) determines the range of values each
sample can have, which in turn affects the audio quality.

❑ Linear Pulse Code Modulation (LPCM)


o Similar to PCM, LPCM is a method that samples and quantizes audio, but it uses
a linear quantization approach.
o It is often used in digital audio formats like WAV and AIFF.

❑ Adaptive Differential Pulse Code Modulation (ADPCM)


o ADPCM is a form of audio compression that encodes the difference between
consecutive audio samples rather than each sample individually.
o It's used in some audio file formats to reduce file size.
The End

Thank You

You might also like