How do I classify using GLCM and SVM Classifier in Matlab?

Posted by Gomathi on Programmers See other posts from Programmers or by Gomathi
Published on 2012-03-23T04:40:57Z Indexed on 2012/03/27 11:38 UTC
Read the original article Hit count: 438

Filed under:

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. 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)


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

I3 = imread('fzliver5.jpg');
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
0.0345    0.0339    0.8223    0.8255    0.9616    0.9617
0.0230    0.0246    0.7450    0.7270    0.9815    0.9813

Columns 7 through 8

0.9930    0.9935
0.9957    0.9957
0.9971    0.9970


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

The images are:

enter image description here enter image description here enter image description here

© Programmers or respective owner

Related posts about class