getnext.m 921 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. function frame = getnext(vr)
  2. %FRAME=GETNEXT(VR)
  3. % This method is a shortcut for
  4. % if (next(vr))
  5. % frame = getframe(vr);
  6. % else
  7. % frame = [];
  8. % end
  9. %
  10. % Although this method can be more convenient than calling NEXT and GETFRAME
  11. % separately, there is no way to distinguish between a zero-sized frame and
  12. % reading past the end of the stream.
  13. %
  14. % Typical usage:
  15. % vr = videoReader('numbers.uncompressed.avi');
  16. % info = getinfo(vr);
  17. % for i=1:info.numFrames
  18. % img = getnext(vr);
  19. % imshow(img);
  20. % pause(1/info.fps);
  21. % end
  22. % vr = close(vr);
  23. %
  24. %SEE ALSO
  25. % videoReader
  26. % videoReader/getframe
  27. % videoReader/next
  28. %
  29. %Copyright (c) 2006 Gerald Dalley
  30. %See "MIT.txt" in the installation directory for licensing details (especially
  31. %when using this library on GNU/Linux).
  32. if (next(vr))
  33. frame = getframe(vr);
  34. else
  35. frame = [];
  36. end