Matlab常用函数

1 : 
im2double : [0,255]---->[0,1]

2: grp2idx:
[G,GN] = grp2idx(S) creates an index vector G from the grouping variable S. The result G is a vector taking integer values from 1 up to the number K of distinct groups. GN is a cell array of strings representing group labels.
其实就是一个分类过程,G返回所有的分类索引,GN返回所有的分类。
例如:A = [1 2 3 4 5 6 7 8 9 5 6 1 4 3 2 7 8 9 5 6 2 1 4];
[G,GN] = grp2idx(A);
结果:
G' = 1     2     3     4     5     6     7     8     9     5     6     1     4   3     2     7     8     9     5     6     2     1     4
GN' =   '1'    '2'    '3'    '4'    '5'    '6'    '7'    '8'    '9'
即总共有1-9这9个分类,G中的值是A中对应坐标下的相应元素的分类。

3: strtok: Find token in string.
TOKEN = strtok(STR,DELIM) returns the first token delimited by one of the characters in DELIM. strtok ignores any leading delimiters.一般用来对字符串进行分割。
例子:
s = '  This is a simple example.';
       [token, remain] = strtok(s,'.')
结果:
token = This is a simple example
remain = .
即以.为分隔符对符串进行分割,注意只返回一个次,如果要进行多次处理,则要用循环来处理,比如:
rem = 'E:\Matlab\Recovering Occlusion Boundaries from a Single Image';
tok = {};
while ~isempty(rem)
    [tok{end+1}, rem] = strtok(rem, '\');
end
结果:tok : 1 * 3 cell
tok{1} = ‘E';
tok{2} = 'Matlab'
tok{3} = 'Recovering Occlusion Boundaries from a Single Image'

4: regionprops: Measure properties of image regions,用来度量图像区域属性,统计被标记区域的面积分布,显示区域总数,从而达到测量标注矩阵L中每一个标注区域的一系列属性的目的,调用规则为:
STATS = regionprops(L,properties)
L中不同的正整数元素对应不同的区域,例如:L中等于整数1的元素对应区域1;L中等于整数2的元素对应区域2;以此类推。
返回值STATS是一个长度为max(L(:))的结构数组,结构数组的相应域定义了每一个区域相应属性下的度量。
Properties可以是由逗号分割的字符串列表、包含字符 串的单元数组、单个字符串'all'或者'basic'。如果properties等于字符串'all',则表4.1中的度量数据都将被计算;如果properties等于字符串'basic',则属性:'Area','Centroid'和'BoundingBox'将被计算。
简而言之,如果属性用'Area',则返回值STATS中的Area代表每一类的元素个数。

5: integral2
Numerically evaluate double integral

q = integral2(fun,xmin,xmax,ymin,ymax) approximates the integral of the function z = fun(x,y) over the planar region xmin ≤ x ≤ xmax and ymin(x) ≤ y ≤ ymax(x).

example

q = integral2(fun,xmin,xmax,ymin,ymax,Name,Valuespecifies additional options with one or moreName,Value pair arguments.

http://www.mathworks.com/help/matlab/ref/integral2.html#btdgcqq


6: quad2d

Numerically evaluate double integral, tiled method

q = quad2d(fun,a,b,c,d) approximates the integral of fun(x,y) over the planar region  and . fun is a function handle, c and d may each be a scalar or a function handle.

http://www.mathworks.com/help/matlab/ref/quad2d.html


posted @ 2014-09-28 23:45  DeepVL  阅读(2522)  评论(0编辑  收藏  举报