matlab regiongroups,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

z = fun(x,y) over the planar region xmin ≤ x ≤ xmax and ymin(x) ≤ y ≤ ymax(x).

Name,Value pair arguments.

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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值