0% found this document useful (0 votes)
17 views3 pages

All All '/test - Images/ .JPG' '/test - Images/': % Features For Abnormal Region

This document contains code to extract features from abnormal and normal regions of images. It loads test images, crops the abnormal and normal regions specified by the user, and calculates statistical features such as mean, standard deviation, skewness, kurtosis, sum, entropy, and GLCM features of each region. These features are stored in matrices for the abnormal and normal regions respectively.

Uploaded by

sen19841
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views3 pages

All All '/test - Images/ .JPG' '/test - Images/': % Features For Abnormal Region

This document contains code to extract features from abnormal and normal regions of images. It loads test images, crops the abnormal and normal regions specified by the user, and calculates statistical features such as mean, standard deviation, skewness, kurtosis, sum, entropy, and GLCM features of each region. These features are stored in matrices for the abnormal and normal regions respectively.

Uploaded by

sen19841
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

clc;

clear all;
close all;
S=pwd;
T='\Test_Images\*.jpg';
K=strcat(S,'\Test_Images\');

path=strcat(S,T);
D=dir(path);
tot_files=numel(D);
f_ab=[];
f_nor=[];
for i=1:tot_files

filename=strcat(K,D(i).name);
I=imread(filename);
if size(I,3) == 3
I=rgb2gray(I);
end
% features for abnormal
region
disp('Crop the abnormal
region in the image');
pause;
img=imcrop(I);
mn=mean(mean(img(:)));
stdev=std2(img);
sk=skewness(double(img(:)));

kur=kurtosis(double(img(:)));
enr=sum(img(:));
ent=entropy(img);
glcm= graycomatrix(img,
'offset', [0 1]);
stats = graycoprops(glcm);
glcm_feat=[stats.Contrast,
stats.Correlation,stats.Energy,s
tats.Homogeneity];
f_ab=[f_ab; mn stdev sk kur
enr ent glcm_feat];
% features for normal region
disp('Crop the normal region
in the image ');
pause;
img=imcrop(I);
mn=mean(mean(img(:)));
stdev=std2(img);
sk=skewness(double(img(:)));

kur=kurtosis(double(img(:)));
enr=sum(img(:));
ent=entropy(img);
glcm= graycomatrix(img,
'offset', [0 1]);
stats = graycoprops(glcm);
glcm_feat=[stats.Contrast,
stats.Correlation,stats.Energy,s
tats.Homogeneity];
f_nor=[f_nor; mn stdev sk
kur enr ent glcm_feat];
end

You might also like