• 大小: 3KB
    文件类型: .m
    金币: 1
    下载: 0 次
    发布日期: 2021-06-17
  • 语言: Matlab
  • 标签: matlab  

资源简介

小波的代码-local_max_mode.m
zhengxing.m sub_m.m rank_c.m mulscale_edge.m mul_c.m max_c.m M_shift1.m local_max_mode.m local_max_dujiaoxian

资源截图

代码片段和文件信息

%求纵向细节v和横行细节h的合成及模极大值
function [out1out2] = local_max_mode(vhthra0n);

[rowcol] =size(v);

for irow=1:row
    for jcol=1:col
        mf(irowjcol) = sqrt(v(irowjcol)^2 + h(irowjcol)^2);
        af(irowjcol) = atand(v(irowjcol)/(h(irowjcol)+eps));
    end
end

m1=(n+1)/2;%n为奇数是模板的大小
m2=(n-1)/2;

max_mf=wthresh(mf‘h‘thr);
temp_mf=max_mf;
%对模长取自适应阀值
for irow=m1:(row-m1)
    for jcol=m1:(col-m1)
        if max_mf(irowjcol)>0
           lefttop_h=irow-m2;%左上角横坐标
           lefttop_v=jcol-m2;%左上角纵坐标
           sub_c=sub_m(max_mflefttop_hlefttop_vn);
%            mean_arry=mean(sub_c);
%            mean_thr=mean(mean_arry);
%            sub_c=wthresh(sub_c‘h‘mean_thr);
           if rank_c(sub_cmax_mf(irowjcol)m1^2)
              temp_mf(irowjcol)=0;
           else
              mean_array=mean(sub_c);
              adapt_thr=mean(mean_array)*a0;
              temp_mf(irowjcol)=wthresh(max_mf(irowjcol)‘h‘adapt_thr);
           end
        end
    end
end

max_mf=temp_mf;
edge_mf(rowcol)=0;%模的极大值
% grad(rowcol)=-1;%梯度方向

% -1代表非极值点
% 0代表-22.5度至22.5度
% 1代表22.5度至67.5度
% 3代表-22.5度至-67.5度
% 2代表67.5度至90度以及-67.5度至-90度

for irow=2:row-1
    for jcol=2:col-1
       if max_mf(irowjcol

评论

共有 条评论