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

They are of different sizes RGB image .....Below is the code
image_folder = 'C:\Users\user 1\Desktop\New folder (2)\my code\rear'; % Enter name of folder from which you want to upload pictures with full path
filenames = dir(fullfile(image_folder, '*.png')); % read all images with specified extention, its jpg in our case total_images = numel(filenames); % count total number of photos present in that folder
for n = 1:total_images
full_name= fullfile(image_folder, filenames(n).name); % it will specify images names with full path and extension
our_images = imread(full_name); % Read images
figure (n) % used tat index n so old figures are not over written by new new figures
imshow(our_images) % Show all images
end
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
amara zafar 2018년 2월 6일
my images arre in tiff format does it work same way
Walter Roberson
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.

댓글을 달려면 로그인하십시오.

Himanshu
Himanshu 2014년 12월 8일

0 개 추천

image_folder = 'C:\Users\user 1\Desktop\New folder (2)\my code\rear'; % Enter name of folder from which you want to upload pictures with full path
filenames = dir(fullfile(image_folder, '*.png')); % read all images with specified extention, its jpg in our case total_images = numel(filenames); % count total number of photos present in that folder
for n = 1:total_images
full_name= fullfile(image_folder, filenames(n).name); % it will specify images names with full path and extension
our_images = imread(full_name); % Read images
figure (n) % used tat index n so old figures are not over written by new new figures
imshow(our_images) % Show all images
end
Stalin Samuel
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에 대해 자세히 알아보기

질문:

2014년 12월 8일

댓글:

2018년 2월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by