Not able to read all the images into matlab

3 次查看(过去 30 天)
clear all
clc
folder = 'C:/all_video_frames/';
filename = dir(fullfile(folder, '*.jpg'));
for i = 1:numel(filename)
f=fullfile(folder,filename(i).name);
img=imread(f);
figure(1),imshow(img)
gray_image = rgb2gray(img);
figure(2), imshow(gray_image)
resized_image=imresize(gray_image,[25,25]);
figure(3),imshow(resized_image)
path=strcat('C:/images25/', filename(i).name);
imwrite(resized_image, path);
end
Read images folder has images like:
Subject1-Frame1.jpg, Subject2-Frame2.jpg so on
Subject2-Frame2.jpg, Subject2-Frame2.jpg so on
Having 40 subjects in total
Output images coming as: Subject1-Frame1.jpg, Subject1-Frame10.jpg, Subject1-Frame100.jpg,Subject2-Frame1000.jpg, Subject1-Frame1001.jpg so on.
Missing many images.
How can I get all the images? Please help.
  2 个评论
per isakson
per isakson 2020-11-9
Step through the the script and inspect the values of critical variables. Does folder has the expected value? Etc.
Geoff Hayes
Geoff Hayes 2020-11-9
Parminder - are the images missing or just not appearing in the order that you are expecting? I suspect that you will see files in the order of 1,10,100,1000,1001,....,2,20,200,2000,2001,...., 3,30, 300,3000,3001, ... etc.

请先登录,再进行评论。

回答(0 个)

类别

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