# How do I retrieve texture using GLCM and classify using SVM Classifier?

I'm on a project of liver tumor segmentation and classification. I used Region Growing and FCM for liver and tumor segmentation respectively. Then, I used Gray Level Co-occurence matrix for texture feature extraction. I have to use Support Vector Machine for Classification. But I don't know how to normalize the feature vectors so that I can give it as an input to the SVM. Can anyone tell how to program it in Matlab?

To the GLCM program, I gave the tumor segmented image as input. Was I correct? If so, I think, then, my output will also be correct.

My glcm coding, as far as I have tried is,

I = imread('fzliver3.jpg');
GLCM = graycomatrix(I,'Offset',[2 0;0 2]);
stats = graycoprops(GLCM,'all')
t1= struct2array(stats)

GLCM2 = graycomatrix(I2,'Offset',[2 0;0 2]);
stats2 = graycoprops(GLCM2,'all')
t2= struct2array(stats2)

GLCM3 = graycomatrix(I3,'Offset',[2 0;0 2]);
stats3 = graycoprops(GLCM3,'all')
t3= struct2array(stats3)

t=[t1,t2,t3]
xmin = min(t); xmax = max(t);
scale = xmax-xmin;
tf=(x-xmin)/scale


Was this a correct implementation? Also, I get an error at the last line.

My output is:

stats =

Contrast: [0.0510 0.0503]
Correlation: [0.9513 0.9519]
Energy: [0.8988 0.8988]
Homogeneity: [0.9930 0.9935]
t1 =

Columns 1 through 6

0.0510    0.0503    0.9513    0.9519    0.8988    0.8988
Columns 7 through 8

0.9930    0.9935
stats2 =

Contrast: [0.0345 0.0339]
Correlation: [0.8223 0.8255]
Energy: [0.9616 0.9617]
Homogeneity: [0.9957 0.9957]
t2 =

Columns 1 through 6

0.0345    0.0339    0.8223    0.8255    0.9616    0.9617
Columns 7 through 8

0.9957    0.9957
stats3 =

Contrast: [0.0230 0.0246]
Correlation: [0.7450 0.7270]
Energy: [0.9815 0.9813]
Homogeneity: [0.9971 0.9970]
t3 =

Columns 1 through 6

0.0230    0.0246    0.7450    0.7270    0.9815    0.9813
Columns 7 through 8

0.9971    0.9970


t =

Columns 1 through 6

0.0510    0.0503    0.9513    0.9519    0.8988    0.8988


Columns 7 through 12

0.9930    0.9935    0.0345    0.0339    0.8223    0.8255


Columns 13 through 18

0.9616    0.9617    0.9957    0.9957    0.0230    0.0246


Columns 19 through 24

0.7450    0.7270    0.9815    0.9813    0.9971    0.9970

??? Error using ==> minus
Matrix dimensions must agree.


The input images are:

• What did you use to implement Fuzzy C-Means algorithm? – Spacey Mar 22 '12 at 16:02
• @Mohammad I don't get you sir. If you are asking about the software, I used Matlab. – Gomathi Mar 22 '12 at 16:04
• Yes I realize that, but I mean did you use a built in library for implementation of Fuzzy-C-Means segmentation, or did you write your own, or import a 3rd party library? I ask because I am also interested in implementing a segmentation algo as well, and my platform is also MATLAB. – Spacey Mar 22 '12 at 16:25
• @Mohammad No sir, I didn't install any library specific for FCM. I used FCM Thresheholding. Refer to the Matlab Central File Exchange. I hope it would be useful for you. – Gomathi Mar 23 '12 at 4:21
• good method but I have ENVI 4.0 Software. I want processes Landsat 7 satellite imagery to evaluate tree volume – user5636 Oct 10 '13 at 16:11

This article deals exactly with the same type of supervised classification based on labelled GLCM classes: GLCM Textural Features for Brain Tumor Classification