How to make a Video from 3D array
    19 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
I have 3D matrix with dimension of 600x600x28 which the last index is number of frames and want to convert it to video file. I tried as a below but raised with error: 
Unrecognized function or variable 'cmap'.
My code:
Orig = rand(600,600,28);
X = permute(Orig,[1 2 4 3]); % 4D matrix
movie = immovie(X,cmap); 
implay(movie);
0 comentarios
Respuestas (1)
  millercommamatt
      
 el 22 de Jul. de 2021
        You never defined the variable cmap which is supposed to be a color map.
Try This:
Orig = rand(600,600,28);
camp=parula;
X = permute(Orig,[1 2 4 3]); % 4D matrix
movie = immovie(X,cmap); 
implay(movie);
3 comentarios
  millercommamatt
      
 el 23 de Jul. de 2021
				I get the same error and I don't know why. The documentation for immovie says that double is an allowable input data type.
But, I have a fix: Do the conversion of the input array to uint8 yourself.
Orig = randi(256,600,600,28)-1;  % 0-255
cmap=parula;
X = permute(Orig,[1 2 4 3]); % 4D matrix
movie = immovie(uint8(X),cmap);
implay(movie);
Ver también
Categorías
				Más información sobre Lighting, Transparency, and Shading en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

