将MATLAB图变成图像 [英] Turn a MATLAB plot into image

查看:112
本文介绍了将MATLAB图变成图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经生成了一个图,

figure; hold;
axis([0 10 0 10]);
fill([ 1 1 5 5], [5 1 1 5],'b')

现在我想将此图作为矩阵,以便可以用高斯过滤博客.在Googleing上,我在MATLAB Central上发现了该线程将图形栅格化为图像.我尝试过,但只能使它适用于线图或函数图.

and now I want to have this plot as an matrix so that I can i.e. filter the blog with a gaussian. Googleing I found this thread Rasterizing Plot to Image at MATLAB Central. I tried it, but I could only get it to work for line or function plots.

你有什么主意吗?

推荐答案

您可以使用GETFRAME函数.它返回电影帧结构,该结构实际​​上是光栅化的图形.字段cdata将包含您的矩阵.

You can use GETFRAME function. It returns movie frame structure, which is actually rasterized figure. Field cdata will contain your matrix.

F=getframe;
figure(2)
imagesc(F.cdata);

这篇关于将MATLAB图变成图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆