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

资源简介

小波边缘检测matlab程序。小波边缘检测matlab程序。小波边缘检测matlab程序

资源截图

代码片段和文件信息

%load woman;
X=imread(‘Miss.bmp‘);
clear coef1;
clear coef2;
clear coef3;
clear form;
x=X;
x=double(x);%200 line300 column; 
line=250;
column=250;
J=6;
Tu=7;
smooth_area_num=20;
edge_area_num=40;
for i=1:line
  coef1(i:)=cwt(x(i:)1‘bior4.4‘);
  coef2(i:)=cwt(x(i:)2‘bior4.4‘);
  coef3(i:)=cwt(x(i:)J‘bior4.4‘);
end
%正值1,负值0的矩阵temp表示(突变点左位置)
max=0;
max_loc=0;
max_num=15;
for i=1:line
    j=1;
    while j    
        if (coef3(ij)>0 & coef3(ij+1)<0) | (coef3(ij)<0 & coef3(ij+1)>0 )%找到左位置j
            for k=j+1:column-1
               
                if coef3(ik)*coef3(ij)>=0%找到右位置k
                    for m=j:k
                        if abs(coef3(im))>max
                            max=abs(coef3(im));
                            max_loc=m;
                        end
                    end
                    if max>max_num
                       form(imax_loc)=1;
                    end
                    j=k;
                    max=0;
                    break;
                end
            end%for k
            if k==column-1
                j=column-1;
            end
        else
            j=j+1;
        end%if
    end%while
end
%for i=1:line
%    for j=1:column
%        if abs(coef1(ij))>=2*abs(coef2(ij)) %是否加绝对值?!!!!!!!!!!!!!!!!!!!!!!!!!!!
%           form(ij)=0;%第一种方法去噪声
%        end
%    end
%end
%*****************************************************
%对列作小波变换
x=x‘;
for i=1:line
  coef1(i:)=cwt(x(i:)1‘bior4.4‘);
  coef2(i:)=cwt(x(i:)2‘bior4.4‘);
  coef3(i:)=cwt(x(i:)J‘bior4.4‘);
end
%正值1,负值0的矩阵temp表示(突变点左位置)
max=0;
max_loc=0;
for i=1:line
    j=1;
    while j    
        if (coef3(ij)>0 & coef3(ij+1)<0) | (coef3(ij)<0 & coef3(ij+1)>0 )%找到左位置j
            for k=j+1:column-1
               
                if coef3(ik)*coef3(ij)>=0%找到右位置k
                    for m=j:k
                        if abs(coef3(im))>max
                            max=abs(coef3(im));
                            max_loc=m;
                        end
                    end
                    if max>max_num
                       form(max_loci)=1;
                    end
                    j=k;
                    max=0;
                    break;
                end
            end%for k
            if k==column-1
                j=column-1;
            end
        else
            j=j+1;
        end%if
    en

评论

共有 条评论