clear;
path = 'E:\Personal\Desktop\shang1';
newpath1 = 'E:\Personal\Desktop\santongdao1';
mkdir(newpath1);
file = dir(path);
for k = 3:length(file)
img = imread([path,'\',file(k).name]);
for m = 1:size(img,1)
for n = 1:size(img,2)
if img(m,n)==1
im(m,n) = 255;
else
im(m,n) = 0;
end
end
end
newname = [newpath1,'\',file(k).name];
imshow(im)
im1(1:size(im,1),1:size(im,2),1) = im;
im1(1:size(im,1),1:size(im,2),2) = im;
im1(1:size(im,1),1:size(im,2),3) = im;
imwrite(im1,newname);
clear img;
clear im
clear im1;
end