How can i make an array of 100 images ?
显示 更早的评论
I want to perform some feature vector operations on 100 images directly , how can i do that?
回答(3 个)
Guillaume
2014-12-8
0 个投票
You didn't give enough information to answer in any detail (for example what is the size of the images, how many channels, how are they stored, etc.), so:
If the images are all the same size concatenate them in a new dimension (dim 3 for single channel, dim 4 for RGB) with cat
If they're all different size, use a for loop.
4 个评论
Himanshu
2014-12-8
Guillaume
2014-12-8
Change your loop to:
files = dir(fullfile(image_folder, '*.png')); %filename as a variable name is not accurate
total_images = numel(filenames)
for n = 1:total_images
our_images{n} = imread(fullfile(image_folder, file.name));
feature{n} = your_feature_code(our_images{n});
%display code if you wish
%...
end
This assumes your_feature_code returns something else than a scalar. If it returns a scalar you can replace the {} with ()
amara zafar
2018-2-6
my images arre in tiff format does it work same way
Walter Roberson
2018-2-6
Yes, you can use imread() with tif images. However, tif can store multiple images in the same file, so in some circumstances you might need to take extra steps.
Stalin Samuel
2014-12-8
编辑:Stalin Samuel
2014-12-8
0 个投票
for example if u have images named as 1.jpg,2.jpg,....n.jpg then
for i = 1:no_of_images currentimage = imread( sprintf('ur_image directory_folder/%d.JPG',i) ); //your feature calculation feature(i)=your calculation end
类别
在 帮助中心 和 File Exchange 中查找有关 Convert Image Type 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!