How to extract multiple image to excel? I got error 'Undefined function or variable 'AnalyzeSingleImage'.'
6 次查看(过去 30 天)
显示 更早的评论
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 个评论
Subhadeep Koley
2020-12-16
@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 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Environment and Settings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!