MATLAB: I want to extra featuresglcm from 100images in a folder and save in excell,i have tried different ways but i only get results for the first iamge

fruitimage processingimage segmentation

clc;
clear; close all;
[A] = imread('Img0010.jpg');
%%




% segment the entire fruit
[BW,maskedRGBImage] = createMask2(A);
% color image
[BWfilled,properties] = filterRegions2(BW);
%%
% segment defect
[BWd,df] = segmentImage21(maskedRGBImage);
% defect properties
statsd = regionprops(BWd, 'Area');
statsF = regionprops(BWfilled, 'Area');
AreaD = cat(1,statsd.Area);
AreaF = cat(1,statsF.Area);
percDef = 100*AreaD/AreaF;
%%
% featureextraction (texture)
% Create the Gray Level Cooccurance Matrices (GLCMs)

gray = rgb2gray(A);
% Create the Gray Level Cooccurance Matrices (GLCMs)
glcms = graycomatrix(gray);
% Derive Statistics from GLCM
stats = graycoprops(glcms,'Contrast Correlation Energy Homogeneity');
Contrast = stats.Contrast;
Correlation = stats.Correlation;
Energy = stats.Energy;
Homogeneity = stats.Homogeneity;
%%
% featureextraction (color)
Mean = mean2(maskedRGBImage);
Standard_Deviation = std2(maskedRGBImage);
Entropy = entropy(maskedRGBImage);
RMS = mean2(rms(maskedRGBImage));
%%
% feature variables
Ex = [Contrast Correlation Energy Homogeneity Mean Standard_Deviation Entropy RMS];
xlswrite('C:\Users\nazem_000\Desktop\fotos\healthy\healthy1.xls',Ex);

Best Answer

Well, you're only reading in one image so what do you expect?
If you want to process a sequence of images, See the FAQ for code samples.