video - Matlab: using avifile, addframe, getframe; the generated avi is contorted -


i'm training machine learning algorithm, , wanted make avi visualize appearance of weights on time. threw similar to:

aviobj = avifile( 'weights.avi' ); jj = 1:whatever   % training   imagesc( ... ); % '...' stuff reshape weight matrix   aviobj = addframe( aviobj, getframe ); end; aviobj = close( aviobj ); implay( 'weights.avi' ); 

the problem is, frames end looking this: enter image description here

the numbers shouldn't have orientation. occurs avi generate in matlab.

any suggestions?

-brian

finally had time this. problem due axes. when using image or imagesc, tacks on black border line on bottom & left of image. when use getframe, grabs image data plotted, sans black lines. however, frame larger image data.

the following solves it:

aviobj = avifile( 'weights.avi' ); fig = figure; jj = 1:whatever   % training   imagesc( ... ); % '...' stuff reshape weight matrix   axis off;   aviobj = addframe( aviobj, getframe( fig ) ); end; aviobj = close( aviobj ); implay( 'weights.avi' ); 

setting axis off fixes it.


Comments