在MATLAB上实现文件格式的转换

先前在网上下载了数据集,是pgm格式,一共分为四十个文件夹,每个文件夹有十张照片.在网上找了别人写的转换代码,稍加更改,在命令行中可以输出文件夹转换结束。文件名为s1,s2……s40。


	for i=1:40
for j=1:10
	p_w_picpath=imread(strcat('C:\Users\acer\Documents\Tencent Files\501305866\FileRecv\orl_faces\s',...    %文件存储位置,自行更改
int2str(i),'\',int2str(j),'.pgm'));
	imwrite(p_w_picpath,strcat('C:\Users\acer\Documents\Tencent Files\501305866\FileRecv\orl_faces\s',...
	int2str(i),'\',int2str(j),'.jpg'));
	end
	disp(strcat('s',int2str(i),'转换结束.'));
	end
disp('批量转换结束.');

你可能感兴趣的:(自学记录)