matlab 批量转换图片类型格式

matlab 批量转换图片类型格式

clc;
clear;
 p = dir('I:\RC10-19\18-59-result-02-01');
 for idx2 = 3: 100
     name = ['I:\RC10-19\18-59-result-02-01\' p(idx2).name];
     img = imread(name);
 %    RGB = imcrop(img,[430 540 600 300]);
%   img = img(431:730,541:1140);
%   img = imresize(img,[400,400],'nearest');
%     %imgA = img(601:901);
%     img = rgb2gray(img);
% %       img = im2bw(img); 
      img=uint8(img);
%     imgA(:,:,1) = img;
%     imgA(:,:,2) = img;
%     imgA(:,:,3) = img; 
     imwrite(img,['I:\RC10-19\label\', p(idx2).name],'Compression','none');
%   imwrite(img,[path 'E:\rc\9-27\16-34\' p(idx2).name '_',num2str(img),'.tiff']);
 end

看自己需要批量裁剪;resize;灰度;0-255转为0-1;一维/三维;

猜你喜欢

转载自blog.csdn.net/qq_37473115/article/details/83280490