diff options
Diffstat (limited to 'SD-VBS/common/toolbox/toolbox_basic/io/read_cimgs.m')
-rwxr-xr-x | SD-VBS/common/toolbox/toolbox_basic/io/read_cimgs.m | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/SD-VBS/common/toolbox/toolbox_basic/io/read_cimgs.m b/SD-VBS/common/toolbox/toolbox_basic/io/read_cimgs.m new file mode 100755 index 0000000..d5df7f5 --- /dev/null +++ b/SD-VBS/common/toolbox/toolbox_basic/io/read_cimgs.m | |||
@@ -0,0 +1,40 @@ | |||
1 | function Is = read_imgs(homedir,imgdir,prename,postname,digits,startid,endid,step_img) | ||
2 | % | ||
3 | % Is = read_imgs(homedir,imgdir,prename,postname,digits,startid,endid,step_img) | ||
4 | % | ||
5 | |||
6 | |||
7 | |||
8 | command = ['%s%s%s%.',num2str(digits),'d%s']; | ||
9 | |||
10 | fname = sprintf(command,homedir,imgdir,prename,startid,postname); | ||
11 | disp(fname); | ||
12 | if (strcmp('.ppm',postname)), | ||
13 | I1 = readppm(fname); | ||
14 | else | ||
15 | I1 = imread(fname); | ||
16 | end | ||
17 | |||
18 | |||
19 | Is = zeros(size(I1,1),size(I1,2),size(I1,3),1+floor((endid-startid)/step_img)); | ||
20 | Is(:,:,:,1) = I1; | ||
21 | im_id = 1; | ||
22 | for j = startid+step_img:step_img:endid, | ||
23 | command = ['%s%s%s%.',num2str(digits),'d%s']; | ||
24 | fname = sprintf(command,homedir,imgdir,prename,j,postname); | ||
25 | disp(fname); | ||
26 | im_id = im_id+1; | ||
27 | |||
28 | if (strcmp('.ppm',postname)), | ||
29 | Is(:,:,:,im_id) = readppm(fname); | ||
30 | else | ||
31 | a = imread(fname); | ||
32 | Is(:,:,:,im_id) = a; | ||
33 | end | ||
34 | end | ||
35 | |||
36 | |||
37 | |||
38 | |||
39 | |||
40 | |||