Why do I get frames of incorrect size when using the GETFRAME function in MATLAB 7.0 (R14)?

4 views (last 30 days)
When I use the IMREAD function to read an image file, then plot the image and use the GETFRAME function to get a movie frame from the resulting figure, the frame is sometimes a different size than the original image. For example, the following code may produce inconsistent results:
for i = 1:5
imagedata = rand(200);
figure;
imshow (imagedata, []);
frame = getframe(gca);
[I,map] = frame2im(frame);
fprintf('Size = %d,%d,%d\n',size(I));
close;
end

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
This bug has been fixed in Release 14 Service Pack 3 (R14SP3). For previous product releases, read below for any possible workarounds:
There is a bug in the way that MATLAB 7.0 (R14) handles the GETFRAME function.
As a workaround, use the same figure for each frame as in the following example:
figure;
for i = 1:5
imagedata = rand(200)
imshow (imagedata, []);
frame = getframe(gca);
[I,map] = frame2im(frame);
fprintf('Size = %d,%d,%d\n',size(I));
end
close;

More Answers (0)

Categories

Find more on Images in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!