最近剛剛花了三天多的時間把視覺特征的提取代碼做了進一步的完善,由手動跑代碼提取和處理特征改寫成特征自動代碼提取和處理。
首先是使用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)