Matlab

Post on 18-Nov-2014

808 views 2 download

Tags:

description

Image Processing

Transcript of Matlab

EVID Solutions04/08/23

EVID Solutions and IEEE SPCE-EVID Solutions and IEEE SPCE-SPITSPIT

Presents

Topics CoveredMATLABMATLAB – GUIImage ProcessingSteganographySteganography – GUIEncryptionCompression

Agenda for Day-1MATLABMATLAB – GUIImage ProcessingSteganography – An Introduction

Topics CoveredWhat is MATLAB?MATLAB EnvironmentMatrix ManipulationFunctionsLoopsPlotsBasic IP Commands

What is MATLAB?A research and development tool

Developed by Mathworks Inc.

MATLAB = MATrix LABoratory

Why MATLAB?

MATLAB EnvironmentCommand WindowWorkspaceCommand HistoryM-File Editor

04/08/23

1. Command Window, Workspace

2. Command History

MATLAB Environment

MATRIX Manipulations• Defining an Integer:

• Defining a 2-d column Matrix:

• Defining a 2-d row Matrix:

• Defining a general 2-d Matrix:

• Defining a general 3-d Matrix:

• Defining a blank Matrix:

MATRIX Manipulations

+ Addition

- Subtraction

* Multiplication

/ Division

\ Left division

^ Power

‘ Complex conjugate transpose

( ) Specify evaluation order

Operators - Arithmetic

< Less than

<= Less than or equal to

> Greater than

>= Greater than or equal to

== Equal to

~= Not equal to

Operators – Relational

AND A & B

OR A | B

NOT ~A

XOR xor(A,B)

Operators - Logical

Exercise 1Optimal code for

Taking Input from 1 to 10 Getting square of each integer Summation of all squares Display of final value

• For finding inverse of matrix;x= inv(a);

• For finding the determinant of matrix;x= det(a);

• For finding the transpose of matrix;x= trans(a);

• For Calculating the square root;x= sqrtm(a);

• For calculating the sum of all elements;x= sum(a);

Functions

• To create a matrix with all elements as 1;x= ones(k);

• To create magic square matrix;x= magic(k);

• For finding the size of matrix;x= size(a);

• For finding the number of elements in matrix;

x= numel(a);

• For finding the maximum, minimum value in a matrix;

x= max(a); y=min(a);

Functions

• Main types:

1. for:for i=1:10

//Place your code hereend

2. while:while(1)//Place your code here

end

3. if:if (Condition)//Place your code here

end

Loops in MATLAB

Exercise 2Optimal Code for

Take any two input numbersConvert them into 8-bit binary Concatenate both of them together Form 5-6-5 matrices from the available 16-bit

data

Plots in MATLABCommands covered: plot, xlabel, ylabel,

title grid, axis, stem, subplot xlabel('time (sec)'); ylabel('step

response'); title('My Plot'); Eg:To plot more than one graph on the

screen, use the command subplot(mnp) which partitions the screen into an mxn grid where p determines the position of the particular graph counting the upper left corner as p=1. For example,

subplot(211),semilogx(w,magdb); subplot(212),semilogx(w,phase);

3-d Plots in MATLABx=[0:10]; y=[0:10]; z=x’*y;mesh(x,y,z); title(‘3-D Graph’);

Exercise 3Optimal Code for

Create 5 x 5 matrix in Excel Import the matrix in MATLAB Use masking to remove any value above 100Export the matrix from MATLABRead new image in Excel

Basic IP CommandsTo Read an Image:

imread()

To Display an Image: imshow() imview()

To Write an Image:Imwrite()