필터 지우기
필터 지우기

how to read the features from for loop?

조회 수: 1 (최근 30일)
Dhines
Dhines 2013년 2월 9일
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?...

답변 (2개)

Azzi Abdelmalek
Azzi Abdelmalek 2013년 2월 9일
For k=1:10
im1=imread('yourimage')
figure;
imshow(im1);
im{k}=im1
end

Image Analyst
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

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by