Matlab中getframe函数的用法

问题描述:

Matlab中getframe函数的用法
比如这句 F = getframe(2,[85,58,20,20]);这句中的各个数字表示什么意思,忘知道的大侠解答下,感激不尽!
1个回答 分类:综合 2014-10-15

问题解答:

我来补答
matlab help:
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是调色板,这个没啥意思.
F = getframe(2,[85,58,20,20]),显然 F.cdata 是一个 20*20*3的数组.
尝试以下代码:
Z = peaks; surf(Z);
F = getframe(gcf,[150 150 100 100]);
figure,imshow(F.cdata);
 
 
展开全文阅读
剩余:2000