多幅图片处理的循环语句
小弟毕业设计关于视频去雾处理,将视频截取为图片后对每张图片进行处理,其中需要用到循环语句来减少工作量,但自己对循环语句不怎么会,希望哪位大大能够给予帮助,谢谢了
程序如下
block_size = 15;
infile = '1.jpg';
outfile = '1_1.jpg';
outRTfile = 'test_rawt.bmp';
outTfile = 'test_t.jpg';
outDfile = 'test_d.bmp';
showFigure = 0;
enableSoftMatting = 1;
enableBilateralFilter = 0;
I = imread(infile);
[h,w,z]=size(I);
block_size = round(h/25);
figure, imshow(I);
st=cputime;
[mI, A] = GetTMap(I, block_size);
mI=imresize(mI,[h w]);
et1=cputime - st;
disp(['Get Init Transmission Map : ' num2str(et1) ' seconds.']);
A = double(A)/255.0;
if (showFigure)
figure, imshow(mI);
end
imwrite(mI, outRTfile);
% I = double(imread('test0014-scale.jpg'));
% mI = double(imread('depth0014-scale.bmp'))/255.0;
% mI = rgb2gray(mI);
% figure, imshow(mI);
I=double(I)/255.0;
if(enableSoftMatting)
st=cputime;
softmap = GetSoftTMap(I, mI);
et2=cputime - st;
disp(['Get Soft Transmission Map : ' num2str(et2) ' seconds.']);
else
softmap = mI;
end
% softmap = double(imread(outTfile))/255.0;
% if (size(softmap,3)==3)
% softmap=rgb2gray(softmap);
% end
if(showFigure)
figure, imshow(softmap);
end
if(enableBilateralFilter)
softmap=uint8(softmap*255);
st=cputime;
softmap=bilateralFilter(uint8(softmap),3,20);
et3=cputime - st;
disp(['Bilateral Filter : ' num2str(et3) ' seconds.']);
if(showFigure)
figure, imshow(uint8(softmap));
end
softmap=double(double(softmap)/255.0);
end
imwrite(softmap, outTfile);
st=cputime;
depthMap = GetDepthMap(softmap);
et5=cputime-st;
disp(['Depth Map : ' num2str(et5) ' seconds.']);
if(showFigure)
figure, imshow(depthMap);
end
imwrite(depthMap, outDfile);
st=cputime;
result = GetRecoverMap(I, A, softmap, 0.5);
et4=cputime - st;
disp(['Recover Scene : ' num2str(et4) ' seconds.']);
figure, imshow(result);
imwrite(result, outfile);
不知道循环语句在里面怎么添加的?不胜感激啊