figure('position',[ 0 0 imageSize(2) imageSize(1) ]); set(gcf,'DoubleBuffer','on','MenuBar','none'); .F = getframe(gcf);imwrite(F.cdata,FileName,'bmp'); 中间大部分语句能够看懂,这两句看不懂,
来源:学生作业帮助网 编辑:作业帮 时间:2024/07/06 04:55:10
![figure('position',[ 0 0 imageSize(2) imageSize(1) ]); set(gcf,'DoubleBuffer','on','MenuBar','none'); .F = getframe(gcf);imwrite(F.cdata,FileName,'bmp'); 中间大部分语句能够看懂,这两句看不懂,](/uploads/image/z/3166735-31-5.jpg?t=figure%28%27position%27%2C%5B+0+0+imageSize%282%29+imageSize%281%29+%5D%29%3B+set%28gcf%2C%27DoubleBuffer%27%2C%27on%27%2C%27MenuBar%27%2C%27none%27%29%3B+.F+%3D+getframe%28gcf%29%3Bimwrite%28F.cdata%2CFileName%2C%27bmp%27%29%3B+%E4%B8%AD%E9%97%B4%E5%A4%A7%E9%83%A8%E5%88%86%E8%AF%AD%E5%8F%A5%E8%83%BD%E5%A4%9F%E7%9C%8B%E6%87%82%2C%E8%BF%99%E4%B8%A4%E5%8F%A5%E7%9C%8B%E4%B8%8D%E6%87%82%2C)
figure('position',[ 0 0 imageSize(2) imageSize(1) ]); set(gcf,'DoubleBuffer','on','MenuBar','none'); .F = getframe(gcf);imwrite(F.cdata,FileName,'bmp'); 中间大部分语句能够看懂,这两句看不懂,
figure('position',[ 0 0 imageSize(2) imageSize(1) ]);
set(gcf,'DoubleBuffer','on','MenuBar','none');
.
F = getframe(gcf);
imwrite(F.cdata,FileName,'bmp');
中间大部分语句能够看懂,这两句看不懂,
figure('position',[ 0 0 imageSize(2) imageSize(1) ]); set(gcf,'DoubleBuffer','on','MenuBar','none'); .F = getframe(gcf);imwrite(F.cdata,FileName,'bmp'); 中间大部分语句能够看懂,这两句看不懂,
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结构体里的cdata矩阵(代表一个图像),写成一个bmp文件,存在当前工作目录.