How to extract multiple image to excel? I got error 'Undefined function or variable 'AnalyzeSingleImage'.'

clc;
clear all;
image_folder='C:\Users\DiEbAh\Desktop\code\pineapplewithoutcrown';
filenames=dir(fullfile(image_folder,'*jpg'));
numberOfImages=length(filenames);
allImagesFeatures = zeros(numberOfImages, 6);%initialize
for n=1:numberOfImages
baseFileName = filenames(n).name;
fullFileName = fullfile(image_folder, baseFileName);
fprintf(1, 'Now reading %s\n', fullFileName);
imageArray = imread(fullFileName)
drawnow;%Force display to update immediately
s = imresize(imageArray, [800 800]);
s=imadjust(s,[.1 .15 0; .6 .7 1],[]);%improve rgb color
s=imgaussfilt(s,2);%remove noise by blurry the image
v=imshow(s);
%create binary mask
e = imellipse(gca,[163.492063492064 10 492.486772486773 780.31746031746]); %ellipse shape location
BW = createMask(e,v);
%apply it
BW(:,:,2) = BW;
BW(:,:,3) = BW(:,:,1);
ROI = s;
ROI(BW == 0) = 0;
imshow(ROI);
% Extract RGB Channel
R=ROI(:,:,1);
G=ROI(:,:,2);
B=ROI(:,:,3);
% Extract Statistical features
% 1] MEAN
meanR=mean2(R);
meanG=mean2(G);
meanB=mean2(B);
% 2] Standard Deviation
stdR=std2(R);
stdG=std2(G);
stdB=std2(B);
%Obtain features in a matrix form
a=[meanR, meanG, meanB, stdR, stdG, stdB];
% Analyze the image with function AnalyzeSingleImage and get results.
thisImagesFeatures = AnalyzeSingleImage(a);
% Store results in thisImagesFeatures:
allImagesFeatures(n,:) = thisImagesFeatures;
xlswrite('C:\Users\DiEbAh\Desktop\code\extract.xls',allImagesFeatures);
end

2 个评论

@nur adibah "AnalyzeSingleImage" is not a built-in MATLAB function. Either you have to define it or if it is already defined, you have to add its path to current MATLAB path.

请先登录,再进行评论。

回答(0 个)

类别

帮助中心File Exchange 中查找有关 Environment and Settings 的更多信息

提问:

2020-12-16

评论:

2020-12-16

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by