MATLAB: batch process pictures under specified path and save to another path
Function: Read all png files in a certain path, save them to another path by the original file name after batch processing
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
没有评论:
发表评论