将 MATLAB 绘图转换为图像 [英] Turn a MATLAB plot into image

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

问题描述

我已经生成了一个像

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

现在我想把这个图作为一个矩阵,这样我就可以用高斯过滤博客.谷歌搜索我在 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天全站免登陆