文件列表遍历和多通道图片裁剪
文件遍历和多通道图片裁剪
% 加载文件路径列表,文件个数为sz(1) filelist = textread('R:\Users\HaoGe\Desktop\fs\all_figures.txt','%s','delimiter','\n'); sz=size(filelist); %读取样本 for i=1:sz(1) name= char(filelist(i,1)); image=imread(name); % ms = size(image) % m = ms(1) % n = ms(2) % [m,n] = size(image) % [m,n,c] = size(image) % m = m/4; % n = n/4; m = 898; n=898; for j=1:4 for k=1:4 imwrite(image(1+m*(j-1):m*j,1+n*(k-1):n*k,:),[name,num2str(j),num2str(k),'.bmp']); end end %imshow(image); end