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

7 vues (au cours des 30 derniers jours)
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 commentaires
Subhadeep Koley
Subhadeep Koley le 16 Déc 2020
@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.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Environment and Settings dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by