功能:读取某一路径下全部png文件,批量处理后再按原文件名保存到另一路径下
参考链接:https://www.computationalimaging.cn/2020/01/matlab-batch-process-pictures-under.html
file_path = './seeprettyface_models/';
img_path_list = dir(strcat(file_path,'*.png'));
dist_path = './chaomo/';
filePathTry = 'G:\Face\B_try\B_try';
filePathBtest = 'G:\Face\B_try\B\test';
filePathBtrain = 'G:\Face\B_try\B\train';
filePathBval = 'G:\Face\B_try\B\val';
filePathAtest = 'G:\Face\B_try\A\test';
filePathAtrain = 'G:\Face\B_try\A\train';
filePathAval = 'G:\Face\B_try\A\val';
h = waitbar(0,'Moving..., please wait');
% train
for im =1:length(img_path_list)
fileName = img_path_list(im).name;
filePath = img_path_list(im).folder;
fileImage = strcat(filePath,'\',fileName);
distImage = strcat(dist_path,'\',fileName);
image = imread(fileImage);
image = imresize(image,[256,256]);
imwrite(image,distImage);
str = ['Moving image...',num2str(im*100/length(img_path_list)),'%'];
waitbar(im/length(img_path_list),h,str)
end