Displaying frames captured by getframe(h) at original size
15 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Donald Liu
am 7 Okt. 2021
Kommentiert: Donald Liu
am 7 Okt. 2021
I captured multiple frames from a figure, and would like to play them back one frame at a time. Please see the below example code:
h = figure;
for i=1:10
plot(rand(20, 1));
grid
title('Original figure');
xlabel('This is the original x label.');
MV(i) = getframe(h);
pause(0.01);
end
% The image displayed in this portion is *smaller* than the original plot,
% as it tries to fit the entire figure within the original axes
for i=1:10
image(MV(i).cdata);
% movie(h, MV(i));
pause;
end
The problem is, when displayed using "image(MV(i).cdata)", the entire content of the figure has to fit within the plotting axes, including title and labels, so there's a shrinkage. I could use "movie(h, MV(i))", which does not cause this rescaling, but "movie" has the bad habbit of clearing the figure each time, so the display is flashing annoyingly. Do you have better solutions? Thanks in advance!
0 Kommentare
Akzeptierte Antwort
Chunru
am 7 Okt. 2021
You can use "imshow" which by default show images in 100% magnification. "doc imshow" for more details.
3 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Line Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!