⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bdry_extract_3.m

📁 提取灰度图的边界
💻 M
字号:
function [x,y,t,c]=bdry_extract_3(V);
% [x,y,t,c]=bdry_extract_3(V);
% compute (r,theta) histograms for points along boundary of single
% region in binary image V

% extract a set of boundary points w/oriented tangents
%sig=1;
%Vg=gauss_sig(V,sig);
Vg=V; % if no smoothing is needed
c=contourc(Vg,[0.5,0.5]);
[G1,G2]=gradient(Vg);

% need to deal with multiple contours (for objects with holes)
fz=c(1,:)~=0.5;
c(:,find(~fz))=NaN;
B=c(:,find(fz));

npts=size(B,2);
t=zeros(npts,1);%加速循环
for n=1:npts
   x0=round(B(1,n));
   y0=round(B(2,n));
   t(n)=atan2(G2(y0,x0),G1(y0,x0))+pi/2;
end
x=B(1,:);
y=B(2,:);

%modified by cwb%
%B1=reshape(B,[2,5,size(B,2)/5]);
%B1=squeeze(sum(B1,2)./5);
%x=B1(1,:);
%y=B1(2,:);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -