www.gusucode.com > images 案例代码 matlab源码程序 > images/CreateGrayLevelCooccurenceMatrixExample.m

    %% Create Gray-Level Co-occurence Matrix for Grayscale Image
% 
%%
% Read a grayscale image into workspace.
I = imread('circuit.tif');
%%
% Calculate the gray-level co-occurrence matrix (GLCM) for the grayscale
% image. By default, |graycomatrix| calculates the GLCM based on horizontal
% proximity of the pixels: [0 1]. That is the pixel next to the pixel of
% interest on the same row. This example specifies a different offset: two
% rows apart on the same column.
glcm = graycomatrix(I,'Offset',[2 0])