Error using imread The file name or URL argument must be a string. Error in imread Error in image_block (line 29) currentfilename = imread(imagefiles);

1 view (last 30 days)
[video, audio]= mmread('PH1p30p12to15.avi');
ww=video.frames;
kk=video.nrFramesTotal;
NFR=71;
for i=1:NFR
www=ww(i);
ss=www.cdata;
bbr1=ss;
bbr2=double(bbr1);
data(:,:,:,i)=uint8(bbr2);
end
for i=1:NFR
vid=data(:,:,:,i);
strtemp=strcat('E:\mtech project\video dataset\PH1p30p12to15image',int2str(i),'.png');
imwrite(vid,strtemp);
end
imagefiles= dir('*.png');
for i=1:NFR
currentname = imagefiles(i);
currentfilename = imread(imagefiles);
image(i)= currentfilename;
SplitImage = mat2cell(images(i), 16 * ones(1, size(images(i),1) / 16), 16 * ones(1, size(images(i),2) / 16), size(images(i),3));
end
%%how to add loop to get all the video frames from a folder??
%%error file doesn't exist??

Answers (1)

KSSV
KSSV on 24 Apr 2019
imagefiles= dir('*.png');
for i=1:NFR
currentfilename = imagefiles(i).name;
I = imread(currentfilename);
% Do what you want
end

Community Treasure Hunt

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

Start Hunting!