summaryrefslogtreecommitdiffstats
path: root/SD-VBS/common/toolbox/toolbox_basic/io/readpgm_evinfo.m
diff options
context:
space:
mode:
Diffstat (limited to 'SD-VBS/common/toolbox/toolbox_basic/io/readpgm_evinfo.m')
-rwxr-xr-xSD-VBS/common/toolbox/toolbox_basic/io/readpgm_evinfo.m35
1 files changed, 35 insertions, 0 deletions
diff --git a/SD-VBS/common/toolbox/toolbox_basic/io/readpgm_evinfo.m b/SD-VBS/common/toolbox/toolbox_basic/io/readpgm_evinfo.m
new file mode 100755
index 0000000..69f80ba
--- /dev/null
+++ b/SD-VBS/common/toolbox/toolbox_basic/io/readpgm_evinfo.m
@@ -0,0 +1,35 @@
1function [img,ev_info] = pgmread_evinfo(filename)
2% function img = pgmread(filename)
3% this is my version of pgmread for the pgm file created by XV.
4%
5% return the information in line #
6
7
8fid = fopen(filename,'r');
9
10if (fid <0),
11 error(sprintf('can not find file %s',filename));
12end
13
14fscanf(fid, 'P5\n');
15cmt = '#';
16while findstr(cmt, '#'),
17 cmt = fgets(fid);
18 if findstr(cmt,'#'),
19 ev_info = sscanf(cmt,'# minv: %f, maxv: %f, scale: %f, eigval: %f');
20 end
21 if length(findstr(cmt, '#')) ~= 1,
22 YX = sscanf(cmt, '%d %d');
23 y = YX(1); x = YX(2);
24 end
25end
26
27fgets(fid);
28
29%img = fscanf(fid,'%d',size);
30%img = img';
31
32img = fread(fid,[y,x],'uint8');
33img = img';
34fclose(fid);
35