Why do I get frames of incorrect size when using the GETFRAME function in MATLAB 7.0 (R14)?
2 views (last 30 days)
Show older comments
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
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;
0 Comments
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!