Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Frames to video conversion

Asked by Lalit Patil on 5 Feb 2013
 aviObject = avifile('Myvid1.avi')
 for ctr = 441:500
 iFrame = clock; 
 fname = ['IMG' num2str(ctr),'.PNG']; 
 I = imread(fname);                  
 F = im2frame(I);                    
 aviObject = addframe(aviObject,I);  
 elapsed = etime(clock, iFrame);
 pause(5 - elapsed); 
 end
 aviObject = close(aviObject); 

This is my code to create video from frames.. It shows error..

 ??? Error using ==> im2frame
 Indexed movie frame must have a non-empty colormap

Why..? My images are 600*800uint8 type..

0 Comments

Lalit Patil

Products

No products are associated with this question.

1 Answer

Answer by Walter Roberson on 5 Feb 2013
Accepted answer
[I, cmap] = imread(fname); 
F = im2frame(I, cmap);

2 Comments

Lalit Patil on 5 Feb 2013

still problem.. colormap is empty for image.

 cmap = []

This is the image

http://speedy.sh/wkGFf/IMG447.PNG

Walter Roberson on 5 Feb 2013

Before the loop:

cmap = gray(256);

Then in the loop,

I = imread(fname);
F = im2frame(I, cmap);
Walter Roberson

Contact us