• 大小: 9KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-24
  • 语言: 其他
  • 标签: 图像  纹理  特征  

资源简介

上次没传完整,忘了上传那3个函数了,这次是完整版

资源截图

代码片段和文件信息

function out=Algorithmslib(imgtype)

%%%  type:
%%%         pfft2 :图像fft变换的极坐标表示
%%%         edgehist:灰度图像的边缘方向直方图
%%%         basedcoMatrix:基于灰度共生矩阵的纹理特征
%%%         tamura_feature: 粗糙度; 对比度;方向度


switch type
    case ‘pfft2‘
        [rowcol]=size(img);
        maxW=double(uint16(sqrt(row*row+col*col)));
        W=0:maxW/(row-1):maxW;
        theta=2*pi*(0:90/(col-1):90)/360;        
        fftimg=fft2(img4*row4*col);
        U=ceil(W‘*cos(theta));
        V=ceil(W‘*sin(theta));
        U=reshape(Urow*col1);
        V=reshape(Vrow*col1);
        UV2=V*2*row+U+1;
        clear W
        clear theta
        clear W
        clear V
%       pfft2out=fftimg(UV2);

%%%     out: row*col
        out=reshape(fftimg(UV2)rowcol);
        clear UV2
        clear fftimg
        
        
%     case ‘gabor1‘
%         %%  S:01234
%         %%  R:012345
%         Ws=[3/43/83/163/323/64];
%         dels=Ws/3/sqrt(2*log(2));
%         
%         thetar=[0pi/6pi/3pi/22*pi/35*pi/6];
%         delr=pi*pi/36/8/log(2);
%         for i=1:5
%             WO(i:)=exp(-(W-Ws(i)).^2/2/dels(i)/dels(i));
%         end
%         WTH=zeros(1300*300);
%         for i=1:6
%         ThetaO=exp(-(theta-thetar(1)).^2/2/delr(1)/delr(1));
%         wwth=[(ThetaO‘)*WO(1:);(ThetaO‘)*WO(2:);(ThetaO‘)*WO(3:);(ThetaO‘)*WO(4:);(ThetaO‘)*WO(5:)];
%  %       WTH=cat(1WTH[ThetaO(i:).*WO(1:);ThetaO(i:).*WO(2:);ThetaO(i:).*WO(3:);ThetaO(i:).*WO(4:);ThetaO(i:).*WO(4:)]);
%         end
%         
%         %%%%   out :30*row     (W量化数目)
% %       gabor1out=WTH(2:31:);  
%         out=WTH(2:31:); 
%         clear WO
%         clear ThetaO
%         clear WTH
%         
    case ‘edgehist‘
        [rowcol]=size(img);
        mm=max(max(img));
        mm=ones(rowcol)*double(mm);
        
        gray_img=double(img);
        if((gray_img-mm)==0)
            out=zeros(18);
        else
        if(row>800) 
            Gray = blkproc(gray_img[4 4]@mean);
            Gray = blkproc(Gray‘[4 4]@mean)‘;
            
        else
            Gray=gray_img;
        end
        edge_canny = edge(Gray‘canny‘);
        gray_img=Gray;
        [rowcol]=size(edge_canny);

        edge_num=sum(sum(edge_canny));%边缘总点数

        %计算梯度矢量GxGy
        for cir1=2:row-1
            for cir2=2:col-1
                Gx(cir1cir2)=sum(gray_img(cir1-1:cir1+1cir2+1))...
                    -sum(gray_img(cir1-1:cir1+1cir2-1))...
                    +gray_img(cir1cir2+1)-gray_img(cir1cir2-1);
                Gy(cir1cir2)=sum(gray_img(cir1+1cir2-1:cir2+1))...
                    -sum(gray_img(cir1-1cir2-1:cir2+1))...
                    +gray_img(cir1+1cir2)-gray_img(cir1-1cir2);
                Gx(cir1cir2)=Gx(cir1cir2)+(Gx(cir1cir2)==0)*1e-6;
                theta(cir1cir2)=atan(Gy(cir1cir2)/Gx(cir1cir2));    %计算边缘方向
            end
        end

        for cir1

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      16046  2014-08-01 14:38  texture_fea\Algorithmslib.m

     文件        581  2010-10-19 19:36  texture_fea\gabor2.m

     文件       1648  2010-10-28 15:41  texture_fea\gaborfilter1.m

     文件      17173  2016-04-19 14:36  texture_fea\texturefeature.m

     目录          0  2017-06-21 11:38  texture_fea

----------- ---------  ---------- -----  ----

                35448                    5


评论

共有 条评论