Presentation is loading. Please wait.

Presentation is loading. Please wait.

Matlab & Image processing toolbox Heejune Ahn SeoulTech Last updated 2015. Jan.

Similar presentations


Presentation on theme: "Matlab & Image processing toolbox Heejune Ahn SeoulTech Last updated 2015. Jan."— Presentation transcript:

1 Matlab & Image processing toolbox Heejune Ahn SeoulTech Last updated 2015. Jan.

2 Outline Why Matlab? Install Matlab Key concepts of Matlab Basic commands To be an Matlab expert

3 1.Why Matlab TM ? Nice language  Quicker to Learn than other languages.  Platform-independent  De-facto scientific standard Can focus on algorithm  not low level details  integrated environment (graphics etc)  tool boxes Alternatives  OpenCV

4 Install Matlab Install  Run “setup.exe” as usual License  Individual licenses (use on your Labtop)  Multi-user licenses (at class room, already set-up)

5 Running Matlab and 20 commands workspace (variables) command hisory command windows working directory

6 Key concepts Working directory  pwd  cd Search path  addpath( )  editpath  matlab setup.m file Workspace  whos  clear  save // session.mat file  load

7 Variables Variable  Every thing in Matlab is matrix/array. 1-D, 2-D, & multi-Dim Must be a rectangular  Initialization A = [1 2; 3 4]  implicit vectorization x=1:10, y=sin(pi.*x./2)  Indexing A(rows, columns) first element : “1”, not “0” start:step:end e.g) 0:5:100 All elements: “ : ” 12 34 A(1, 1:2 ) row A(1:2, 2) = A( :, 2) column

8 More on variable Generating  size e.g.) size(A)  zeros, ones, eye modification  repmat e.g.) A=eye(4); B=repmat(A,1,2);  combine: A=[1 2; 3 4], B=[5 6; 7 8], C=[9 10 11 12] ; D= [A B]; E= [A; B]; F = [A B; C] Image  3-D of x, y, & component  A = imread(‘filename’);  imshow(A)

9 Number representation kjkjkjkjkj

10 Operations Mathemetical Operations  scalar operation vs matrix operation scalar: element by element e.g) A=[1:2, 3:4]; B=A; C=A.*B; D=A*B

11 Relational  Element-by-element e.g.

12 Logical

13 Flow control If/else switch

14 Flow control for-loop While-loop Note: implicit vectorization should be prefered in Matlab

15 Matlab Functions Built-in functions  exp, sqrt, log, sin etc M-function files function C=sub_img(A,B); %comments here if size(A) ~= size(B) disp(‘Images are not the same size’) return; else C=imsub(A,B); imshow(C); %Display 8-bit diff image end inputs output

16 Useful in M-script User Interaction  keyboard  type  pause  Input Algorithm  find (indexes) A=1:10; i=find(A>5)

17 Etc 2-D Ploting  Plot  bar  hist Utility  help  quit  print  ; (semi-colon) x = 0:pi/100:2*pi; y = sin(x); figure % opens new figure window plot(x,y)


Download ppt "Matlab & Image processing toolbox Heejune Ahn SeoulTech Last updated 2015. Jan."

Similar presentations


Ads by Google