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

Fundamental Steps of Digital Image Processing

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Fundamental Steps of Digital Image Processing

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

1

1. Write down the fundamental steps of digital image processing.


Wavelets & Morphological
Colour Image Multiresolution Compression
Processing Processing
Processing

Image Restoration Segmentation

Image
Representation &
Enhancement Knowledge Base Description
Problem
Domain Image Acquisition
Object
Recognition

a. Image Acquisition: It is the first step of image processing. In this stage, an image is given in
the digital form. Pre-processing such as scaling is done.
b. Image Enhancement: In this stage details or features of an image is highlighted. Such as
brightness, contrast, etc.
c. Image Restoration: In this stage, the appearance of an image is improved.
d. Colour Image Processing: This includes colour modelling, processing in a digital domain;
e. Wavelets and Multi-Resolution Processing: In this stage, an image is represented in
various degrees of resolution. Image is divided into smaller regions for data compression and
for the pyramidal representation.
f. Compression: It is a technique, used for reducing the requirement of storing an image.
g. Morphological Processing: It deals with tools, used for extracting the components of the
image.
h. Segmentation: In this stage, an image is a partitioned into its objects.
i. Representation and Description: It follows the output of the segmentation stage. The
output is a raw pixel data which has all points of the region itself. To transform the raw data,
representation is the only solution. Whereas description is used for extracting information's
to differentiate one class of objects from another.
j. Object recognition: The label is assigned to the object, which is based on descriptors.
k. Knowledge Base: Important information of the image is located.
2

2. What is pixel or picture element?


Pixel is the smallest unit of a digital image or display.
A digital image is composed of a finite number of elements each of which has a particular
location or value. These elements are referred to as pixels or image elements or picture
elements.

3. What is an image?
An image is defined as a two-dimensional function F (x, y), where x and y are spatial
coordinates, and the amplitude of F at any pair of coordinates (x, y) is called the intensity of that
image at that point. When x, y, and amplitude values of F are finite, we call it a digital image.

4. Explain neighbours of a pixel.


4-neighbours: A pixel p at (x,y) has 4-horizontal/vertical
neighbours at (x+1,y), (x-1,y), (x,y+1) and (x,y-1). These
are called the 4-neighbours of p: N4(p).
Diagonal-neighbours: A pixel p at (x, y) has 4 diagonal
neighbours at (x+1,y+1), (x+1,y-1), (x-1,y+1) and (x-1,y-
1). These are called the diagonal-neighbours of p: ND(p).
8-neighours: The 4-neighbours and the diagonal
neighbours of p are called 8-neighbours of p: N8(p).

5. Explain connectivity between pixels.


Two pixels are said to be connected:
• if they are adjacent in some sense(neighbour pixels,4/8/m-adjacency)
• if their grey levels satisfy a specified criterion of similarity(equal intensity level)
4-connectivity: Two or more pixels are said to be 4-connected if they are 4-adjacent with each
other.
8-connectivity: Two or more pixels are said to be 8-connected if they are 8-adjacent with each
other.
m-connectivity: Two or more pixels are said to be m-connected if they are m-adjacent with
each other.
3

6. Explain adjacency between pixels.


Let V be the set of intensity values used to define adjacency.
In a binary image, V ={1} if we are referring to adjacency of pixels with value 1. In a grey scale
image, the idea is the same, but set V typically contains more elements.
For example, in the adjacency of pixels with a range of possible intensity values 0 to 255, set V
could be any subset of these 256 values.
4-adjacency: Two pixels p and q with values from V are 4-adjacent if q is in the set N4(p).
8-adjacency: Two pixels p and q with values from V are 8-adjacent if q is in the set N8(p).
m-adjacency(mixed adjacency): Two pixels p and q with values from V are m-adjacent if
q is in N4(p), or q is in ND(p) and the set N4(p)∩N4(q) has no pixels whose values are from V.

7. Explain bilinear interpolation method.


Bilinear interpolation is a method for estimating the value of a function at a specific point,
given its known values at surrounding points. Bilinear interpolation works for 2D data (such as
images) and is an extension of linear interpolation in one dimension.
1. Consider a 2D grid of known data points, with (x1, y1) and (x2, y2) as the coordinates of
two adjacent points along the x-axis, and (y1, y2)
as the coordinates of two adjacent points along
the y-axis.
2. Suppose we want to estimate the value of a
function f(x, y) at an arbitrary point (x, y) within
the rectangle formed by the points (x1, y1), (x2,
y1), (x1, y2), and (x2, y2).
3. Perform linear interpolation in the x-direction for
both pairs of points along the y-axis:
For the bottom pair of points (x1, y1) and (x2, y1),
calculate the interpolated value R1:

For the top pair of points (x1, y2) and (x2, y2), calculate the interpolated value R2:

Now perform linear interpolation in the y-direction using the interpolated values R1 and R2:
The result, f(x, y), is the bilinearly interpolated
value of the function at the point (x, y).
4

8. What is Digitization? Explain its two important steps Sampling and


Quantization.
In Digital Image Processing, signals captured from the physical world need to be translated into
digital form by “Digitization” Process. In order to become suitable for digital processing, an
image function f(x, y) must be digitized both spatially and in amplitude.
This digitization process involves two main processes/steps called:
• Sampling: Digitizing the co-ordinate value is called sampling.
• Quantization: Digitizing the amplitude value is called quantization.

Sampling: Since an analogue image is continuous not just in its co-ordinates (x axis), but also
in its amplitude (y axis), so the part that deals with the digitizing of co-ordinates is known as
sampling. In digitizing sampling is done on independent variable. In case of equation y = sin(x),
it is done on x variable.
Quantization: Quantization is opposite to sampling because it is done on “y axis” while
sampling is done on “x axis”. Quantization is a process of transforming a real valued sampled
image to one taking only a finite number of distinct values. Under quantization process the
amplitude values of the image are digitized.
9. What is 8-bit colour image? For what purpose could it be used?
An 8-bit colour image is a digital image in which each pixel is represented by an 8-bit value,
allowing for 256 possible colours. The pixel value acts as an index into a colour palette or
lookup table, where each index maps to a specific colour defined by an RGB (red, green, blue)
triplet.
Purpose: An 8-bit colour image is used for purposes where memory and bandwidth efficiency
are important, such as in older computer systems, web graphics (e.g., GIF format), icons, and
sprites. It is suitable for images that do not require a wide range of colours, making it ideal for
simple graphics, diagrams, and certain types of animations.
10. What is weber ratio? Show the variation of weber ratio.
In image processing, the Weber ratio is used to model and understand human visual perception
of contrast and brightness differences. It is a measure of the smallest detectable change in
luminance (brightness) relative to the background luminance. Weber Ratio = Δ𝐿/𝐿
Weber ratio varies depending on background luminance:
- At low luminance levels (scotopic vision), it can be higher (around 0.03 - 0.05).
- In moderate light (mesopic vision), it's intermediate.
- In bright light (photopic vision), it tends to be lower (around 0.01 - 0.02).
It reflects how sensitive humans are to changes in brightness under different lighting conditions.
5

11. What is the difference between an image and a scene.


Image Scene
A visual representation captured or generated The actual view of objects and events in the
electronically or photographically. physical environment.
Static and typically two-dimensional. Dynamic and three-dimensional.
Can be manipulated, edited, or processed. Exists independently of any digital or
electronic representation.
Can range from highly realistic to abstract. Represents real-world physical reality.
Exists digitally or in print form. Exists physically in the natural world.
Composed of pixels or elements in a grid. Composed of physical objects and elements.

12. What are the image sensors?


An image sensor is an electronic device that converts an optical image into an electronic signal.
It is used in digital cameras and imaging devices to convert the light received on the camera or
imaging device lens into a digital image.
13. What is image file format? Mention some image file format.
Image Format describes how data related to the image will be stored. Data can be stored in
compressed, Uncompressed, or vector format.
• TIFF (.tif, .tiff): Tagged Image File Format stores image data without losing any data. It is
good for printing and professional printing.
• JPEG (.jpg, .jpeg): Joint Photographic Experts Group is a loss-prone (lossy) format in
which data is lost to reduce the size of the image. It is a very common format and is good for
digital cameras, nonprofessional prints, E-Mail, etc.
• GIF (.gif): Graphics Interchange Format files are used for web graphics. They can be
animated and are limited to only 256 colours, which can allow for transparency.
• PNG (.png): Portable Network Graphics files are a lossless image format. It was designed to
replace gif format as it supports 16 million colours.
• WebP: Google created WebP to replace JPEG as the standard format for images on the web
by shrinking image files to expedite the loading of online pages.
• HEIF: A High Efficiency Image File Format is an image container format which was
standardized by MPEG on the basis of the ISO base media file format to solve some
problems.
6

14. Brightness discrimination is poor at low levels of illumination.


Explain.
This curve shows that brightness
discrimination is poor (the Weber ratio is
large) at low levels of illumination, and it
improves significantly (the Weber ratio
decreases) as background illumination
increase. The two branches in the curve
reflect the fact that at low levels of
illumination vision is carried out by activity
of the rods, whereas at high levels (showing
better discrimination) vision is the function
of cones.

15. Define saturation in digital image.


Saturation is a type of distortion where the recorded image is
limited to some maximum value, interfering with the measurement of bright
regions of the scene.
16. Explain CMY and CMYK colour model.
CMY colour model is a colour model, used in colour printing. CMY refers to the three inks
used in printing: cyan, magenta, and yellow. The CMY model is subtractive. It means that it
subtracts or masks colours from white background of the paper. The ink reduces the reflected
light. White light minus red leaves cyan, white light minus green leaves magenta, and white
light minus blue leaves yellow. White is the natural colour of the paper, while (nearly) black is
made by a full combination of coloured inks.
The CMYK colour model is a subtractive color model, based on the CMY color model, used
in color printing. CMYK refers to the four inks used in printing: cyan, magenta, yellow, and key
(black). The CMYK model is subtractive. It means that it subtracts or masks colours from white
background of the paper. The ink reduces the reflected light. White light minus red leaves cyan,
white light minus green leaves magenta, and white light minus blue leaves yellow.
White is the natural color of the paper, while black results from a full combination of coloured
inks. To save cost on ink, and to produce deeper black tones, unsaturated and dark colours are
produced by using black ink instead of pure mix of cyan, magenta, and yellow.
7

17. How is image represented in digital formats?


A digital image is represented in the imaging and
computer system by numbers in the form of binary
digits, called bits. Here we see the general structure of a
digital image. First, it is divided into a matrix of pixels.
then, each pixel is represented a series of bits.

18. Briefly describe image colour models.


Types of Image Models:
• Primary Coloured Model (Additive Model)
- RGB Model (Red, Green, Blue)
• Secondary Coloured Model (Subtractive Model)
- CMY (Cyan, Magenta, Yellow)
- HSV (Hue, Saturation, Value)
- YIQ (Y – illuminance, IQ – Reflectance/Chrominance)

a. RGB Model: It is the most common coloured model, used in


the processing of image, having three channels that is red,
green, and blue. R + G + B = W (White), It is a primary-
coloured model or additive model.
b. CMY Model: This type of model is widely used in printers,
which is also known as Subtractive Colour Model or Secondary Coloured Model. In this
model, if the value of (C, M, Y) = (1, 1, 1), it means it is a black colour. If (C, M, Y) = (0, 0,
0), then it forms white colour. 1 – (R, G, B) = (C, M, Y)
c. HSV Model: This colour model doesn’t use primary colours directly. Instead of that, it uses
the colours in the way, human eyes perceive them.
d. YIQ Model: It is the most widely used coloured model in television broadcasting. Y →
illuminance. IQ → reflectance/chrominance. It is used in conversion of grey scale images to
RGB color images.

19. Define illuminance and reflectance.


Illuminance: i(x, y) – Object is illuminating in our eyes. Reflectance: r(x, y) – Physical source.
After clicking the image, it is a 2D image, those pixels are proportional to reflectance.
8

20. Write the conversion rules for converting RGB colour model to
HSI colour model and vice-versa.
9

21. Discuss the Hough transform method for edge linking.


The Hough transform is a technique used to detect simple geometric shapes in images. It works
by transforming the image space into a parameter space, where the geometric shapes can be
detected through the identification of patterns in the parameter space.

The Hough transform works by


transforming the image space into a
parameter space. For example, in the
case of detecting lines in images, the
image space is transformed into a
parameter space consisting of two
parameters: the slope and the y-
intercept of the line.

Each pixel in the image space is then mapped to a curve in the parameter space that represents
all the possible lines that could pass through that pixel. The curves in the parameter space are
then analysed to detect the presence of lines in the image.

22. Write short note on DCT (Discrete Cosine Transform).


Discrete cosine transform (DCT) is a transform that is mainly used in compression algorithms.
It transforms data points in a spatial domain into a frequency domain. This makes it easier to
find the repetition of patterns. Like any other transform, it is also invertible. This means we can
return the actual data points if the transforms are given.

Here, the sequence of data is 𝑥(𝑛), with 𝑛=0, 1, 2, …, N. X(k) represents the kth transform.
Applications:
Some of the applications of DCT are as follows:
• Image compression algorithms like JPEG and HEIF.
• Audio file formats like MP3, AAC, and more.
• Video file formats like MPEG.
• Scientists and Engineers also use them for digital signal processing, telecommunications,
and more.
10

23. Write difference between image enhancement and image


restoration.
Image Enhancement Image Restoration
To improve the visual appearance and appeal To reconstruct the image as close to the
of the image. original as possible.
Uses techniques like contrast adjustment, Uses techniques such as de-blurring, noise
sharpening, and smoothing. reduction, and inpainting.
Assumes the image is already of good quality Assumes the image is degraded or corrupted
but can be enhanced. and needs correction.
Includes methods like histogram equalization Includes methods like inverse filtering and
and various filtering techniques. Wiener filtering;
Subjective improvements. Objective corrections.

24. What are image negatives? What is the equation for getting a
negative image?
The negative of an image with gray levels in the range [0, L-1] is obtained by using the negative
transformation, which is given by the expression S = L – 1 – r, where S is the output pixel and r
is the input pixel.
The equation for getting a negative image is S = L – 1 – r.
25. What is spatial domain representation?
An image can be represented in the form of a 2D matrix where each element of the matrix
represents pixel intensity. This state of 2D matrices that depict the intensity distribution of an
image is called Spatial Domain.
11

26. What is quad tree?


Quadtrees are a type of tree data structure where each node in the tree has four children. They
are used for partitioning(dividing) two-dimensional space into smaller sub-spaces. These sub-
spaces or nodes in the tree hold some kind of spatial information. These nodes also have a
threshold for that information and once it’s met it will further divide into four more subspaces.
Quadtrees for image compression
works by recursively dividing the
image into four subspaces with
each holding the average RGB
color and the error determining
that color for its subspaces. The
threshold is set based on that error
and helps the tree determine if a
node should be split further or not.

27. What are the types of noise?


1. Gaussian Noise: It is a statistical noise having a probability density function equal to normal
distribution, also known as Gaussian Distribution or electronic noise. Random Gaussian
function is added to Image function to generate this noise.
2. Impulse Noise: In the discrete world impulse function on a value of 1 at a single location
and In continuous world impulse function is an idealised function having unit area.
a. Salt Noise: Salt noise is added to an image by addition of random bright (with 255-pixel
value) all over the image.
b. Pepper Noise: Pepper noise is added to an image by addition of random dark (with 0-pixel
value) all over the image.
c. Salt and Pepper Noise: Salt and Pepper noise is added to an image by addition of both
random bright (with 255-pixel value) and random dark (with 0-pixel value) all over the
image. This model is also known as data drop noise because statistically it drops the original
data values.
3. Poisson Noise: This noise arises from the statistical nature of electromagnetic waves like X-
rays, visible light, and gamma rays. In medical imaging, the random fluctuation of photon
emissions leads to images with spatial and temporal randomness, known as quantum noise or
shot noise.
4. Speckle Noise: In optical and digital holography, speckle noise degrades image quality with
a granular appearance, caused by random pixel value multiplications across the image.
12

28. What is frequency domain representation?


In frequency-domain methods are based on Fourier Transform of an image. Roughly, the term
frequency in an image says about the rate of change of pixel values.
Many times, image processing tasks are best performed in a domain other than the spatial
domain. Moreover, it is easy to detect some features in a particular domain, i.e., a new
information can be obtained in other domains.
29. Explain mask or kernels.
In image processing, a kernel, convolution matrix, or mask is a small matrix used for blurring,
sharpening, embossing, edge detection, and more. This is accomplished by doing a convolution
between the kernel and an image.
30. What is median filter?
The median filter is a non-linear digital filtering technique, often used to remove noise from an
image or signal. Such noise reduction is a typical pre-processing step to improve the results of
later processing (for example, edge detection on an image). Median filtering is very widely used
in digital image processing because, under certain conditions, it preserves edges while removing
noise, also having applications in signal processing.
31. Explain gray level slicing.
Gray level slicing, also known as intensity slicing or contrast enhancement, is a technique used
in image processing to selectively highlight regions of interest based on their pixel intensity
values. Gray level slicing involves selecting a range of pixel intensity values from the original
image and then highlighting or manipulating only those pixels that fall within this range. This
technique can be used to enhance specific features in an image by increasing the contrast or
emphasizing details within a certain intensity range while potentially suppressing other intensity
values.
32. What is histogram of an image and why is it used for image
processing?
The histogram of a digital image with gray levels in the range [0, L-1] is a discrete function.
Histogram Function: H(rk) = nk where Rk is the kth gray level and nk is the number of pixels
having the gray level Rk
Features of histogram:
• Histogram of an image provides a global description of the appearance of an image.
• Information obtained from histogram is very large in quality.
• Histogram of an image represents the relative frequency of occurrence of various gray
levels in an image.
13

33. What is histogram equalization?


Histogram Equalisation is a technique to adjust contrast levels and expand the intensity range in
a digital image. It tries to enhance the image and helps image processing easier.
Steps:-
1. Convert the input image to a grayscale image.
2. Calculate the frequency of occurrence of each pixel value.
3. Calculate Cumulative frequency of all pixel values.
4. Divide the cumulative frequencies by total number of pixels and multiply them by the
maximum pixel value in the image.
34. Write difference between local and global thresholding?
Local Thresholding Global Thresholding
Applies different thresholds to different Applies a single threshold value to the entire
regions of the image based on local image.
characteristics.
Divides the image into smaller regions Computes a single threshold value based on
(patches) and computes thresholds image-wide statistics or methods.
individually.
Can better preserve fine details and edges May result in loss of detail or over-
within local regions. segmentation in areas with varying intensities.
Used in scenarios like text extraction from Effective for applications like simple object
noisy backgrounds. segmentation.
Adjusts to local variations in illumination and May struggle with images exhibiting uneven
noise. lighting or variations.

35. Write down the usefulness of segmentation.


1. Object Recognition and Identification: It divides an image into regions or objects.
2. Feature Extraction: It allows for the extraction of valuable features such as shape, texture,
and color from segmented regions.
3. Image Analysis: It facilitates analysis by isolating and analysing specific regions of interest.
4. Image Compression: It helps in efficiently compressing images by focusing on relevant
regions and reducing redundancy.
5. Image Enhancement: By isolating and manipulating specific regions, segmentation enables
targeted enhancement techniques to improve overall image quality or emphasize particular
features.
14

36. What is pattern fritting approach?


The pattern fitting approach in image processing involves matching a predefined template to an
image or a specific region within an image to detect and recognize objects or patterns of
interest. It is used for tasks like object detection, template matching, and automated analysis in
various applications.
37. What is the difference between lossy and lossless compression?
Lossy Compression Lossless Compression
Lossy compression is the method which Lossless Compression does not eliminate the
eliminate the data which is not noticeable. data which is not noticeable.
In Lossy compression, A file does not restore In Lossless Compression, A file can be
or rebuilt in its original form. restored in its original form.
In Lossy compression, Data’s quality is But Lossless Compression does not
compromised. compromise the data’s quality.
Lossy compression reduces the size of data. Lossless Compression does not reduce the size
of data.
Algorithms used in Lossy compression are: Algorithms used in Lossless compression are:
Transform coding, Discrete Cosine Transform, Run Length Encoding, Lempel-Ziv-Welch,
Discrete Wavelet Transform, fractal Huffman Coding, Arithmetic encoding etc.
compression etc.
Lossy compression is also termed as Lossless Compression is also termed as
irreversible compression. reversible compression.

38. What is the role of quantization in image compression?


1. Data Reduction: Quantization reduces the number of distinct levels of color or intensity
values used to represent each pixel in an image.
2. Compression Efficiency: By reducing the precision of pixel values, quantization reduces
the amount of data needed to store or transmit the image.
3. Lossy Compression: In lossy compression methods like JPEG, quantization introduces
some loss of image quality by approximating pixel values to the nearest quantization level.
4. Controlled Quality vs. Compression Ratio: Adjusting the quantization levels allows
balancing between image quality and compression ratio, crucial for optimizing file sizes in
multimedia applications.
15

39. Discuss briefly Huffman coding.


Huffman coding is a lossless data compression algorithm. The idea is to assign variable-length
codes to input characters, lengths of the assigned codes are based on the frequencies of
corresponding characters. The variable-length codes assigned to input characters are Prefix
Codes, means the codes (bit sequences) are assigned in such a way that the code assigned to one
character is not the prefix of code assigned to any other character. This is how Huffman Coding
makes sure that there is no ambiguity when decoding the generated bitstream.
There are mainly two major parts in Huffman Coding
• Build a Huffman Tree from input characters.
• Traverse the Huffman Tree and assign codes to characters.
Algorithm:
The method which is used to construct optimal prefix code is called Huffman coding. This
algorithm builds a tree in bottom-up manner. We can denote this tree by T. Let, |c| be number of
leaves. |c| -1 are number of operations required to merge the nodes. Q be the priority queue
which can be used while constructing binary heap.
Algorithm Huffman (c)
{
n= |c|

Q=c
for i<-1 to n-1

do
{

temp <- get node ()

left (temp] Get_min (Q) right [temp] Get Min (Q)

a = left [templ b = right [temp]

F [temp]<- f[a] + [b]

insert (Q, temp)

return Get_min (0)


}
16

40. State the JPEG compression algorithm and draw the schematic
diagram of JPEG compressor.
JPEG stands for Joint Photographic Experts Group. We perform such type of compression to
reduce the size of the file without damaging its quality.

Algorithm of JPEG Data Compression:


1) Splitting – We split our image into the blocks of 8*8 blocks. It forms 64 blocks in which
each block is referred to as 1 pixel.
2) Color Space Transform – In this phase, we convert R, G, B to Y, Cb, Cr model. Here Y is
for brightness, Cb is color blueness and Cr stands for Color redness. We transform it into
chromium colours as these are less sensitive to human eyes thus can be removed.
3) Apply DCT – We apply Direct cosine transform on each block. The discrete cosine
transform (DCT) represents an image as a sum of sinusoids of varying magnitudes and
frequencies.
4) Quantization – In the Quantization process, we quantize our data using the quantization
table.
5) Serialization – In serialization, we perform the zig-zag scanning pattern to exploit
redundancy.
6) Vectoring – We apply DPCM (differential pulse code modelling) on DC elements. DC
elements are used to define the strength of colours.
7) Encoding – In the last stage, we apply to encode either run-length encoding or Huffman
encoding. It converts the image into text and by applying any encoding we convert it into
binary form (0, 1) to compress the data.
17

41. Write short note on wavelet transform.


Wavelet transform is a powerful tool in image processing for analysing and compressing
images. Unlike traditional Fourier transform, wavelet transform allows for both time and
frequency domain analysis. In image processing, wavelet transform breaks down an image into
different frequency components and analyses each component with a resolution matched to its
scale. This ability to represent both high-frequency and low-frequency information separately
makes wavelet transform suitable for tasks like image denoising, compression, and feature
extraction, where different frequencies contribute differently to the image's content and quality.
Multiresolution Analysis: Decomposes images into different scales, capturing details at various
levels of resolution.
• Localization: Provides localized information in both time/space and frequency domains,
ideal for analysing local features and textures.
• Compression: Efficiently compresses images while preserving quality by exploiting sparsity
in the wavelet domain.
• Feature Extraction: Helps extract specific image features based on their frequency
characteristics, aiding in tasks like pattern recognition.
• Applications: Widely used in medical imaging, remote sensing, and image enhancement
(denoising, sharpening).
42. Write short note on LZW compression.
Lempel–Ziv–Welch (LZW) is a very common compression technique. This algorithm is
typically used in GIF and optionally in PDF and TIFF. Unix’s ‘compress’ command, among
other uses. It is lossless, meaning no data is lost when compressing. The algorithm is simple to
implement and has the potential for very high throughput in hardware implementations. It is the
algorithm of the widely used Unix file compression utility compress and is used in the GIF
image format.
• LZW compression uses a code table, with 4096 as a common choice for the number of table
entries. Codes 0-255 in the code table are always assigned to represent single bytes from the
input file.
• When encoding begins the code table contains only the first 256 entries, with the remainder
of the table being blanks. Compression is achieved by using codes 256 through 4095 to
represent sequences of bytes.
• As the encoding continues, LZW identifies repeated sequences in the data and adds them to
the code table.
• Decoding is achieved by taking each code from the compressed file and translating it
through the code table to find what character or characters it represents.

You might also like