Reading images from a loop
显示 更早的评论
I am trying to read images from a folder with a loop, but the's constantly this error:
Error using imread (line 350)
File "C:\Users\Katya\Documents\MATLAB\sunset\uniform\IMG_6806.JPG.jpg" does not exist.
Error in Finale (line 13)
LogoSet(i).sample = imread(s);
There's a code snippet:
srcFiles = dir('C:\Users\Katya\Documents\MATLAB\sunset\uniform\*.jpg');
% folder with source images
counter = num2str(length(srcFiles));
template = struct('sample', []);
LogoSet = repmat(template, counter);
for i = 1 : numel(LogoSet)
s = ['C:\Users\Katya\Documents\MATLAB\sunset\uniform\' srcFiles(i).name '.jpg'];
LogoSet(i).sample = imread(s);
LogoSet(i).sample = rgb2gray(LogoSet(i).sample);
end
Image does exist in a folder but apparently MATLAB does not recognizes it. It executes correctly the file name but still says that it's not there. Tried with defining a folder - also didn't work. Any help will be appreciated
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Read, Write, and Modify Image 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!