当前位置:高等教育资讯网  >  中国高校课件下载中心  >  大学文库  >  浏览文档

香港理工大学:Introduction to Matlab(PPT讲稿)Image Processing with MATLAB

资源类别:文库,文档格式:PPTX,文档页数:73,文件大小:868.27KB,团购合买
1. Review of Lab 2 2. User defined function 3. Execution control 4. Plots and graphs using Matlab 5. Basic manipulation in image processing 6. Color image compression
点击下载完整版文档(PPTX)

Lab of comp 3 19 Image Processing with MATLAB Lab tutor: Shenghua ZHONG Email:Zsh696(@gmail.com cSshzhong@comp. polyu. edu. hk Lab 2: nov 9.2011

1 Lab of COMP 319 Lab tutor : Shenghua ZHONG Email: zsh696@gmail.com csshzhong@comp.polyu.edu.hk Lab 2: Nov 9, 2011 Image Processing with MATLAB

Outline of lab 3 1. Review of lab 2 2. user defined function 3. Execution control 4. Plots and graphs using Matlab 5. Basic manipulation in image processing 6. Color image compression

3 Outline of Lab 3 1. Review of Lab 2 2. User defined function 3. Execution control 4. Plots and graphs using Matlab 5. Basic manipulation in image processing 6. Color image compression

Review of Lab 2 about Data StructureA 1. Introduction the basic data structure in matlab Vector and array 2. The distinct attributes of these data structures Numerical value ndex /22 2 门 Index The second row and first collum mI m2 Value: a

4 Review of Lab 2 about Data Structure 1. Introduction the basic data structure in Matlab • Vector and Array 2. The distinct attributes of these data structures • Numerical Value • Index

Review of Lab 2 about Data StructureA 3. What we have learnt How to create them For example: A=3, 4, 5; 6,5.5,01 How to manipulate them For example: A(1, 1: 2)=A(1, 1: 2 )+2 How to access their elements For example: B=A(1, 1: 2) How to perform mathematical and logical operations on them For example: C=A /2.5; D= sum(sum(A) For example: E=A>0.5

5 Review of Lab 2 about Data Structure 3. What we have learnt • How to create them • For example: A = [3, 4, 5; 6, 5.5, 0] • How to manipulate them • For example: A(1,1:2) = A(1,1:2) + 2 • How to access their elements • For example: B = A(1,1:2) • How to perform mathematical and logical operations on them • For example: C = A./2.5; D = sum(sum(A)) • For example: E = A > 0.5

Review of lab 2 about m file File”-“New”-“ Script”/“ Function” 1)MATLAB 7.12.0(R2011a 口x File Edit Debug Desktop Window Help New Ctrl+N win 32\ Matlab\R2011a\ bin Ctrl+o Function Close Command window Enumeration 日x× Workspace Import Data see Demos Save Workspace As Curls Figure 回回喝区se variable value Set Path. Preferences GUI Page Setup Deployment Project Print Ctrl+P 1 D: \.A2\Lab2\exercise2.m 2 D: \.A2\Lab2\exercise1. m 3 C: \. Desktop\exercise1.m Command History 十口X 4 C: \. Desktop\exercises.m Exit MATLAB mean (A) omcc. bat mean (mean(A)) 自 mex. pl 可] mexext, bat exercise 回 mexsetup pm 回 mexutils pm mean (A) a msvc_modules_installer,pm Lmax v, max w]= max (A) %—2011-10-1119:52% a Start Ready 6

6 Review of Lab 2 about M file • “File” - “New” - “Script”/“Function

Review of lab 2 about m file Open the m-files and run it E Editor-J:starry\code\sub plot. m File Edit Text Go Cell Tools Debug Desktop window Help |哈0|公·付⊙②日省省即追 冒唱-1.0+÷1.1 Run sub plot. m (F 0:pi/20:2*pi olot (x subplot(2, 1, 2) 5- plot (x, sin(2*x)) mypolymx Untitled. m x sub _plot. m x n 1 Col 1 OVRI

7 Review of Lab 2 about M file • Open the M-file’s and run it

Outline of lab 3 1. Review of lab 2 2. User defined function 3. Execution control 4. Plots and graphs using Matlab 5. Basic manipulation in image processing 6. Color image compression

8 Outline of Lab 3 1. Review of Lab 2 2. User defined function 3. Execution control 4. Plots and graphs using Matlab 5. Basic manipulation in image processing 6. Color image compression

User-Defined Function A function is a piece of computer code that accepts ar input argument from the user and provides output to th ne program You may wish to define your own functions-those which are used commonly in your programming User-defined functions are stored as m-files and can be accessed by Matlab if they are in the current directory

User-Defined Function • A function is a piece of computer code that accepts an input argument from the user and provides output to the program. You may wish to define your own functions-those which are used commonly in your programming. User-defined functions are stored as M-files and can be accessed by Matlab if they are in the current directory. 9

User-Defined Function Each function consists of a name, user-provided input and calculated output. For example, the function my function (x) Is named my function, takes user input inside the parentheses(in this case, x), and calculate a result The user does not see the calculations performed but just accepts the answer. The function could be regarded as a black box Input output function

User-Defined Function • Each function consists of a name, user-provided input, and calculated output. For example, the function: my_function(x) – is named my_function, – takes user input inside the parentheses (in this case, x), and – calculate a result. • The user does not see the calculations performed, but just accepts the answer. The function could be regarded as a black box. input output function 10

User-Defined Function User-defined functions are stored as m-files. each must start with a function definition line that contains the word " function one or several variables that defines the function output a function name and one or several variables used for the input argument Save the function as M-file using the same name in your function · Some examples function output=my function(x) function [outputl, output2]=my function(x1, x2, 3) Hints: The function name and the names of the input and output variables are arbitrary and selected by the programmer, but the word function can not be changed

User-Defined Function • User-defined functions are stored as M-files. Each must start with a function definition line that contains ➢ the word “function”, ➢ one or several variables that defines the function output, ➢ a function name, and ➢ one or several variables used for the input argument. ➢ Save the function as M-file using the same name in your function • Some examples: • function output = my_function(x) • function [output1, output2] = my_function(x1,x2,x3) • Hints: The function name and the names of the input and output variables are arbitrary and selected by the programmer, but the word “function” can not be changed. 11

点击下载完整版文档(PPTX)VIP每日下载上限内不扣除下载券和下载次数;
按次数下载不扣除下载券;
24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
共73页,可试读20页,点击继续阅读 ↓↓
相关文档

关于我们|帮助中心|下载说明|相关软件|意见反馈|联系我们

Copyright © 2008-现在 cucdc.com 高等教育资讯网 版权所有