clear;
clc;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%参数配置
% ObjDir = 'D:\Preprocess\Train\label';%目标图片文件夹路径
% OutputDir = 'D:\Preprocess\image';%输出文件夹路径
% tnum = 30;%目标图片数目
%
% %注:
% % 目标图片命名为:i.png(i取1到tnum)
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% for i = 1:1:tnum
% bgFile = [ObjDir,int2str(i),'.png'];% 读入图片的完整路径
%
% Background = imread(bgFile); % 读入图片、灰度化
%
% figure(i),imshow(Background),title('修改后的图像')
%
% saveas(i,[OutputDir,int2str(i),'_bw.png']);%将处理后的图片保存到目标文件夹
% end
OutputDir_image = 'D:\Preprocess\Train\image_gray\';%输出文件夹路径
OutputDir_label = 'D:\Preprocess\label1\';%输出文件夹路径
fpath = 'D:\Preprocess\label'; %这里是目标图片文件夹的名字
flist = dir(sprintf('%s/*.tif', fpath));
i = 512;
j = 512;
% images = [];
for imidx = 1:mi
图像的批量读取,处理与保存到指定位置
最新推荐文章于 2023-10-16 18:08:35 发布