Wrapper for reading/writing seq files. A seq file is a series of concatentated image frames with a fixed size header. It is essentially the same as merging a directory of images into a single file. seq files are convenient for storing videos because: (1) no video codec is required, (2) seek is instant and exact, (3) seq files can be read on any operating system. The main drawback is that each frame is encoded independently, resulting in increased file size. The advantage over storing as a directory of images is that a single large file is created. Currently, either uncompressed or jpg compressed frames are supported. Should not be called directly, rather use with seqIo or videoIO. The seq file format is modeled after the Norpix seq format (in fact this reader can be used to read some Norpix seq files). The actual work of reading/writing seq files is done by seqReaderPlugin and seqWriterPlugin. These plugins were originally intended for use with the videoIO Toolbox for Matlab written by Gerald Daley: http://sourceforge.net/projects/videoio/. However, the plugins also work with seqIo.m (this function), and there is no need to actually have videoIO installed to use seq files. In fact, the plugins have not yet been tested with videoIO. mode=='r': Serves as a wrapper for seqReaderPlugin, available actions: sr=seqIo(fName,'r') % Create new sequence reader object. sr.close(); % Close seq file (sr is useless after). [I,ts]=sr.getframe(); % Get current frame (returns [] if invalid). [I,ts]=sr.getframeb(); % Get current frame with no decoding. info = sr.getinfo(); % Return struct with info about video. [I,ts]=sr.getnext(); % Shortcut for next() followed by getframe(). out = sr.next(); % Go to next frame (out=-1 on fail). out = sr.seek(frame); % Go to specified frame (out=-1 on fail). out = sr.step(delta); % Go to current frame + delta (out=-1 on fail). See seqReaderPlugin for more info about the individual actions. mode=='w': Serves as a wrapper for seqWriterPlugin, available actions: sw=seqIo(fName,'w',info) % Create new sequence writer object. sw.close(); % Close seq file (sw is useless after). sw.addframe(I,[ts]); % Writes video frame (and timestamp) sw.addframeb(bytes); % Writes video frame with no encoding. info = sw.getinfo(); % Return struct with info about video. See seqWriterPlugin for more info about the individual actions and about the parameter sturcutre 'info' used to create the writer. mode=='rdual': Wrapper for two videos of the same image dims and roughly the same frame counts that are treated as a single IO object. getframe() returns the concatentation of the two frames. For videos of different frame counts, the first video serves as the "dominant" video and the frame count of the second video is adjusted accordingly. Same general usage as in mode=='r', but the only supported operations are: close(), getframe(), getinfo(), and seek(). Open with: sr = seqIo( {fName1,fName2}, 'rdual' ) mode=='crop': Crop subsequence from seq file: seqIo( fName, 'crop', tName, f0, f1 ) seqIo( fName, 'crop', tName, frames ) mode=='toimgs': Extract images from seq file to dir/I[frame,5].ext: seqIo( fName, 'toimgs', dir ) mode=='frimgs': Make seq file from images in dir/I[frame,5].ext: seqIo( fName, 'frimgs', info, dir ) USAGE sobj = seqIo( fName, mode, varargin ) INPUTS fName - seq file to open mode - 'r'=read, 'w'=write, for other modes see above varargin - additional input (varies according to cmd) OUTPUTS sobj - object used to access seq file EXAMPLE See also SEQPLAYER, SEQREADERPLUGIN, SEQWRITERPLUGIN Piotr's Image&Video Toolbox Version 2.31 Copyright 2009 Piotr Dollar. [pdollar-at-caltech.edu] Please email me if you find bugs, or have suggestions or questions! Licensed under the Lesser GPL [see external/lgpl.txt]