资源简介
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_OFDM调制解调(来自剑桥大学)
- Matlab路面裂缝识别69319
- 高灵敏度GPS接收机MATLAB仿真,附捕获
- 基于MATLAB的质点弹道计算与外弹道优
- 阵列天线的matlab仿真
- MATLAB 经典程序源代码大全
- MATLAB小波软阈值去噪代码33473
- 天线阵的波束形成在MATLAB仿真程序及
- 非线性SVM算法-matlab实现
- 《MATLAB 智能算法超级学习手册》-程序
- 组合导航matlab程序
- 读取txt文件内容matlab代码实现
- Matlab实现基于相关的模板匹配程序
- matlab优化工具箱讲解
- 基于MATLAB的快速傅里叶变换
- 光纤传输中的分布傅立叶算法matlab实
- 基于matlab的图像处理源程序
- matlab 椭圆拟合程序
- 算术编码解码matlab源代码
- optical_flow 光流法 matlab 实现程序
- 引导图像滤波器 Matlab实现
- 分形几何中一些经典图形的Matlab画法
- OFDM系统MATLAB仿真代码
- SVM工具箱(matlab中运行)
- 图像小波变换MatLab源代码
- LU分解的MATLAB实现
- 冈萨雷斯数字图像处理matlab版(第三
- 替代数据法的matlab程序
- 用matlab实现的多站定位系统性能仿真
- 通过不同方法进行粗糙集属性约简m
评论
共有 条评论