天天看点

高斯模板生成的过程

<pre name="code" class="html">
           
<p style="font-family: Arial; font-size: 14px; line-height: 26px; margin-top: 0px; margin-bottom: 5px; padding-top: 0px; padding-bottom: 0px; border: 0px; list-style: none; word-wrap: normal; word-break: normal; color: rgb(54, 46, 43);"><span style="word-wrap: normal; word-break: normal; line-height: 21px; font-size: 14px;"><span style="word-wrap: normal; word-break: normal; line-height: 21px; font-size: 14px;"><span style="word-wrap: normal; word-break: normal; line-height: 21px; font-size: 14px;">高斯函数表示</span></span>定义为:</span></p><p align="center" style="font-family: Arial; font-size: 14px; line-height: 26px; margin-top: 0px; margin-bottom: 5px; padding-top: 0px; padding-bottom: 0px; border: 0px; list-style: none; word-wrap: normal; word-break: normal; color: rgb(54, 46, 43);"><span style="word-wrap: normal; word-break: normal; line-height: 21px; font-size: 14px;"><img alt="" src="https://img-blog.csdn.net/20131110132334796" title="【特征提取】DOG算子" style="margin: 0px; padding: 0px; border: medium none; list-style: none;" /></span></p><p style="font-family: Arial; font-size: 14px; line-height: 26px; margin-top: 0px; margin-bottom: 5px; padding-top: 0px; padding-bottom: 0px; border: 0px; list-style: none; word-wrap: normal; word-break: normal; color: rgb(54, 46, 43);">MATLAB代码:</p><p style="font-family: Arial; font-size: 14px; line-height: 26px; margin-top: 0px; margin-bottom: 5px; padding-top: 0px; padding-bottom: 0px; border: 0px; list-style: none; word-wrap: normal; word-break: normal; color: rgb(54, 46, 43);">
</p>
           
<span style="font-size:18px;">n=10;%定义模板大小
 n1=floor((n+1)/2);%计算中心
 for i=1:n
    for j=1:n
       b(i,j) =exp(-((i-n1)^2+(j-n1)^2)/(4*alf))/(4*pi*alf);
    end
 end</span></span>
           
</pre><pre name="code" class="html">
           
<span style="font-size:18px;">或者</span>
           
<span style="font-size:18px;">p2是核的大小</span>
           
<span style="font-size:18px;">siz = (p2-1)/2;  
[x,y] = meshgrid(-siz(1):1:siz(1),-siz(1):1:siz(1));
z1 = exp(-(x.*x+y.*y)/(2*sigma1.^2))/sqrt(2*pi*sigma1.^2);
z2 = exp(-(x.*x+y.*y)/(2*sigma2.^2))/sqrt(2*pi*sigma2.^2);    %生成高斯核</span>