• 大小: 3KB
    文件类型: .m
    金币: 1
    下载: 0 次
    发布日期: 2023-12-18
  • 语言: Matlab
  • 标签: MATLAB  

资源简介

很好的灰度共生矩阵特征提取MATLAB代码,实用,得到了灰度共生矩阵各个特征的值。

资源截图

代码片段和文件信息

rgb=imread(‘D:\mytest\true1.jpg‘);
Gray = double(0.3*rgb(::1)+0.59*rgb(::2)+0.11*rgb(::3));
M=128;
N=128;
%--------------------------------------------------------------------------
%2.????????????????????Gray???16?
%--------------------------------------------------------------------------
for i = 1:M
    for j = 1:N
        for n = 1:256/16
            if (n-1)*16<=Gray(ij)&Gray(ij)<=(n-1)*16+15
                Gray(ij) = n-1;
            end
        end
    end
end
[Lnum]=bwlabel(Gray);
%--------------------------------------------------------------------------
%3.????????P????1??????04590135
%--------------------------------------------------------------------------
P = zeros(16164);
for m = 1:16
    for n = 1:16
        for i = 1:M
            for j = 1:N
                if j                    P(mn1) = P(mn1)+1;
                    P(nm1) = P(mn1);
                end
                if i>1&j                    P(mn2) = P(mn2)+1;
                    P(nm2) = P(mn2);
                end
                if i                    P(mn3) = P(mn3)+1;
                    P(nm3) = P(mn3);
                end
                if i                    P(mn4) = P(mn4)+1;
                    P(nm4) = P(mn4);
                end
            end
        end
     

评论

共有 条评论