Table of Contents
In this article, you’ll learn about Data Representation in Computer Network and more.
When we use the internet or a local network, we’re sending and receiving different types of data: text, numbers, images, videos, and audio. To understand how this works, we need to know how computers represent these different types of data.
Text Data
- Characters and Codes: Each letter, number, or symbol in text is represented by a unique code. A common standard for this is Unicode, which assigns a number to almost every character used in the world.
- Binary Representation: These codes are then converted into binary digits (bits), which are either 0 or 1. This binary representation is used to store and transmit text data.
Unicode:
It is the universal standard of character encoding. It gives a unique code to almost all the characters in every language spoken in the world. It defines more than 1 40 000 characters. It even defined codes for emojis. The first 128 characters of Unicode point to ASCII characters. ASCII is yet another character encoding format, but it has only 128 codes to 128 characters. Hence, ASCII is a subset of Unicode.
File extensions:
.doc, .docx, .pdf, .txt, etc.
For example:
- Word: H
- Unicode representation: U+0048
Numerical Data
- Binary Conversion: Numbers are directly converted into binary format. For example, the number 10 in decimal is 1010 in binary.
- Number Formats: Different types of numbers, like integers, decimals, and floating-point numbers, have specific ways of being represented in binary.
Number formats:
- Integers
- Date
- Boolean
- Decimal
- Fixed point
- Floating point
Example:
- Number: 780
- Binary representation: 1100001100
Image Data
- Pixels: Images are made up of tiny dots called pixels. Each pixel has a color, which is represented by a combination of red, green, and blue values.
- Binary Representation: The color values of each pixel are converted into binary and stored.
Representation in a computer:
- Grayscale images:
A black-and-white/ Grayscale image consists of white, black, and all the shades in between. It can be considered as just the varying intensity of the White color. The intensity of the white color in a pixel is given by numbers called “Pixel values“. The pixel value in a Grayscale image can be in the range of 0 to 255, where 0 represents Black and 255 represents White, and all the numbers in the interval represent different shades. A matrix is created for the image with pixel values of all the pixels in the image. This matrix is called a “Channel“. - Colored images:
Each pixel comprises three transistors representing three standard colors: Red, Green, and Blue (RGB), Yellow, Cyan, and Magenta (YCM). Any color known can be generated by using these three colors. Based on the intensity of a color in the pixel, three matrices/ channels for each color are generated.
For example, an image consists of only either black or white colors, only one bit will be enough to represent the pixels:
- White – 1
- Black – 0
File extensions:
.jpg, jpeg, .png, etc.
Audio Data
- Sound Waves: Sound is a wave that travels through the air. To represent sound digitally, we measure the amplitude (loudness) of the sound wave at regular intervals.
- Sampling and Quantization: The process of measuring the amplitude at regular intervals is called sampling. The measured values are then rounded to the nearest value in a specific range, a process known as quantization.
- Binary Representation: The quantized values are converted into binary and stored.
File extensions:
.mp3, .m4a, .WAV, .AAC, etc.
Video Data
- Frames: A video is a sequence of still images called frames. Each frame is an image and can be represented as described above.
- Compression: To reduce the size of video files, compression techniques are used. These techniques remove redundant information from the video data.
File extensions:
.mp4, .MOV, .AVI, etc.