Changeset 790


Ignore:
Timestamp:
Jul 2, 2014, 9:30:32 AM (10 years ago)
Author:
sommeria
Message:

read_rdvision corrected to get both cameras

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/find_file_series.m

    r788 r790  
    4848%% get input root name and nomenclature type
    4949fullfileinput=fullfile(FilePath,fileinput);% input file name with path
    50 [RootPath,SubDir,RootFile,i1_input,i2_input,j1_input,j2_input,FileExt,NomType]=fileparts_uvmat(fullfileinput);
    51 
     50[FileInfo,MovieObject]=get_file_info(fullfileinput);
    5251
    5352%% check for particular file types: images, movies, civ data
    54 i1_series=zeros(1,1,1);
    55 i2_series=zeros(1,1,1);
    56 j1_series=zeros(1,1,1);
    57 j2_series=zeros(1,1,1);
    58 [FileInfo,MovieObject]=get_file_info(fullfileinput);
     53checkfileindexing=0;
     54if isfield(FileInfo,'FileIndexing') && strcmp(FileInfo.FileIndexing,'on')
     55    [RootPath,SubDir,RootFile,i1_input,i2_input,j1_input,j2_input,FileExt,NomType]=fileparts_uvmat(fullfileinput);
     56    i1_series=zeros(1,1,1);
     57    i2_series=zeros(1,1,1);
     58    j1_series=zeros(1,1,1);
     59    j2_series=zeros(1,1,1);
     60    checkfileindexing=1;
     61else % no file indexing
     62    [PathDir,RootFile]=fileparts(fullfileinput);
     63    [RootPath,SubDir,DirExt]=fileparts(PathDir);
     64    SubDir=[SubDir DirExt];% include part after . in the name (considered as a file extension)
     65    NomType='*';
     66    i1_series=[];i2_series=[];j1_series=[];j2_series=[];
     67    i1_input=1;i2_input=[];j1_input=[];j2_input=[];
     68end
    5969if ~exist(FilePath,'dir')
    6070    return % don't go further if the dir path does not exist
    6171end
     72if checkfileindexing
    6273NomTypePref='';
    6374if isempty(NomType)
     
    251262if isequal(j1_series,0), j1_series=[]; end
    252263if isequal(j2_series,0), j2_series=[]; end
    253 
    254 %% detect rdvision format
    255 if strcmp(FileExt,'.bin')
    256     if exist(fullfile(RootPath,SubDir,[RootFile '.seq']),'file')
    257         FileInfo.FileType='rdvision';
    258         FileInfo.SeqFile=[RootFile '.seq'];
    259     end
    260 end
     264end
     265% %% detect rdvision format
     266% if strcmp(FileExt,'.bin')
     267%     if exist(fullfile(RootPath,SubDir,[RootFile '.seq']),'file')
     268%         FileInfo.FileType='rdvision';
     269%         FileInfo.SeqFile=[RootFile '.seq'];
     270%     end
     271% end
    261272
    262273%% introduce the frame index in case of movies or multimage type
  • trunk/src/get_file_info.m

    r784 r790  
    3232    case {'.xml','.xls','.dat','.bin'}
    3333        FileInfo.FileType=regexprep(FileExt,'^.','');% eliminate the dot of the extension;
    34     case '.seq'
    35         FileInfo=ini2struct(fileinput);
    36         if isfield(FileInfo,'sequenceSettings')&& isfield(FileInfo.sequenceSettings,'numberoffiles')
    37             FileInfo.NumberOfFrames=str2double(FileInfo.sequenceSettings.numberoffiles);
    38             FileInfo.FrameRate=str2double(FileInfo.sequenceSettings.framepersecond);
    39             FileInfo.ColorType='grayscale';
    40         else
    41             FileInfo.FileType='';
    42             return
    43         end
    44         FileInfo.FileType='rdvision'; % file used to store info from image acquisition systems of rdvision
    45         nbfield=numel(fieldnames(FileInfo));
    46         FileInfo=orderfields(FileInfo,[nbfield nbfield-1 nbfield-2 (1:nbfield-3)]); %reorder the fields of fileInfo for clarity
     34    case {'.seq','.sqb'}
     35        [A,FileInfo,timestamps,errormsg]=read_rdvision(fileinput,[]);
     36       
    4737    otherwise
    4838        if ~isempty(FileExt)% exclude empty extension
     
    120110        end
    121111end
     112switch FileInfo.FileType
     113    case {'image','multimage','mmreader','video','netcdf','civdata'}
     114        FileInfo.FileIndexing='on'; % allow to detect file index for scanning series
     115end
  • trunk/src/read_rdvision.m

    r785 r790  
    1 function [A,FileInfo,timestamps]=read_rdvision(filename,frame_idx)
     1function [A,FileInfo,timestamps,errormsg]=read_rdvision(filename,frame_idx)
    22% BINREAD_RDV Permet de lire les fichiers bin générés par Hiris à partir du
    33% fichier seq associé.
     
    2121%   NB_FRAMES   : Nombres d'images dans la séquence.
    2222
    23 
     23errormsg='';
    2424if nargin<2% no frame indices specified
    2525   frame_idx=-1;% all the images in the series are read
     
    2727A=[];
    2828timestamps=[];
    29 s=ini2struct(filename);
     29[PathDir,RootFile,Ext]=fileparts(filename);
     30RootPath=fileparts(PathDir);
     31switch Ext
     32    case '.seq'
     33        filename_seq=filename;
     34        filename_sqb=fullfile(PathDir,[RootFile '.sqb']);
     35    case '.sqb'
     36        filename_seq=fullfile(PathDir,[RootFile '.seq']);
     37        filename_sqb=filename;
     38    otherwise
     39        errormsg='input file extension must be .seq or .sqb';
     40end
     41if ~exist(filename_seq,'file')
     42    errormsg=[filename_seq ' does not exist'];
     43    return
     44end
     45s=ini2struct(filename_seq);
    3046FileInfo=s.sequenceSettings;
     47if isfield(s.sequenceSettings,'numberoffiles')
     48    FileInfo.NumberOfFrames=str2double(s.sequenceSettings.numberoffiles);
     49    FileInfo.FrameRate=str2double(s.sequenceSettings.framepersecond);
     50    FileInfo.ColorType='grayscale';
     51else
     52    FileInfo.FileType='';
     53    return
     54end
     55FileInfo.FileType='rdvision'; % file used to store info from image acquisition systems of rdvision
     56nbfield=numel(fieldnames(FileInfo));
     57FileInfo=orderfields(FileInfo,[nbfield nbfield-1 nbfield-2 (1:nbfield-3)]); %reorder the fields of fileInfo for clarity
    3158
    3259% read the images the input frame_idxis not empty
     
    3764    bin_file=FileInfo.binfile;
    3865    nb_frames=str2double(FileInfo.numberoffiles);
    39    
    40     [bin_dir,f]=fileparts(filename);
    41    
    42     sqb_file=fullfile(bin_dir,[f '.sqb']);
    43     m = memmapfile(sqb_file,'Format', { 'uint32' [1 1] 'offset'; ...
     66    m = memmapfile(filename_sqb,'Format', { 'uint32' [1 1] 'offset'; ...
    4467        'uint32' [1 1] 'garbage1';...
    4568        'double' [1 1] 'timestamp';...
     
    6184    for i=1:length(frame_idx)
    6285        ii=frame_idx(i);
    63         binfile=fullfile(bin_dir,sprintf('%s%.5d.bin',bin_file,data(ii).file_idx));
     86        binfile=fullfile(RootPath,FileInfo.binrepertoire,sprintf('%s%.5d.bin',bin_file,data(ii).file_idx));
    6487        fid=fopen(binfile,'rb');
    6588        fseek(fid,data(ii).offset,-1);
Note: See TracChangeset for help on using the changeset viewer.