Digital Image processing lectures and exercises


Lecture topics by Paul Cockshott


Matlab image processing


Algorithms in Matlab


Viewing transforms


Linear Filtering


Transforms and frequency domain filters


Information and encoding

Notes on information theory

These go into the topic in more depth than the lecture



A Sample examination paper with answers is available HERE



1. Matlab familiarisation


2. Use of Kmeans algorithm. This is a  Marked Exercise


Write a Matlab mfunction that can be used to vector quantize an image. The image to be quantized should be greyscale.

The format of the function should be

[A,C]=vq(f,patchsize, alphabetsize)


A is an encoded image

C is the codebook used to encode the image. The codebook should be a 3 d array with bounds 1..alphabetsize,1..patchsize,1..patchsize

f is a source image

patchsize is  the length in pixels of the square to be used in encoding and decoding

alphabetsize is the number of distinct patches in the alphabet that is used to encode or decode the picture.


A second function


Should be written which will decode the encoded image A, using codebook C and return an image F.


You should test the code using the Lena image and the grey1 image on this web site.

The tests should use 2x2 patches, and 4x4 patches and the alphabet sizes used should be 32 ,   512. This will yield 8 resultant test images. You should submit a report containing

1)    Your code

2)    The source images

3)    The results of encoding and decoding the images, these should be formatted on a page to allow easy comparison.

4)    A table showing the frequency of use of the different codes in the alphabets for each of the two images.

5)    An estimate of the number of bits used to encode the images. This estimate should list separately the bits used to encode the arrays A and C that output from the encoder.


The report should be produced either as a .pdf document or a word document. It is worth 10 marks.

It should be handed in at the end of week 7.




Lena Soderberg





View My Stats