matlab实现文件中的所有图像统一处理,代码如下
file_path = 'F:\image\'; %图像文件夹路径 img_path_list = dir(strcat(file_path,'*.jpg')); img_num = length(img_path_list); %获取图像总数量 path = 'F:\imagesave\'; %处理后的图像保存路径 if img_num >0 for j = 1:img_num image_name = img_path_list(j).name;%图像名 image = imread(strcat(file_path,image_name)); ResizeImg=imresize(image,[227,227],'nearest');%对图像进行遍历的处理代码,如:调整图像大小为227×227 imwrite(ResizeImg,[path,num2str(j),'.jpg']) % 可以设置保存图像的格式 end end
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/211032.html原文链接:https://javaforall.net
