图像边缘提取算法研究分析方案Word文件下载.docx
- 文档编号:19228167
- 上传时间:2023-01-04
- 格式:DOCX
- 页数:33
- 大小:348.68KB
图像边缘提取算法研究分析方案Word文件下载.docx
《图像边缘提取算法研究分析方案Word文件下载.docx》由会员分享,可在线阅读,更多相关《图像边缘提取算法研究分析方案Word文件下载.docx(33页珍藏版)》请在冰豆网上搜索。
而是边缘的方向。
微分算子有两个重要性质:
定域性(或局部性>
、敏感性(或无界性>
。
敏感性就是说,它对局部的函数值变化很敏感,但是因其对变化过于敏感又有了天然的缺陷——不能抵抗噪声。
局部性意思是指,每一点的导数只与函数在该点邻近的信息有关。
主要有两大类基于微分算子的边缘检测技术:
一阶微分算子边缘检测与二阶微分算子边缘检测。
这些检测技术采用以下的基本步骤:
(1)将相应的微分算子简化为离散的差分格式,进而简化为模板(记为T>
(2)利用模板对图像f(m,n>
进行运算,获得模板作用后的结果Tf(m,n>
(3)提出阈值h,在采用一阶微分算子情形记录下高于某个阈值h的位置坐标
(而采用二阶微分算子情形,一般是对某个阈值
确立
>
(4)对集合
进行整理,同时调整阈值h。
Roberts算子
Roberts算子是一种利用局部差分算子寻找边缘的算子,两个模板分别为
则,
=
=
算法的步骤为:
(1)首先用两个模板分别对图像作用得到
和
;
(2)对
,进行阈值判决,若
大于阈值则相应的点
位于便于边缘处。
对于阈值选取的说明:
由于微分算子的检测性能受阈值的影响较大,为此,针对具体图像我们采用以下阈值的选取方法,对处理后的图像统计大于某一阈值的点,对这些数据求平均值,以下每个程序均采用此方法,不再做说明。
具体程序如下:
%-----filename:
Roberts.m-------------------------
%-----Useage:
edgedetectingbytheRobertsoperator-----
%-----Writer:
Subailong-------------------------
functionedgeRb=Roberts(oimage>
[xlenylen]=size(oimage>
%readthesize
edgeX=zeros(xlen,ylen>
%horizontaldirection
edgeY=zeros(xlen,ylen>
%verticaldirection
edgeXY=zeros(xlen,ylen>
%synthesizethetwodirections
%--------------processtheoringinimagewiththeoperator----------------
fori=1:
xlen-1
forj=1:
ylen-1
edgeX(i,j>
=oimage(i,j>
-oimage(i+1,j+1>
edgeY(i,j>
=oimage(i+1,j>
-oimage(i,j+1>
end
edgeX=abs(edgeX>
edgeY=abs(edgeY>
edgeXY=sqrt(edgeX.*edgeX+edgeY.*edgeY>
%---------Threshestimate--------------------
rsum=0。
counter=0。
fori=2:
forj=2:
ylen-1
if(edgeXY(i,j>
15>
rsum=rsum+edgeXY(i,j>
counter=counter+1。
threshold=rsum/counter。
%threshold=2*sum(sum(edgeXY(1:
xlen-1,1:
ylen-1>
/((xlen-1>
*(ylen-1>
%-------edgedetecting---------------
if(edgeXY(i,j>
threshold>
edgeimage(i,j>
=255。
else
=0。
edgeRb=edgeimage。
Sobel算子
Sobel算子采用中心差分,但对中间水平线和垂直线上的四个邻近点赋予略高的权重。
两个模板分别如下:
该算法的处理过程同Roberts算字,在这个程序中,我们采用两个方向分别进行阈值判断,程序如下:
Sobel.m-------------------------
edgedetectingbytheSobeloperator-----
functionedgeS=Sobel(oimage>
d=zeros(xlen,ylen>
%directionoftheconrespondingpoints
edgeimage=zeros(xlen,ylen>
%theresultimage
H1=[-101。
-202。
-101]。
%horizontaloperator
H2=[-1-2-1。
000。
121]。
%verticaloperator
xlen
ylen
form=1:
3
forn=1:
updateX=i-m+2。
updateY=j-n+2。
if((updateX>
=1>
&
&
(updateX<
=xlen>
(updateY>
(updateY<
=ylen>
=edgeX(i,j>
+H1(m,n>
*oimage(updateX,updateY>
%processtheoringinimagewithH1operator
=edgeY(i,j>
+H2(m,n>
ifedgeX(i,j>
edgeY(i,j>
d(i,j>
=1。
%savethedirection
=2。
%edgeX=abs(edgeX>
%edgeY=abs(edgeY>
%edgeXY=sqrt(edgeX.*edgeX+edgeY.*edgeY>
if(edgeX(i,j>
20>
rsum=rsum+edgeX(i,j>
%threshold=4*sum(sum(edgeXY(2:
xlen-1,2:
/((xlen-2>
*(ylen-2>
if(d(i,j>
==1&
edgeX(i,j>
edgeX(i,j+1>
edgeX(i,j-1>
=1。
elseif(d(i,j>
==2&
edgeY(i+1,j>
(edgeY(i,j>
edgeY(i-1,j>
edgeS=edgeimage。
Prewitt算子
Prewitt算子也属于中心差分类型,但没有给最邻近点较高的权重,两个模板如下:
Prewitt.m-------------------------
edgedetectingbythePrewittoperator-----
functionedgeP=Prewitt(oimage>
edgeimage=zeros(xlen,ylen>
d=zeros(xlen,ylen>
-101。
H2=[111。
-1-1-1]。
%edgeXY=edgeX.*edgeX+edgeY.*edgeY。
%-------------------------------------------
edgeP=edgeimage。
Krisch算子
Krisch算子采用以下8种形式的模板:
,
图像中的每个位置都要经过8个模板的作用,最大值被选作输出,达到最大值的方向就是边缘的方向。
实际上可采用以下快速算法:
Kirsch.m-------------------------
edgedetectingbytheKirschoperator-----
functionedgeK=Kirsch(oimage>
edge=zeros(xlen,ylen>
d=zeros(xlen,ylen>
%definethreevoriablestocomputerfast
K=zeros(8,1>
t=zeros(8,1>
f=zeros(8,1>
temp=sum(sum(oimage([i-1:
i+1],[j-1:
j+1]>
-oimage(i,j>
K(1>
=oimage(i-1,j-1>
+oimage(i-1,j>
+oimage(i-1,j+1>
%North
K(2>
=oimage(i-1,j>
+oimage(i,j+1>
%Northeast
K(3>
=oimage(i-1,j+1>
+oimage(i+1,j+1>
%East
K(4>
=oimage(i,j+1>
+oimage(i+1,j>
%Southeast
K(5>
=oimage(i+1,j+1>
+oimage(i+1,j-1>
%South
K(6>
+oimage(i,j-1>
%Southweast
K(7>
=oimage(i+1,j-1>
+oimage(i-1,j-1>
%Weast
K(8>
=oimage(i,j-1>
%NorthWest
8
t(m>
=temp-K(m>
f=abs(5*K-3*t>
[mc]=max(f>
edge(i,j>
=m。
%savethemaximum
=c。
%savethedirectionofmaximum
%-----Threshestimate-------------------------------
if(edge(i,j>
200>
rsum=rsum+edge(i,j>
%-----------edgedetecting-----------------------
==1>
(edge(i,j>
edge(i-1,j>
==2>
edge(i-1,j+1>
==3>
edge(i,j+1>
==4>
edge(i+1,j+1>
==5>
edge(i+1,j>
==6>
edge(i+1,j-1>
==7>
edge(i,j-1>
==8>
edge(i-1,j-1>
edgeK=edgeimage。
Robinson算子
Robinson算子也采用8形式的模板,其具体形式参加课本<
课本中第一个算子有误),这里需要说明一下Robinson算子的特征,每个四个其相应元素的负号相反,就是说在计算中只需计算四个就行了。
在本程序中为了比较数值<
而不是绝对值,这样更好地体现方向性)的大小,仍计算8个。
Robinson.m-------------------------
edgedetectingbytheRobinsonoperator-----
bySubailong-------------------------
functionedgeR=Robinson(oimage>
edgeRobinson=zeros(xlen,ylen>
edgeRobinsonimage=zeros(xlen,ylen>
R=zeros(4,1>
R(1>
-oimage(i+1,j+1>
-oimage(i+1,j-1>
...
+oimage(i-1,j>
-oimage(i+1,j>
R(2>
-oimage(i,j-1>
+oimage(i-1,j+1>
R(3>
-oimage(i-1,j-1>
+oimage(i,j+1>
R(4>
=oimage(i,j
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 图像 边缘 提取 算法 研究 分析 方案