MATLAB: For loop for many images

imageloop

Hi All,
I have thousands of images each image has size (228*196), Each 7 images have same date. I need your help to create a code to do calculation which is (7th image – 2nd image)/(7th image + 2nd image).. I want to do that for each date.
Thank you
Reyadh

Best Answer

dinfo = dir('*_b02_clip.tif_mosaico_ream.tif');
nfile = length(dinfo);
filenames = {dinfo.name};
for K = 1 : nfile
b2_file = filenames{K};
b7_file = b2_file; b7_file(end-27) = '7';
b2_data = double( imread(b2_file) );
b7_data = double( imread(b7_file) );
result = (b7_data - b2_data) ./ (b7_data + b2_data);
%now what?
end
Related Question