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