I have a folder(s80) which contain 101 sub folders and each of them contain around 400 images. I want to do some processing on them and save in new folders. I have problem with how to read them from the different folders and saving them in a new directory.
Indeed, I have below codes for doing my processing on one folder. Everything is fine if I give the directory of one specific folder but I'm not sure how to run it for all 101 folders and save them in a new directory. (code is for converting the black pixels to white and vice versa)
images = dir(fullfile('C:\data\s80\2436', '*.jpg'));
for i=1:size(images, 1);
PATHNAME =(images(i).name);
imwrite(uint8(255 - double(imread(PATHNAME))),...
fullfile('C:\data\s80\2436',[num2str(i) '.jpg']));
end