Download presentation
Presentation is loading. Please wait.
1
Digital Image Processing using MATLAB
Introduction
2
What is Digital Image processing
Digital image processing refers to processing digital images by means of a digital computer . It encompasses a wide and varied field of applications, which are computer vision, image analysis. Three types of computerized processes – Low, mid, and high level. It is used in exceptional social and economic value.
3
Background on MATLAB and Image Processing toolbox
MATLAB stands Matrix Laboratory. Typical uses include the following Math and computation Algorithm development Data acquisition Modeling, simulation, and prototyping Data analysis, exploration, and visualization Scientific and engineering graphics Application development, including building graphical user interfaces . collection of MATLAB functions
4
The MATLAP Desktop
5
Digital Image Representation
Digital image is a representation of 2D image using binary value. Digitizing the coordinates values is called sampling; Digitizing amplitude values is called quantization. Coordinate conventions Digital Image Processing using MATLAB
6
Images as Matrices
7
Reading images The syntax of reading image in MATLAB is
imread(‘file name’) The function size gives the row & column dimensions of image size(filename) The whos function displays additional information about an array whos file name
8
Writing images The syntax of writing image imwrite(f, ‘filename’)
Example imwrite(f, ‘garden’, ‘tiff’) imwrite(f, ‘garden.tif’) The image file details of syntax imfinfo filename
9
Classes in MATLAB Data types in MATLAB
Double (64-bit double-precision floating point) Single (32-bit single-precision floating point) Int32 (32-bit signed integer) Int16 (16-bit signed integer) Int8 (8-bit signed integer) Uint32 (32-bit unsigned integer) Uint16 (16-bit unsigned integer) Uint8 (8-bit unsigned integer) char (2 bytes per element). Logical Values are 0 or 1 (1 byte per element). Digital Image Processing using MATLAB
10
Image types The toolbox supports four types of images:
Intensity images : [0,1] or uint8, double etc. Binary images : {0,1} Indexed images : m-by-3 color map RGB images : m-by-n-by-3
11
Image Types – Intensity Image
MATLAB stores an intensity image as a single matrix, with each element of the matrix corresponding to one image pixel. The matrix can be of class double, in which case it contains values in the range [0,1], or of class uint8, in which case the data range is [0,255] (0 – black, 255 – white).
12
Image Types – Binary Images
In a binary image, each pixel assumes one of only two discrete values. Essentially, these two values correspond to on and off. A binary image is stored as a two-dimensional matrix of 0’s (off pixels) and 1’s (on pixels). Example
13
Image Types - Indexed Images
The colormap is an m-by-3 matrix of class double. Each row of the colormap matrix specifies the red, green, and blue (RGB) values for a single color: color = [R G B] Example
14
Image Types – RGB Images
Like an indexed image, an RGB image represents each pixel color as a set of three values, representing the red, green, and blue intensities that make up the color. Unlike an indexed image, however, these intensity values are stored directly in the image array, not indirectly in a colormap Example Digital Image Processing using MATLAB
15
Converting between Classes
gray2ind - intensity image to index image im2bw - image to binary im2double - image to double precision im2uint8 - image to 8-bit unsigned integers im2uint16 - image to 16-bit unsigned integers ind2gray - indexed image to intensity image mat2gray - matrix to intensity image rgb2gray - RGB image to grayscale rgb2ind - RGB image to indexed image
16
Array Indexing MATLAB supports a number of powerful indexing schemes that simplify array manipulation and improve the efficiency of programs Two type of indexing –vectors and matrices Indexing vectors >> v=[ ] Indexing matrices >> m=[1 2 3;4 5 6;7 8 9]
17
Some Important Standard Arrays
Zeros(M, N) generates an M * N matrix of 0s of class double. Ones(M, N) generates an M * N matrix of 1s of class double. True(M, N) generates an M * N logical matrix of 1s. False(M, N) generates an M * N logical matrix of 0s. Magic(M) generates an M * M “magic square.” This is a square array in which the sum along any row, column, or main diagonal, is the same. Magic squares are useful arrays for testing purposes because they are easy to generate and their numbers are integers. Eye(M) generates an M * M identity matrix. Rand(M, N) generates an M * N matrix whose entries are uniformly distributed random numbers in the interval [0, 1]. Randn(M, N) generates an M * N matrix whose numbers are normally distributed (i.e., Gaussian) random numbers with mean 0 and variance 1.
18
Introduction to M-Function Programming
The components of a function M-file are The function definition line function [outputs] = name(inputs) The H1 line Help text The function body Comments
19
0perators MATLAB operators are grouped into three main categories:
• Arithmetic operators that perform numeric computations • Relational operators that compare operands quantitatively • Logical operators that perform the functions AND, OR, and NOT
20
Arithmetic operators Operator Name Comments and Examples
+ Array and matrix addition a + b, A + B, or a + A. − Array and matrix subtraction a − b, A − B, A − a, or a − A. .* Array multiplication v= A.*B, C(I, J) = A(I, J)*B(I, J). * Matrix multiplication A*B, standard matrix multiplication, or a*A, multiplication of a scalar times all elements of A. ./ Array right division C = A./B, C(I, J) = A(I, J)/B(I, J). .\ Array left division C = A.\B, C(I, J) = B(I, J)/A(I, J). / Matrix right division A/B is the preferred way to compute A*inv(B). \ Matrix left division A\B is the preferred way to compute inv(A)*B. .^ Array power If C = A.^B, then C(I, J) = A(I, J)^B(I, J). ^ Matrix power See help for a discussion of this operator. .' Vector and matrix transpose A.', standard vector and matrix transpose. ' Vector and matrix complex conjugate transpose A', standard vector and matrix conjugate transpose. When A is real A.' = A'. + Unary plus +A is the same as 0 + A. − Unary minus −A is the same as 0 − A or −1*A. : Colon
21
Logical Function
22
Logical Function(cont)
23
Flow Control
24
Interactive I/O It used for display information and instructions to users and accept inputs from the keyboard. Display syntax is disp(argument) Inputs syntax is t=input(‘message’)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.