From f618466c25d43f3bae9e40920273bf77de1e1149 Mon Sep 17 00:00:00 2001 From: leochanj105 Date: Mon, 19 Oct 2020 23:09:30 -0400 Subject: initial sd-vbs initial sd-vbs add sd-vbs sd-vbs --- .../toolbox/toolbox_basic/io/readpgm_evinfo.m | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 SD-VBS/common/toolbox/toolbox_basic/io/readpgm_evinfo.m (limited to 'SD-VBS/common/toolbox/toolbox_basic/io/readpgm_evinfo.m') 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 @@ +function [img,ev_info] = pgmread_evinfo(filename) +% function img = pgmread(filename) +% this is my version of pgmread for the pgm file created by XV. +% +% return the information in line # + + +fid = fopen(filename,'r'); + +if (fid <0), + error(sprintf('can not find file %s',filename)); +end + +fscanf(fid, 'P5\n'); +cmt = '#'; +while findstr(cmt, '#'), + cmt = fgets(fid); + if findstr(cmt,'#'), + ev_info = sscanf(cmt,'# minv: %f, maxv: %f, scale: %f, eigval: %f'); + end + if length(findstr(cmt, '#')) ~= 1, + YX = sscanf(cmt, '%d %d'); + y = YX(1); x = YX(2); + end +end + +fgets(fid); + +%img = fscanf(fid,'%d',size); +%img = img'; + +img = fread(fid,[y,x],'uint8'); +img = img'; +fclose(fid); + -- cgit v1.2.2