I'm training a machine learning algorithm, and wanted to make an avi to visualize the appearance of weights over time. I threw together something similar to:
aviobj = avifile( 'weights.avi' );
for jj = 1:whatever
% do some training
imagesc( ... ); % where '...' is stuff to reshape the weight matrix
aviobj = addframe( aviobj, getframe );
end;
aviobj = close( aviobj );
implay( 'weights.avi' );
The problem is, the frames end up looking like this:
The numbers shouldn't have that orientation. This occurs with any avi I generate in matlab.
Any suggestions?
-Brian
Finally had time to get back to this. The problem was due to the axes. When using something like
image
orimagesc
, it tacks on an extra black border line on the bottom & left of the image. When you usegetframe
, it grabs only the image data plotted, sans the black lines. However, the frame itself is slightly larger than the image data.The following solves it:
Setting
axis off
fixes it.