COOCCURENCE_CVIP
cooccurence_cvip() -Gray level co-occurence matrices of an image.
Contents
SYNTAX
glcm = cooccurence_cvip(inImage,td,Ng, norm)
Input Parameters include:
- inImage - 2D input array or image of MxN size.
- td - Texture distance (integer value 1,2,...) td = 2 (default)
- norm - Option for Normalization of GLCM. 'y'->normalized GLCM and 'n'-> non-normalized GLCM norm = 'y' (default)
- Ng - Total number of gray levels in GLCM matrix.The size of co-occurence matrix depends on Ng. If -1,Ng is total number of unique values in an input 2D array. Ng = -1 (default)
Output Parameter includes :
- glcm - Cooccurence matrix of Ng*Ng*4 size. glcm(:,:,1): glcm matrix for vertical direction (90° and 270°). glcm(:,:,2): glcm matrix for horizontal direction (0° and 180°). glcm(:,:,3): glcm matrix for right diagonal direction (45° and 225°). glcm(:,:,4): glcm matrix for left diagonal direction (135° and 315°).
DESCRIPTION
The function computes co-occurence matrix from a 2D input array. The input image is remapped or scaled so that it will have gray levels ranging from 0 to Ng. The function creates four Ng*Ng normalized GLCM matrix corresponding to four different directions i.e., Horizontal, Vertical, Right diagonal and Left diagonal.
REFERENCE
1. Scott E Umbaugh. DIGITAL IMAGE PROCESSING AND ANALYSIS: Applications with MATLAB and CVIPtools, 3rd Edition.
Example
% Read image I = imread('cam.bmp'); % Calling function with default parameters O1 = cooccurence_cvip(I); % Texture distance td = 3; % calling function with user defined texture distance O2 = cooccurence_cvip(I,td); % Calling function with user defined parameters for quantized- normalized glcm O3 = cooccurence_cvip(I,td,'y',10);
CREDITS
Author: Norsang Lama, March 2017
Copyright © 2017-2018 Scott
E Umbaugh
For updates visit CVIP Toolbox Website