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

DSP Lab9

This document provides instructions for performing basic image processing operations in MATLAB. It describes how to read images using imread(), display images using imshow(), add noise to images using imnoise(), and write images to different file formats using imwrite(). It then lists several tasks for students to complete involving importing, displaying, converting, and generating different types of images in MATLAB.

Uploaded by

Mahnoor Mansoor
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views

DSP Lab9

This document provides instructions for performing basic image processing operations in MATLAB. It describes how to read images using imread(), display images using imshow(), add noise to images using imnoise(), and write images to different file formats using imwrite(). It then lists several tasks for students to complete involving importing, displaying, converting, and generating different types of images in MATLAB.

Uploaded by

Mahnoor Mansoor
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

2020-CE-044 B

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().

Basic Operations on Image Processing


imread: reads a grayscale or color image from the file specified by the string
filename. imshow: displays binary, grayscale and color image. For binary,
displays pixels with the value 0 as black and pixels with the value 1 as white.
A color map matrix may have any number of rows, but it must have exactly 3
columns. Each row is interpreted as a color, with the first element specifying
the intensity of red light, the second green, and the third blue. Color intensity
can be specified on the interval 0.0 to 1.0.
imnoise: adds noise of a given type to the intensity of image I. type is a string
that can have one of following values. See syntax and table below;
imnoise(I,type)
2020-CE-044 B

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),

(b) Determine its size (in pixels)


2020-CE-044 B

(c) Give a brief description of the picture

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 #3: Repeat the above question with


(a) (a) A binary image,

(b) An indexed color image,


2020-CE-044 B

(c) A true color image.

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)

You might also like