how to read the features from for loop?
1 次查看(过去 30 天)
显示 更早的评论
am using ten images inside of for loop...but i get only tenth image features after for loop operation. how to i get previous 1 to 9 image's features?...
0 个评论
回答(2 个)
Image Analyst
2013-2-9
Inside your loop you need to save each set of features in an array, like
filePattern = fullfile(myFolder, '*.jpg');
jpegFiles = dir(filePattern);
allImagesFeatures = zeros(length(jpegFiles), 42); % Initialize.
for k = 1:length(jpegFiles)
baseFileName = jpegFiles(k).name;
fullFileName = fullfile(myFolder, baseFileName);
fprintf(1, 'Now reading %s\n', fullFileName);
imageArray = imread(fullFileName);
imshow(imageArray); % Display image.
drawnow; % Force display to update immediately.
% Get the 42 features of this image only.
% You need to custom write AnalyzeSingleImage().
thisImagesFeatures = AnalyzeSingleImage(imageArray);
% Append these features to the cumulative array that
% we are creating to hold features from all the images.
allImagesFeatures(k, :) = thisImagesFeatures;
end
If you need help figuring out how to determine features, see my Image Segmentation Tutorial: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Processing Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!