# playMovie

## PURPOSE

Shows/makes an/several movie(s) from an image sequence.

## SYNOPSIS

function M = playMovie( I, fps, loop, prm )

## DESCRIPTION

     Shows/makes an/several movie(s) from an image sequence.

     To play a matlab movie file, as an alternative to movie, use:
      playMovie(movieToImages(M));
     The images to display are stacked in a higher dimensional array.
     MxNxCxTxRxS, where:
      M - height
      N - width
      C - number of channels, nothing, 1 or 3
      T - number of videos
      R - number of cases
      S - number of sets

     USAGE
      playMovie( I, [fps], [loop], [prm] )

     INPUTS
      I       - MxNxTxRxS or MxNx1xTxRxS or MxNx3xTxRxS or cell
                array where each element is a MxNxTxR or MxNx1xTxR or
                MxNx3xTxR (R ans S can equal 1)
      fps     - [100] maximum number of frames to display per second
                use fps==0 to introduce no pause and have the movie play as
                fast as possible
      loop    - [0] number of time to loop video (may be inf),
                if neg plays video forward then backward then forward etc.
      prm     - [] parameters to use calling montage2

     OUTPUTS

     EXAMPLE - [MxNxT] 1 video
      load( 'images.mat' );
      playMovie( video, [], -50 );

     EXAMPLE - [MxNx3xT] 1 video
      load( 'images.mat' );
      video3=repmat(permute(video,[1 2 4 3]),[1 1 3 1]);
      playMovie( video3, [], -50, struct('hasChn',true));

     EXAMPLE - [MxNxTxR] many videos at same time
      load( 'images.mat' );
      playMovie( videos, [], 5 );

     EXAMPLE - [MxNxTxRxS] show groups of videos in 2 ways
      load( 'images.mat' );
      IC = clusterMontage( videos, IDXv, 9, 1 );
      clf; M = playMovie( IC );
      prm = struct('perRow',1,'padAmt',4,'showLines',0,'nn',1);
      clf; M = playMovie( IC, [], 5, prm );

     EXAMPLE - {S}[MxNxTxR] show groups of videos given in a cell
      load( 'images.mat' );
      IC = clusterMontage( videos, IDXv, 9, 1 );
      ICcell = squeeze(mat2cell2( IC, [1 1 1 1 9] ));
      clf; M = playMovie( ICcell, [], 5, struct('showLines',0) );

     See also MONTAGE2, MOVIETOIMAGES, MOVIE

     Piotr's Image&Video Toolbox      Version 2.0
     Copyright 2012 Piotr Dollar.  [pdollar-at-caltech.edu]
     Please email me if you find bugs, or have suggestions or questions!
     Licensed under the Simplified BSD License [see external/bsd.txt]