Home > chronux > fly_track > videoIO > videoIO_2007a > @videoReader > seek.m

seek

PURPOSE ^

WORKED=SEEK(VR,FNUM)

SYNOPSIS ^

function worked = seek(vr,fnum)

DESCRIPTION ^

WORKED=SEEK(VR,FNUM)
  Attempts to go to frame number FNUM in video VR.  Returns 0 if the user
  attempts to seek past the end of the video.  For most video plugins, the
  first frame is 0 (not 1), thus in the following example, both IM1 and
  IM2 should be the same for most plugins.
    vr = videoReader(...);
    if (~next(vr)), error('couldn''t read first frame'); end
    im1 = getframe(vr);
    if (~seek(vr,0)), error('could not seek to frame 0'); end
    im2 = getframe(vr);
    if (any(im1 ~= im2)), 
      error('first frame and frame 0 are not the same'); 
    end
    ...
    vr = close(vr);
  FNUM should be an integer.

  After the videoReader constructor is called, NEXT, SEEK, or STEP should
  be called at least once before GETFRAME is called. 
 
  See videoReader/getinfo for more details on how many frames can be read
  from a video. 

SEE ALSO
  videoReader

Copyright (c) 2006 Gerald Dalley
See "MIT.txt" in the installation directory for licensing details (especially
when using this library on GNU/Linux).

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function worked = seek(vr,fnum)
0002 %WORKED=SEEK(VR,FNUM)
0003 %  Attempts to go to frame number FNUM in video VR.  Returns 0 if the user
0004 %  attempts to seek past the end of the video.  For most video plugins, the
0005 %  first frame is 0 (not 1), thus in the following example, both IM1 and
0006 %  IM2 should be the same for most plugins.
0007 %    vr = videoReader(...);
0008 %    if (~next(vr)), error('couldn''t read first frame'); end
0009 %    im1 = getframe(vr);
0010 %    if (~seek(vr,0)), error('could not seek to frame 0'); end
0011 %    im2 = getframe(vr);
0012 %    if (any(im1 ~= im2)),
0013 %      error('first frame and frame 0 are not the same');
0014 %    end
0015 %    ...
0016 %    vr = close(vr);
0017 %  FNUM should be an integer.
0018 %
0019 %  After the videoReader constructor is called, NEXT, SEEK, or STEP should
0020 %  be called at least once before GETFRAME is called.
0021 %
0022 %  See videoReader/getinfo for more details on how many frames can be read
0023 %  from a video.
0024 %
0025 %SEE ALSO
0026 %  videoReader
0027 %
0028 %Copyright (c) 2006 Gerald Dalley
0029 %See "MIT.txt" in the installation directory for licensing details (especially
0030 %when using this library on GNU/Linux).
0031 
0032 worked = feval(vr.plugin, 'seek', vr.handle, fnum);
0033

Generated on Fri 28-Sep-2012 12:34:30 by m2html © 2005