最近刚刚花了三天多的时间把视觉特征的提取代码做了进一步的完善,由手动跑代码提取和处理特征改写成特征自动代码提取和处理。
首先是使用cd 更改当前目录路径,然后用dir读取当前目录下所有与之匹配的(*.mpg)的格式文件,这时回返一个所读取的所有文件的信息的结构数组。video_files(the n_th).name 表示当前第第n个文件的文件名,然后for 循环和load(file_name)就可获得所有需要读取的文件。很方便快捷
clc;
% Choose what to run
disp(datetime())
t1=clock;
runExtractImg = 1;
runExtractAudio = 1;
runGenBarcodes = 1;
runSaveData = 1;
% set parameters
main_dir = 'Z:\lipread\temp4\vid\video_trying';
cd 'Z:\lipread\temp4\vid\video_trying\';
video_files = dir('*.mpg')
nFiles = length(video_files);
% file_name = strcat(Test_Dataset{7},'.mpg');
% main_vid = sprintf('%s',file_name);
% ---- %
% to write the data extracted into the excel file, but you have to prepare a Excel file befor write data into it.
xlswrite('Z:\lipread\temp4\vid\video_trying\xls\video_name.xls',files_vid_s15_names,'Sheet5','A');
disp("The end time: ");
disp(datetime())
t2=clock % compute the run time of code
etime(t2,t1)