step.m 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. function fn = step(vr, delta)
  2. %WORKED=STEP(VR,DELTA)
  3. % Moves the frame counter by DELTA frames for video VR. This is a
  4. % generalization of NEXT. Returns 0 on an unsuccessful STEP. Note that
  5. % not all plugins support stepping, especially with negative numbers. In
  6. % the following example, both IM1 and IM2 should be the same for most
  7. % plugins.
  8. % vr = videoReader(...myurl...);
  9. % if (~next(vr)), error('couldn''t read first frame'); end
  10. % im1 = getframe(vr);
  11. % if (~step(vr,-1)), error('could not step back to frame 0'); end
  12. % im2 = getframe(vr);
  13. % if (any(im1 ~= im2)),
  14. % error('first frame and frame 0 are not the same');
  15. % end
  16. % vr = close(vr);
  17. % FNUM should be an integer.
  18. %
  19. % After the videoReader constructor is called, NEXT, SEEK, or STEP should
  20. % be called at least once before GETFRAME is called.
  21. %
  22. % See videoReader/getinfo for more details on how many frames can be read
  23. % from a video.
  24. %
  25. %SEE ALSO
  26. % videoReader
  27. %
  28. %Copyright (c) 2006 Gerald Dalley
  29. %See "MIT.txt" in the installation directory for licensing details (especially
  30. %when using this library on GNU/Linux).
  31. fn = feval(vr.plugin, 'step', vr.handle, delta);