MATLAB getframe捕获屏幕上的所有内容 [英] MATLAB getframe captures whatever is on screen
本文介绍了MATLAB getframe捕获屏幕上的所有内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试根据我的MATLAB图制作电影.当我调用getframe时,它通常"捕获绘图图像,但是有时如果屏幕上有其他活动的窗口(如果我继续使用计算机,这是正常的),则它将捕获任何活动的窗口.有没有其他方法可以捕获活动人物的图像?
I am trying to create a movie from my MATLAB plot. When I call getframe, it "usually" captures the plot image, but sometimes if there is something else active on the screen (which is normal if I continue to use the computer) it captures whatever window is active. Is there another way to grab the image of the active figure?
例如
fig = figure;
aviobj = avifile('sample.avi','compression','None');
for i=1:t
clf(fig);
plot(...); % some arbitrary plotting
hold on;
plot(...); % some other arbitrary plotting
axis([0 50 0 50]);
aviobj = addframe(aviobj, getframe(fig));
end
aviobj = close(aviobj);
推荐答案
确定,找到解决方案;代替
OK, found the solution; instead of
aviobj = addframe(aviobj, getframe(fig));
直接将图形手柄发送到addframe就足够了:
sending the figure handle directly to addframe is enough:
aviobj = addframe(aviobj, fig);
这篇关于MATLAB getframe捕获屏幕上的所有内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文