srcFiles = dir('C:\Users\..\ImagesWithBorder\*.tif'); % the folder in which our images exists
for i = 1 : length(srcFiles) filename = strcat('C:\Users\..\ImagesWithBorder\',srcFiles(i).name); I = imread(filename);% figure, imshow(I);
J = rgb2gray(I); A=double(J); [r c]=size(A); for row = 1 : r for col = 1 : c if J(row,col) >= 90 J(row,col) = 0; end end end J(all(J==0,2),:)=[] J(:,all(J==0,1))=[] Finalfilename = sprintf('C:\\Users\\ahmadjalal2013\\Desktop\\Thesis_Images\\ImagesWithoutBorder\\%02d',i); imwrite ( J, 'Finalfilename', 'tif'); end
MATLAB: I read set of images and I removed the borders of them, I need to save the resulted images in a new folder but i couldnt. I used this code but I didnt get a result, I need a help, plz
image processingpreprocessingwrite images to file
Best Answer