-
Notifications
You must be signed in to change notification settings - Fork 28
/
readAllFrames.m
20 lines (19 loc) · 967 Bytes
/
readAllFrames.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
function [frames, names, height,width,nframe ] = readAllFrames(options)
frameFiles = dir(fullfile(options.infolder,'*.png')); %imdir(fullfile(options.infolder));
nframe = length( frameFiles);
frames = cell( nframe, 1 );
names = cell( nframe, 1 );
for index = 1: nframe
% [~, frameName] = fileparts(frameFiles(index).name);
% if exist(fullfile(options.infolder, [frameName '.png']),'file')
frame = imread(fullfile(options.infolder, frameFiles(index).name));
% elseif exist(fullfile(options.infolder, [frameName '.jpg']),'file')
% frame = imread(fullfile(options.infolder, [frameName '.jpg']));
% elseif exist(fullfile(options.infolder, [frameName '.bmp']),'file')
% frame = imread(fullfile(options.infolder, [frameName '.bmp']));
% end
frames{ index } = frame;
names{ index } = frameFiles(index).name;
end
[ height,width ] = size(frame(:,:,1));
end