matlab getframe()
来源:互联网 发布:centos zip 压缩 编辑:程序博客网 时间:2024/06/05 01:10
F = getframe(h,rect) specifies
a rectangular area from which to copy the pixmap. rect is relative to the lower left corner of the figure or axes h,in pixel units. rect is a four-element vector in the form [left bottom width height], where width and height define the dimensions of the rectangle.
本函数是要从图形对象中截取一块出来。其中h是图像句柄,rect是一个四元素向量,代表[a b c d],其中a表示截取区域到图像左端的像素数,b表示截取区域到图像底端的像素数,c表示截取区域水平像素数,d表示截取区域垂直向像素数。
得到的F是一个结构体(struct),包含两个元素:cdata和colormap,其中cdata是截取区域的数据,是一个三维数组,其中第三维的长度是3,即截取到的是区域中RGB的值。colormap是调色板,这个没啥意思。
例如:
x=0:pi/100:2*pi;
y=sin(x);
plot(x,y)
set(gcf,'color',[1 1 1]) %设置背景色为白色
title('测试图像保存')
F=getframe(gcf); % 获取整个窗口内容的图像
F1=getframe;
% 获取坐标轴为界的图像 imwrite(F.cdata,'test1.png')
imwrite(F1.cdata,'test2.png')
getframe获得的是一个架构struct类型的数据,
其中cdata子域的内容才可以用imwrite内容保存,用F.cdata表示
getframe(gcf) 即get current figure,获得窗口内图像,包含legend、title以及label。如果不添加gcf,默认为gca(get current axis)。
imwrite 可以保存jpg、png等格式图像,gif是7.0添加的,但是好像没办法保存为动画,只能保存第一帧。
与在图像界面直接利用复制,或用file>save as...保存不同的是,imwrite的背景色为窗口实际颜色,默认为灰色(RGB表示为[.7 .7 .7]),若想保留白色背景图,需添加例子中的set gcf color命令。
- getframe matlab
- matlab getframe()
- MATLAB getframe用法
- MATLAB getframe用法
- MATLAB getframe用法
- MATLAB getframe用法
- getframe
- matlab getframe frame2im 存储坐标到图片
- MATLAB中getframe应用函数举例
- Matlab 保存多个图像 getframe、imwrite、sprintf、num2str、doc
- getframe在Vista和Win7中执行的问题
- matlab
- Matlab
- MATLAB
- matlab
- matlab
- matlab
- matlab
- Eclipse中常用的快捷键
- sicily 1176. Two Ends
- a标签中有点击(onclick)事件
- HIVE 1.1.0 启动时报错: Unsupported major.minor version 51.0
- Unity 加密解密那些事(转载)
- matlab getframe()
- C++ atof函数
- hive升级测试记录
- Struts2返回JSON数据的具体应用范例
- POJ 2031:Building a Space Station 最小生成树
- Android性能专项测试之Memory Monitor工具
- leetcode6
- c++中的构造函数
- jz2440的字符设备驱动