i want to read a folder of images and do my code on the images then obtain some features from every image and save them in a vector. how can i do that? i wrote this code but it has an error to read the folder.

1 次查看(过去 30 天)
I1=rgb2gray(I);
>BW=edge(I1,'sobel');
>D=bwdist(BW);
>u=D(480,:);
>Z=sum(u)/720;

回答(1 个)

Image Analyst
Image Analyst 2015-12-12
See the FAQ for code to process a bunch of files: http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F
In the middle of the loop, just save your result:
for k = 1 : numberOfImages
% code to read in imageArray......
% Now analyze it.
result(k) = AnalyzeSingleImage(imageArray);
end
where AnalyzeSingleImage is the function that you write to make your measurement and returns a single number.
If it returns an array of numbers, like a feature vector, then use a 2D array to store the results:
allResults = zeros(numberOfImages, 10);
for k = 1 : numberOfImages
% Get results, an array of 10 measurements we've made.
results = AnalyzeSingleImage(imageArray);
allResults(k,:) = results;
end

类别

Help CenterFile Exchange 中查找有关 Images 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by