1. Image compression refers to the reduction of the amount of data required to represent a digital image.
2. By removing one or more of the three basic data redundancies, compression can be achieved.
3. Redundancies may be:
a. Coding redundancy
b. Interpixel redundancy
c. Psychovisual redundancy
4. Image compression systems comprises an encoder and a decoder.
5. Image f(x,y) is fed into the encoder which creates a set of symbols from the input data and uses them to
represent the image with compression.
6. Compression that is achieved can be numerically quantified via
CR = n1/n2
7. Function imratio can be used to compute the ratio of the number of bits
used in the representation of the two image files or variables, having
Cr = imratio (f1, f2)
8. Function bytes return the number of bytes in the input image, having
b = bytes (f)
9. To view or use the compressed image, it must be fed into a decoder and
reconstructive output image can be obtained.
10. The reconstructive output mage is not an exact replication of original
11. But if it is, the system is called error free, information preserving or
lossless and if not, is called lossy compression with error e (x, y).
12. Function compare can be used to compute and display the error
between two matrices.
rmse = compare (f1, f2, scale)
1. The statistical dependencies among the neighbouring pixels causes a
redundancy called coding redundancy.
2. Each fixed length pixel is used to code the uncompressed image.
3. The average input per source output is called the entropy of the source.
4. If an image is emitted by a gray-level source, the gray-level histogram of
an observed image is used to model the source symbol probabilities and
generate an estimate called the first-order estimate.
5. Function entropy can be used to compute the first-order estimate of a
matrix, having syntax:
h = entropy (x, n)
1. The smallest possible number of code symbols per source symbol is
contained by Huffman codes when coding the gray levels of an image or
output of a gray-level mapping operation.
2. The first step is to create series of source reductions.
3. The second step is to code each reduced source.
4. The function huffman is used to implement the source reduction and
code assignment procedures, having syntax:
CODE = huffman (p)
5. All MATLAB global variables must be declared in the function using the
global x y z
6. Function cell is used to initialize the CODE, having syntax:
X = cell (m, n)
7. The function sort is used to sort the vector in ascending order of
probability at each iteration, having syntax:
[y, i] = sort (x)
8. The output is generated by using functions celldisp and cellplot as:
or, cellplot (s)
9. The final step is calling the makecode function as
makecode (s, )
1. It results from correlations between the pixels of an image or between
the pixels of neighboring images in a sequence of images.
1. Associated with real or quantifiable visual information.
2. There is a loss of quantitative information due to elimination of
psychovisual redundant data, it is called quantization.
3. Function quantize is used to quantize the elements of the matrix, having
y = quantize (x, b, type)
4. Improved gray-scale quantization method is used to recognize the eye’s
inherent sensitivity to edges and breaks them up by adding to each pixel
a pseudorandom number.
1. JPEG (Joint Photographic Experts Group) standard is one of the continuous tone, still frame compression
2. The first step is to subdivide the input image into non-overlapping pixel blocks of size 8*8.
3. As each 8*8 block or subimage is processed, its 64 pixels are level
shifted by subtracting 2^(m-1), and its 2D discrete cosine transform is
4. The resulting coefficients are the simultaneously normalized and
5. After quantizing each block’s DCT coefficients, the elements of the
resultant are reordered in zigzag pattern.
6. Function im2jpeg is used for JPEg compression, having syntax:
y = im2jpeg (x, quality)
7. Two specialized block processing functions used to simplify the
a. blkproc automates the entire process of dealing with images in
blocks, having syntax:
B = blkproc (A, [M N], FUN, P1, P2, . . . )
b. im2col gives a matrix whose each column contains the elements of
one distinct block of the input image, having syntax:
B = im2col (A, [M N], ‘distinct’)
8. The function jpeg2im is used to decompress a compressed image,
x = jpeg2im (y)