当前位置:
文档之家› 北京市哲学社会科学规划的项目共26页
北京市哲学社会科学规划的项目共26页
才智在线淘宝
20
Image Processing Toolbox(cont.)
•Pixel values and statistics --corr2,imhist…
•Image enhancement – histeq, medfilt2…
•Linear filter
-- conv2, filter2…
Av=[Av A(i,:)]; end Av=Av';
才智在线淘宝
10
Functions(cont.)
void AddF(int i);
int main()
{ ……
addF(i); } void AddF(int i) {
i=i+1; }
File name testFunR.m
function testFun i=2; AddF(i); i
•Image transform -- dct2, fft…
•Binary image Op. --- dilate, erode…
才智在线淘宝
21
Neural Network
•Feed-forward backpropagatoin •Hopfield Networks •Self-organizing maps •Radial Basis networks •………………
才智在线淘宝
19
Image Processing Toolbox(cont.)
EdgeTest.m
function EdgeTest Itif=imread('image1.tif'); B=edge(Itif,'canny'); subplot (1,2,1); imshow(Itif); subplot(1,2,2); imshow(B);
•Write an image ---- imwrite(I, filename,FMT)
才智在线淘宝
18
Image Processing Toolbox(cont.)
ImageRWD.m
function ImageTest Itif=imread('image1.tif'); imwrite(Itif,'image1.bmp','bmp'); Ibmp=imread('image1.bmp'); subplot(1,2,1); imshow(Itif); subplot(1,2,2); imshow(Ibmp);
才智在线淘宝
6
C++ vs. Matlab (cont.)
If (i==j) { A[i][j]=2; } else if (abs(i-j)!=1) {
…….; }
if i == j A(i,j) = 2;
elseif abs(i-j) ~= 1 A(i,j) = -1;
else A(i,j) = 0;
plot(t,y) ;
subplot(1,2,2);
plot(t,z);
才智在线淘宝
15
Matrix
>> A=[1 2 3;3 2 1] A=
123 321
>>b=A(1,:) b=
123
>> B=A' B=
13 22 31
才智在线淘宝
16
Matrix Manipulation
•Singular value decomposition---[U,S,V]=svd(A) •Eigenvalues and eigenvectors---[V,D] = eig(A) • Orthogonal-triangular decomposition- [Q,R]=qr(A)
function AddF(i) i=i+1;
A function declaration cannot appear within a script M-file
才智在线淘宝
11
Graphing
To make a graph of y = sin(t) on the interval t = 0 to t = 10
n = length(x); mean = avg(x,n); stdev =… function mean = avg(x,n) mean = sum(x)/n;
才智在线淘宝
9
Functions(cont.)
void Matrix2Vector( ) {
……; ……; }
function Matrix2Vector Av=A(1,:); for i=2:x
for i = 1:2:N for J = 1:N
A(I,J) =(I+J-1);
end end
才智在线淘宝
5
C++ vs. Matlab (cont.)
int j;
while (j<28) {
…….; }
while N> 0, E = E + F; F = A*F/N; N = N + 1;
end
•Menu
才智在线淘宝
2
Introduction
• Things we like about Matlab
• Things we don’t like about Matlab
才智在线淘宝
3
Help
Help command Help svd
才智在线淘宝
4
C++ vs. Matlab
int j; . for (j=1;j<23;j=j+2) { A[4][j]=3*j; }
plot(t,y) ;
subplot(2,1,2);
plot(t,z);
才智在线淘宝
14
Graphing(cont.)
Multiple windows in one figure
SubplotTest.m
t = 0:.3:10;
y = sin(t);
z= cos(t);
subplot(1,2,1);
In file PlotTest.m
t = 0:.3:10; y = sin(t); plot(t,y,’r’) ;
才智在线淘宝
12
Graphing(cont.)
graphing the fuction z(x,y) = x exp( - x^2 - y^2)
In file MeshTest.m
[x,y] = meshgrid (-2:.2:2, -2:.2:2);
z = x .* exp(-x.^2 - y.^2); mesh(z)
才智在线淘宝
13
Graphing(cont.)
Multiple windows in one figure
SubplotTest.m
t = 0:.3:10;
y = sin(t);
z= cos(t);
subplot(2,1,1);
才智在线淘宝
22
Neural Networks(cont.)
•Create feed-forward NN
•Net=newff([-1 2;0 5],[31],{‘tansig’,’purelin’},’traingd’);
•Neural Model – tansig, logsig, purelin. •Training method –traingd, traingdm. •Training
•LU factorization
--[L,U] = lu(A)
•Matrix rank •Condition number
-- a=rank(A) -- a=cond(A)
才智在线淘宝
17
Image Processing Toolbox
•Read an image ---- I=imread(filename) •Display an image ---- imshow(I)
end
才智在线淘宝
7
Байду номын сангаас
C++ vs. Matlab (cont.)
• Index to an array can be zero.
• double, float , int…
• “;” is very important
• Index into matrix can’t be negative or zero.
• Don’t need to worry about the data type
• “;” not so important
才智在线淘宝
8
Functions
double* stat(double *x) {
…….; return stdev; }
function [mean,stdev] = stat(x)
show_window(cell_list,fig_number,title_figure,120,20,3);
才智在线淘宝
24
Menu (cont.)
•cell_list{1,1} = {‘name',‘function;'};
•show_window(cell_list,fig_number,title_figure,x,y,z);
Matlab
The language of technical computing
才智在线淘宝
1
Outline
•Introduction
•C++ vs. Matlab
•Functions
•Graphing