How to make a video from a 3d matrix in matlab

前端 未结 1 1122
一个人的身影
一个人的身影 2021-01-13 07:51

I have a whole bunch of 2D matrices in matlab (they\'re suppose to make up a 3D matrix where the 3rd dimension is time), and I\'m trying to make a video from the image data.

相关标签:
1条回答
  • 2021-01-13 08:25

    The built-in function immovie(X,map) is one option for what you want. This function expects a m-by-n-by-1-by-k 4D matrix, where the 4th dimension is the frames of the movie. Since you're starting with a 3D matrix, use permute first:

    Orig; % 3D matrix
    X = permute(Orig,[1 2 4 3]); % 4D matrix
    movie = immovie(X,map); % map is the colormap you want to use
    
    implay(movie);
    
    0 讨论(0)
提交回复
热议问题