资源简介
matlab(边界提取,链码生成,差分链码生成及频率向量生成程序)具有旋转不变性了的链码
代码片段和文件信息
function B=boundaries(BWconndir)
%BOUNDARIES Trace object boundaries.
%B=BOUNDARIES(BW) traces the exterior boundaries of objects in the binary
%image BW.B is a p_by_1 cell arraywhere p is the number of objects in the
%image.Each cell contains a Q_by_2 matrixeach row of which contains the
%row and column coordinates of a boundary pixel.Q is the number of boundary
%pixels for the corresponding object.object boundaries are traced in the
%clockwise direction.
%
%B=BOUNDARIES(BWCONN) specifies the connectivity to use when tracing
%boundaries.CONN may be either 8 or 4.The default value for CONN is 8.
%
%B=BOUNDARIES(BWCONNDIR) specifies the direction used for tracing
%boundaries.DIR should be either ‘cw‘(trace boundaries clockwise) or
%‘ccw‘(trace boundaries counterclockwise).If DIR is omitted BOUNDARIES
%traces in the clockwise direction.
if nargin<3 %nargin定义在用户自定义函数体内,nargin返回
%用来调用函数的变量的个数。
dir=‘cw‘;
end
if nargin<2
conn=8;
end
L=bwlabel(BWconn); %返回值是矩阵L,大小同BW,包含了BW中的连通部分的标记
%The number of objects is the maximum value of L.Initialize the cell
%array(元包数组)B so that each cell initially contains a 0_by_2 matrix.
numobjects=max(L(:));%寻找L中所作标记中的最大值,这个最大值实际上就对应着L中
% 包含的最多的连通部分的数目。
if numobjects>0
B={zeros(02)};%元包数组中仅包含一个元素。
B=repmat(Bnumobjects1);%将B进行numobjects*1个复制构成新的B。
else
B={};
end
%Pad label matrix with zeros.This lets us write the boundary_following loop
%without worrying about going off the edge of the image.
Lp=padarray(L[1 1]0‘both‘);
%Compute the linear indexing offsets to take us from a pixel to its
%neighbors.
M=size(Lp1);%SIZE(X1) returns the number of rows.
if conn==8
%Order is N NE E SE S SW W NW.
offsets=[-1M-1MM+11-M+1-M-M-1];
else
%Order is N E S W.
offsets=[-1M1-M];
end
%next_search_direction_lut is a lookup table.Given the direction from pixel
%k to pixel k+1what is the direction to start with when examining the
%neighborhood of pixel k+1?
if conn==8
next_search_direction_lut=[8 8 2 2 4 4 6 6];
else
next_search_direction_lut=[4 1 2 3];
end
%next_direction_lut is a lookup table.Given that we just looked at neighbor
%in a given directionwhich neighbor do we look at next?
if conn==8
next_direction_lut=[2 3 4 5 6 7 8 1];
else
next_direction_lut=[2 3 4 1];
end
%Values used for marking the starting and boundary pixels.
START=-1;
BOUNDARY=-2;
%Initialize scratch space in which to record the boundary pixels as well as
%follow the boundary.
scratch=zeros(1001);
%Find candidate starting locations for boundaries.
[rrcc]=find((Lp(2:end-1:)>0)&(Lp(1:end-2:)==0));
rr=rr+1;
for k=1:length(rr)
r=rr(k);
c=cc(k);
if (Lp(rc)>0)&(Lp(r-1c)==0)&isempty(B{Lp(rc)})
%We‘ve found the start of the next boundary.Compute its linear
%offsetrecord which boundary it ismark itand initialize the
%counter for the number of boundary p
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 5689 2007-05-07 16:40 matlab(边界提取链码生成差分链码生成及频率向量生成程序)具有旋转不变性了的链码\boundaries.m
文件 798 2007-05-10 10:12 matlab(边界提取链码生成差分链码生成及频率向量生成程序)具有旋转不变性了的链码\creatcode.m
文件 886 2007-05-10 10:42 matlab(边界提取链码生成差分链码生成及频率向量生成程序)具有旋转不变性了的链码\creatfrequence.m
文件 455 2007-05-10 10:41 matlab(边界提取链码生成差分链码生成及频率向量生成程序)具有旋转不变性了的链码\creatsubcode.m
文件 1724 2007-05-10 16:30 matlab(边界提取链码生成差分链码生成及频率向量生成程序)具有旋转不变性了的链码\main.m
文件 1819 2007-05-10 10:30 matlab(边界提取链码生成差分链码生成及频率向量生成程序)具有旋转不变性了的链码\singleimagecode.m
目录 0 2007-05-15 15:29 matlab(边界提取链码生成差分链码生成及频率向量生成程序)具有旋转不变性了的链码
----------- --------- ---------- ----- ----
11371 7
- 上一篇:用MATLAB编写的小波去噪程序
- 下一篇:数字锁相环的MATLAB仿真源码
相关资源
- 数字锁相环的MATLAB仿真源码
- 用MATLAB编写的小波去噪程序
- 无线传感器网络仿真代码
- matlab——PSO算法以及两种适应度函数
- 基于纹理的图像检索源码matlab
- matlab实现了图像通信中的全搜索算法
- Win7下MATLAB_7.0地址和详细安装+汉化包
- 乘同余法产生M序列的matlab源程序
- 广义霍夫变换的MATLAB源码
- matlab轮廓匹配的物体识别系统
- JPEG2000MATLAB代码
- matlab 图像离散余弦变换(源代码)
- 六自由度机器人避障问题的MATLAB仿真
- Matlab混沌工具箱
- 空间球拟合程序Matlab
- 信道估计的matlab仿真
- 基于matlab的数字图像处理论文
- 基于DTW语音识别matlab代码
- 质心定位算法MATLAB仿真
- 蚁群算法求解旅行商最优路径问题
- AR参数模型功率谱估计仿真程序
- MATLAB样例之雅克比迭代法
- 快速人脸定位matlab程序
- B样条弹性配准matlab
- bp算法 matlab实现 图像分类
- matlab2010b破解文件,lisensce,序列号
- matlab实现的粒子群动态寻路算法
- MATLAB写的scm信道程序
- 求图像边缘像素最短距离
- MATLAB 学生信息管理系统
评论
共有 条评论