Azzera filtri
Azzera filtri

how to read the features from for loop?

1 visualizzazione (ultimi 30 giorni)
Dhines
Dhines il 9 Feb 2013
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?...

Risposte (2)

Azzi Abdelmalek
Azzi Abdelmalek il 9 Feb 2013
For k=1:10
im1=imread('yourimage')
figure;
imshow(im1);
im{k}=im1
end

Image Analyst
Image Analyst il 9 Feb 2013
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

Categorie

Scopri di più su Image Processing Toolbox in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by