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

Lab 1: Introduction To Digital Image Processing Using Matlab

This document provides an introduction to digital image processing using MATLAB. It defines what digital image processing is, discusses pixels and resolution, and types of images like binary, grayscale, RGB, and multidimensional. It also describes basic image processing functions in MATLAB like imread(), imshow(), imwrite(), and functions for converting between image types. The document explains that images are represented as matrices and how to access intensity values. It concludes with two tasks - the first asks to manipulate intensity values of an image, the second asks to flip, rotate and crop an image.

Uploaded by

Waqar Tanveer
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
179 views

Lab 1: Introduction To Digital Image Processing Using Matlab

This document provides an introduction to digital image processing using MATLAB. It defines what digital image processing is, discusses pixels and resolution, and types of images like binary, grayscale, RGB, and multidimensional. It also describes basic image processing functions in MATLAB like imread(), imshow(), imwrite(), and functions for converting between image types. The document explains that images are represented as matrices and how to access intensity values. It concludes with two tasks - the first asks to manipulate intensity values of an image, the second asks to flip, rotate and crop an image.

Uploaded by

Waqar Tanveer
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Digital Image Processing

Lab 1: Introduction to Digital Image Processing using


MATLAB

Waqar Tanveer
Department of Computer Engineering
Bahria University, Islamabad

September 20, 2020

Digital Image Processing 1 / 10


Reference Book

Digital Image Processing with MATLAB by Gonzalez and


Woods

Digital Image Processing 2 / 10


What is Digital Image Processing ?

Digital image processing deals with manipulation of digital


images through a digital computer.

An image is defined as a two dimensional function f (x, y ),


where x and y are the spatial (plane) coordinates.

The amplitude/value f at any pair of coordinates (x, y ) is


called the intensity or gray level of the image at that point.

When the values of (x, y ) and f are finite and discrete, then it
is called as a digital image.

Digital Image Processing 3 / 10


Pixel and Resolution
A digital image is composed of a finite number of elements,
each of which has a particular location and value.

These elements are called as picture elements or pixels.

Resolution is the fineness of detail in an image and it is


measured in pixels per inch (ppi). The more pixels per inch,
the greater the resolution.

Figure: Digital Image

Digital Image Processing 4 / 10


Types of Images

Figure: Binary Image Figure: Grayscale Image

Figure: RGB Image Figure: Multidimensional Image

Digital Image Processing 5 / 10


Image Processing in MATLAB

Following are the functions used for basic operations on images:


imread() → Used for reading an image.

imshow() → Used for displaying an image.

imwrite() → Used for writing/saving an image.


imbinarize() → Used for converting a grayscale image into
binary image.

rgb2gray() → Used for converting a color image into


grayscale image.

Digital Image Processing 6 / 10


Image as Matrix
Images are represented as matrices.
a = imread(0 cameraman.tif 0 );
imshow (a)

Figure: Matrix Form of Image

Digital Image Processing 7 / 10


Accessing Intensity values of Image
Intensity values of image can be assessed by giving the
location of spatial coordinates.

For example, if we have to find the intensity value of image at


(x, y ) = (2, 3), we would find in the following way:

a = imread(0 cameraman.tif 0 );
a(2, 3)

Figure: Intensity Value of Image at (2,3)

Size of the image can be found by using size() command.


Digital Image Processing 8 / 10
Tasks

Task 1
Consider any RGB image and display it.
Convert it into grayscale and display the result.
Access the intensity values of image. Change the intensity
values in such a way that the intensity values which are less
than 100 should appear as black and the intensity values
which are greater than 150 should appear as white. Rest of
the intensity values remain unchanged. Display the resultant
image.
Explain each step with an explanation of 2,3 lines along with
figures. Also include the code.

Digital Image Processing 9 / 10


Tasks (Continued)

Task 2
Read any RGB image and display it.

Flip it horizontally and vertically and display the results.

Rotate the image at 45 degrees and 90 degrees and display


the results.

Crop an image by using inbuilt “imcrop” command and


without using imcrop command and display both results.

Explain each step with an explanation of 2,3 lines along with


figures. Also include the code.

Digital Image Processing 10 / 10


Instructions

Digital Image Processing 11 / 10

You might also like