MATLAB提取纹理特征的简化方法 发表于 2024-05-07 分类于 MATLAB , 特征提取 , 纹理特征 阅读次数: 本文字数: 879 阅读时长 ≈ 1 分钟 12345678910111213141516clear all,clc;gray = imread('circuit.tif');offsets = [0 1;-1 1;-1 0;-1 -1];[glcm,SI] = graycomatrix(gray,'GrayLimits',[],'NumLevels',16,'Of',offsets);subplot(1,3,1),imshow(gray);subplot(1,3,2),imhist(gray);%-----------------------------------------------------------% 查看灰度级压缩之后的图像%-----------------------------------------------------------subplot(1,3,3),imshow(SI,[0,15]);%使用imshow()显示不同灰度级时,要使用imshow(SI,[low,high])格式,否则无法正确显示图片内容。%对于uint8类型图像默认显示范围取【0,255】,对于double类型图像默认显示范围【0,1】%-----------------------------------------------------------% 求出四个方向上的灰度共生矩阵特征参量%-----------------------------------------------------------stats = graycoprops(glcm,{'contrast','homogeneity','Energy','Correlation'}); 显示图像及灰度频率直方图: 图像灰度级压缩后的图像: stats中保存:’contrast’,’homogeneity’,’Energy’,’Correlation’: