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

    %% Calculate Contrast and Homogeneity from Multiple GLCMs
% 
%%
% Read grayscale image into the workspace.
I = imread('circuit.tif');
%%
% Create two gray-level co-occurrence matrices (GLCM) from the image,
% specifying different offsets.
glcm = graycomatrix(I,'Offset',[2 0;0 2])
%%
% Get statistics on contrast and homogeneity of the image from the GLCMs.
stats = graycoprops(glcm,{'contrast','homogeneity'})