DSP Lab9
DSP Lab9
LAB# 9
BASIC OPERATIONS ON IMAGE PROCESSING
OBJECTIVES:
● Follow instructions to perform basic operations on image processing
Image reading:
The command in matlab to read an image is imread() where inside the
bracket the name of the file to be read is mentioned e.g. ‘cameraman.tif’.
Matlab supports a wide variety of image types with various parameters. See
the Matlab help for full list of supported files and diferent imread() command
options. Note that we onlly need the basic command format.
In case of reading an indexed image, color map can be read as well using the
folloing command:
[X,map] = imread(‘An indexed image name’)
where X is the image and map stores the color map. The code below reads
different kind of images. Note that there are four types of concerned
images,namely, RGB (true color), indexed image, grayscale and binary. In
addition, data type of the images once read can be of many data format
incluing double, uint8 (unsigned integer 8 bit representation) and logical (i.e.
binary). The size of the image can be seen using the command size().
EXAMPLE:
2020-CE-044 B
LAB TASK:
Task #1: Type in the command window
>> help imdemos
This will give you a list of, amongst other things; the entire sample TIFF images which come with the
Image Processing Toolbox. Make a list of these sample images, and for each image
(a) Determine its type (binary, grayscale or true color),
imageinfo('autumn.tif')
Task #2: Pick any grayscale image. Using the imwrite function, write it to files of type JPEG, PNG and
BMP. What are the sizes of those files?
2020-CE-044 B
Task #4: Pick any image and convert its mode to uint8 and uint16.
2020-CE-044 B
Task #5: Import an image ‘football.jpg’ and display it. Also convert the image formats into:
(a) Indexed image.
(b) Intensity image.
(c) Binary image.
Use subplot command to display all formats in one figure.
Task #6: Import any color image and extract out the red, green and blue color from it.
2020-CE-044 B
Task #7: Design the following images through Matlab, by using loops, trigonometric functions and
matrices:
(a) (b)
(c) (
2020-CE-044 B
(e)
(f)