Original_image_dir = 'F:\faces\re\bad';%原始图片路径
right_image_dir = 'F:\faces\re\bad\bad\';%删选出了200*200图片保存路径
fpath = fullfile(Original_image_dir, '*.jpg');
im_dir = dir(fpath);im_num = length(im_dir);
NIQE = [];
j=0;
k = 0;
for i = 1:im_num
%% read clean image
IMname = regexp(im_dir(i).name, '\.', 'split');
IMname = IMname{1};
im=imread(fullfile(Original_image_dir, im_dir(i).name));
[msize,nsize]=size(im);
k= k+1;
image_name3=strcat(right_image_dir,num2str(k),'.jpg');
imwrite(im,image_name3,'jpg'); %写图片
end
供给大家参考